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.

Creating sessions and threads on mentions

Creating sessions and threads on mentions - Node.js Tutorial

From the course: Building Bots with Node.js

Start my 1-month free trial

Creating sessions and threads on mentions

- [Instructor] So, in this video, we will finally implement threaded sessions for Slack, and I'm still in routes/bots/slack.js. So as we know, we want to start a new session when our bot user is mentioned, so I head down to our handler function for mentions, and there I will first generate a session ID. Const sessionId equals createSessionId, so that's another helper function we created before. Event.channel, event.user, and then I will add event.thread_ts, so this applies when we are already in a thread, or if this message is not yet part of a thread but will become the root of the thread, we'll use event.ts. Let's remove the sidebar here. Next we're going to try to get the session from our session store, so I'll add let session equals sessionService.get, sessionId, and then if there is no existing session, this will return false, so if this is the case, I want to create a new session. So if there is no session,…

Contents