Can anyone confirm whether convo.ask works with Slack message buttons as shown in this readme for interactive messages?
https://github.com/howdyai/botkit/blob/master/docs/readme-slack.md#message-buttons
I'm unable to get a callback to the pattern matching block after the buttons are clicked on Slack. I read that after clicking on the message button, both interactive_message_callback and message_received should be fired. However, only interactive_message_callback works in my case.
I have tried my code with the following repo: https://github.com/slackapi/easy-peasy-bot
Following is my code:
controller.hears('test', 'direct_message', function(bot, message) {
bot.startConversation(message, function(err, convo) {
convo.ask({
attachments:[
{
title: 'Do you want to proceed?',
callback_id: '123',
attachment_type: 'default',
actions: [
{
"name":"yes",
"text": "Yes",
"value": "yes",
"type": "button",
},
{
"name":"no",
"text": "No",
"value": "no",
"type": "button",
}
]
}
]
},[
{
pattern: "yes",
callback: function(reply, convo) {
convo.say('FABULOUS!');
convo.next();
// do something awesome here.
}
},
{
pattern: "no",
callback: function(reply, convo) {
convo.say('Too bad');
convo.next();
}
},
{
default: true,
callback: function(reply, convo) {
// do nothing
}
}
]);
});
});
Can anyone please tell me what could be the issue?
That easy peasy repro is pretty old, have you tried your code with the Botkit Starter Kit for slack?
https://github.com/howdyai/botkit#start-with-botkit-studio
Thanks, I tried with the botkit starter studio for Slack and it worked!