Search code examples
pythonbotsslackslack-api

Can a Slack bot interact with another bot and trigger some functions of it in a channel?


I built a Slack bot and tried to make my bot interact with another bot in the a channel, but it seems not working.

For example, I want to use the voting function of Polly (a Slack bot).

Regular users like me send /polly "Which is better?" "Tacos" "Pizza" message and Polly will create a Slack poll in a channel. But when I made my bot send the same message in the same channel (I use python-slackclient and chat.postMessage method), the message just like a simple text, in other words, it didn't trigger Polly.

So, in a channel, how can a Slack bot interact with another bot and trigger some functions of it? Did anybody ever do something like this?


update

https://github.com/ErikKalkoken/slackApiDoc/blob/master/chat.command.md

I tried this method but got another problem...

The error message is

{'error': 'missing_scope',
 'needed': 'post',
 'ok': False,
 'provided': 'identify,bot:basic'}

The Oauth token requires "post" scope, but official documents show that "post" scope is deprecated. How do I make my token have "post" scope?


Solution

  • I have tried to make two bots interact and didn't find it to work. Slack somehow recognizes the source of the message and if the message is sent by a bot or an app, it fails to respond to it. I have even tried to post the message as a user through the slack API but did not get it to work. However, Bots can use the chat.command method to invoke a slash command. Unofficial documentation can be found here:

    https://github.com/ErikKalkoken/slackApiDoc/blob/master/chat.command.md