Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
controller.on('interactive_message', async (bot, message) => {
console.log('INTERACTIVE MESSAGE', message);
switch(message.actions[0].name) {
case 'replace':
await bot.replyInteractive(message,'[ A previous message was successfully replaced with this less exciting one. ]');
break;
case 'dialog':
await bot.replyWithDialog(message, new SlackDialog('this is a dialog', '123', 'Submit', [
{
type: 'text',
label: 'Field 1',
name: 'field1',
},
{
type: 'text',
label: 'Field 2',
name: 'field2',
}
]).notifyOnCancel(true).state('foo').asObject());
break;
default:
await bot.reply(message, 'Got a button click!');
}
});
controller.on('interactive_message', async (bot, message) => {
console.log('INTERACTIVE MESSAGE', message);
switch(message.actions[0].name) {
case 'replace':
await bot.replyInteractive(message,'[ A previous message was successfully replaced with this less exciting one. ]');
break;
case 'dialog':
await bot.replyWithDialog(message, new SlackDialog('this is a dialog', '123', 'Submit', [
{
type: 'text',
label: 'Field 1',
name: 'field1',
},
{
type: 'text',
label: 'Field 2',
name: 'field2',
}
]).notifyOnCancel(true).state('foo').asObject());
break;
default:
await bot.reply(message, 'Got a button click!');
}
});