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

Botkit replyInteractive not working with interactive messages /triggers #21

Open
takezuki opened this issue Jul 6, 2017 · 2 comments
Open

Comments

@takezuki
Copy link

takezuki commented Jul 6, 2017

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.

@takezuki
Copy link
Author

I guess no one wants to help so I'll just stop using BotKit Studio and do everything manually from the code itself~~

@peterswimm
Copy link

Sometimes it takes a few days (and rarely on the weekend) for people to evaluate new issues. I'll post a link to this in our public slack and see if we can get you some feedback.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants