From the course: Building Bots with Node.js

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Handling threaded messages

Handling threaded messages - Node.js Tutorial

From the course: Building Bots with Node.js

Start my 1-month free trial

Handling threaded messages

- In this video we will extend our bot so that it can follow up messages in a thread even if it wasn't mentioned. For that we will create a new handle that will listen to message events and check if the incoming message is part of a thread we have a session for. This means it's an ongoing conversation. First of all, we want to factor out now everything that we need for mentions as well as for handling messages into a separate function. So, starting with line 40, I will now copy out that code block starting with this regex for mention, and down to posting the message to slack. And I will simply create the new function, async function, process event, and this function should get a session and the event. Pasting in this code block, and I now have to of course call that from my mention handles, so I add return process event, and I'm passing in the session, enter current event. Now I am implementing new handler…

Contents