Search code examples
slackslack-api

Monitor a channel in slack and post a summary in a different channel


We have an app that posts updates to a slack channel. I want to monitor the messages posted to ChannelA and if the text begins with "AAA", then post the whole of the first line of the message "AAA Here is your summary" to ChannelB

Is there a way to do this within Slack? E.g. with Slackbot?


Solution

  • That is not hard to do. Here is one of several valid approaches:

    1. Create you own Slack app with a bot user and subscribe to the message event via Events API

    2. Invite your bot user to the channel you want to monitor

    3. You app will now receive a copy of all message posted to that channel

    4. Detect the messages you are interested in

    5. Post a new message based on the detected message to the new channel, e.g. with chat.postMessage API method