I have a Slack bot written in Node.js and I'd like to make it so the bot can process (and answer) every time a person reacts to the bot's messages with an emoji.

I understand probably I will only be able to react to an emoji added in a short time window after my bot send the message.

I have not found any starting point.

For context, I'm using the express library and the listen() and post() methods.


Your app will need to subscribe to reaction_added event. Once subscribed, you'll receive this event each time a reaction is added to a message visible to the bot. This means, this you'll receive the event for the channels where the bot is a member. Or direct messages sent to/by the bot.

If you specifically want to process events where the message was sent by the bot, look for item_user property in the body of the event. You can compare it with the bot user ID to know if it was a reaction to a message originally sent by the bot.

Also, if you are using Node.js, consider using the official framework made by Slack - bolt. It makes a lot of things simpler.

Not the answer you're looking for? Browse other questions tagged or ask your own question.