Wen
Wen

Reputation: 47

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?

Upvotes: 3

Views: 2908

Answers (2)

Erik Kalkoken
Erik Kalkoken

Reputation: 32698

You are correct that the undocumented chat.command requires the post scope to work, which is not available in the standard OAuth process (e.g. you can not choose it as scope on the Slack app config site.)

The only currently working solution that I know of it to use a legacy token.

See also this answer.

Upvotes: 2

Akshay Apte
Akshay Apte

Reputation: 1653

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

Upvotes: 2

Related Questions