Today we will be creating a SlackBot that reacts to every message sent by a specific user. Useful, right? 😄 Creating a New Slack App The first thing we have to do is create a new app. We do this by navigating to and navigating to . Slack api.slack.com Your Apps -> Create New App We’ll call our app . Next up, we have to set up , a , and . reacting-bot event subscriptions bot user permissions Socket Mode The first thing we have to do is enable Socket Mode. Turning on Socket Mode will route your app’s interactions and events over a WebSockets connection instead of sending these payloads to different Request URLs. To enable Socket Mode, navigate to and hit . You will be prompted to add scopes and generate an app-level token. Give the token a name, e.g., “token”, and add the following scopes: Settings -> Socket Mode Enable Socket Mode & connections:write authorizations:read As the names suggest, these will give our app permission to read and write messages. Event Subscriptions Next up, we need to enable Event Subscriptions, which can be found beneath in the left-side menu. After enabling Event Subscriptions, you will need to add the following Event Subscriptions. Features Subscribe to bot events: message.groups Subscribe to event on behalf of users: message.channels Bot User If a Bot User has not yet been created, it can be set up on the tab. Here we can set a display name and its username. App Home Permissions Lastly, we need to ensure that the SlackBot has all the correct permissions needed. Head over to and add the permission to the . OAuth & Permissions reactions.write Bot Token Scopes We have now set up the SlackBot, and we are ready to start coding! Writing The Bot We will be using the library as an interface to the Slack API. It comes with many useful features that make creating SlackBots a breeze. bolt-js While in a new directory , we can initialize the project using . This will create a file that looks like the following: reacting-bot npm init -y package.json { "name": "reacting-bot", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" } For this project, we are going to need two packages. and . is an interface that we use to communicate with the Slack API, and is used to access environment variables. We can install the packages with the following command: @slack/bolt dotenv Bolt dotenv npm install @slack/bolt dotenv Next up, we need to create the file which should store our environment variables for when we are running this project locally. The file should contain the following: .env SIGNING_SECRET=5c24e... TOKEN=xoxb-... APP_TOKEN=xapp-... USER_ID=UCF8... can be found on the page SIGNING_SECRET Basic Information (xoxb) can be found on the page TOKEN OAuth & Permissions (xapp) can be found on the page under APP_TOKEN Basic Information App-level tokens can be found when viewing a slack profile under USER_ID More In , we start by importing and , and we initialize a bolt application in socket mode in the constant : index.js @slack/bolt dotenv app const { App } = require("@slack/bolt"); require("dotenv").config(); const app = new App({ signingSecret: process.env.SIGNING_SECRET, token: process.env.TOKEN, socketMode: true, appToken: process.env.APP_TOKEN, }); We then write the logic that uses the method to attach a listener for messages. message() app.message(async ({ message, context }) => { if (message.user === process.env.USER_ID) { try { const result = await app.client.reactions.add({ token: context.botToken, name: "heavy_plus_sign", channel: message.channel, timestamp: message.ts, }); } catch (error) { console.error(error); } } }); We check any given message is sent by the user with the . If we find a match, we use the function to add a reaction to the message. ID USER_ID app.client.reactions.add() Lastly, we add a function that runs when the application starts. This function will start up the Slack App: (async () => { const port = process.env.PORT || 3000; await app.start(port); console.log(`⚡️ reacting-bot is running on port ${port}`); })(); And that’s it! You can now run the app using the command, and the bot will start reacting to messages once it has been added to the correct channels. npm start This is what the final code looks like: const { App } = require("@slack/bolt"); require("dotenv").config(); const app = new App({ signingSecret: process.env.SIGNING_SECRET, token: process.env.TOKEN, socketMode: true, appToken: process.env.APP_TOKEN, }); app.message(async ({ message, context }) => { if (message.user === process.env.USER_ID) { try { const result = await app.client.reactions.add({ token: context.botToken, name: "heavy_plus_sign", channel: message.channel, timestamp: message.ts, }); } catch (error) { console.error(error); } } }); (async () => { const port = process.env.PORT || 3000; await app.start(port); console.log(`⚡️ reacting-app is running on port ${port}`); })(); Thanks for checking out this guide! You can view the code for this project on my . GitHub Also published here.