https://api.slack.com/docs/message-buttons
I am not having luck with response_type: 'ephemeral' when using interactive messages:
convo.ask({
response_type: 'ephemeral',
attachments: [
{
title: 'Do you want to proceed LOL?',
callback_id: '123',
attachment_type: 'default',
actions: [
{
"name": "yes",
"text": "Yes",
"value": "yes",
"type": "button",
},
{
"name": "no",
"text": "No",
"value": "no",
"type": "button",
}
]
}
]
},
It is simply broadcasted to everyone.
Did you find a way to work?
@dfischer @agassan I ran into the same problem and experimented on this a little bit myself. The result is a bit complicated to explain but let me give it a try:
As I see it you can use the 'response_type' attribute only in two cases:
Here is an example:
controller.hears('^experiment', ['direct_message', 'direct_mention'], (bot, message) => {
console.log('Experiment started');
bot.reply(message, {
attachments: [
{
title: 'Experiment',
callback_id: 'experiment',
attachment_type: 'default',
actions: [
{
name: 'public',
text: 'Secret',
value: '',
type: 'button'
}
]
}
]
});
});
controller.on('interactive_message_callback', (bot, message) => {
console.log('Experiment continued');
bot.replyInteractive(message, {
text: 'Can you keep a secret?',
replace_original: false,
response_type: 'ephemeral'
}, (err) => {
if (err) {
console.log(err);
} else {
console.log('Experiment finished')
}
});
});
As a result the 'Experiment' button will trigger the bot to answer with a hidden new message. I use this behavior to initiate a conversational user-interaction with buttons.
Please let us know if this did not solve your issue.
https://github.com/howdyai/botkit/issues/291#issuecomment-251079438 works for me.
Most helpful comment
@dfischer @agassan I ran into the same problem and experimented on this a little bit myself. The result is a bit complicated to explain but let me give it a try:
As I see it you can use the 'response_type' attribute only in two cases:
Here is an example:
As a result the 'Experiment' button will trigger the bot to answer with a hidden new message. I use this behavior to initiate a conversational user-interaction with buttons.