Listen for Slack messages matching pattern, run any Node.js code in response
This workflow listens for messages containing "Star Wars", and sends a message in response:
You can modify this workflow to listen for any message pattern, in any channel, and run any Node.js code or actions in any integrated apps.
url_verification
event Slack sends to this endpoint. You'll see this HTTP request in the Inspector.message.channels
. This lets the Slack bot will listen for messages sent to any channel it's added to.channels:read
and chat:write
permissions. The channels:history
permission should have been automatically added when you requested to listen for new messages in channels, above.This workflow requires you add the bot manually to each channel where you'd like to listen for messages. Just click on the channel's member list, expand the Apps section, and add the app:
Then send a message with "Star Wars" in the text, and you'll get the forceful response.
You can, optionally, create a workflow that listens for channel_created messages and uses the Slack API to join that channel (see this SO post).