Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Botkit replyInteractive not working with interactive messages /triggers #21

@takezuki

Description

@takezuki

I'm currently trying to improve the current starting Botkit (botkit-starter-slack) skills/interactive_messages.js file.
Instead of having many successive messages like shown in the Botkit Walkthrough (https://www.youtube.com/watch?v=ne_pqgpnkaw), I would like to use the bot.replyInteractive() feature to update the original message and replace it by a message linked to a specified value.

Here is my current state:

`module.exports = function(controller) {

// create special handlers for certain actions in buttons
// if the button action is 'action', trigger an event
// if the button action is 'say', act as if user said that thing
controller.on('interactive_message_callback', function(bot, trigger) {
 if (trigger.actions[0].name.match(/^default$/)) {

    var message = {
            user: trigger.user,
            channel: trigger.channel,
            text: '<@' + bot.identity.id + '> ' + trigger.actions[0].value,
            type: 'message',
        };

        var reply = trigger.original_message;
      
      
        bot.replyInteractive(trigger, reply);
        
        controller.receiveMessage(bot, message);
        return false; // do not bubble event
    }

});

}
`

But here is the outcome:

screenshot

The first message is implied with @bot help.
"More details" has the value "help wifi".
The thread "wifi" in the "help" script in botkit studio contained the message "This is Wifi".

As you can see, the message linked to the value of the button isn't replacing the original message generated by "help", but instead the triggered message is added when clicking to the "More details" button. I tried many drafts but I can't find a way to make it work, I'm not very experimented with coding but I thought I would post here to contribute to the whole Botkit community as I'm sure I'm the only one willing to have this feature to then enjoy the editing in the Botkit Studio.
Fixing this issue will allow to integrate Studio Botkit as the main editor (with threads and triggers) rather than having to code in the .js files.
And I think this most basic feature should be integrated in the default Botkit.

Nb: To ease the configuration of this new integrated feature, I put it under the "default" action name.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions