botium-bindings icon indicating copy to clipboard operation
botium-bindings copied to clipboard

Timeline to support slash commands for Slack Bots

Open ndileep opened this issue 7 years ago • 8 comments

Hi, is there a tentative date for slash command support? If there are any tips on how the existing testmybot can be modified to support slash commands, that would be helpful too. Thanks!

ndileep avatar Jul 03 '17 17:07 ndileep

Hi it is on my todo list to enhance support for slackbots. This is still rather poor. It shouldnt be too much effort though, most work to be done in the slackmock-package, probably in the function called "hears".

codeforequity-at avatar Jul 04 '17 14:07 codeforequity-at

Hi, in an attempt to support slash commands, I made some changes (accessible from here - https://www.dropbox.com/sh/4koctzqfuj7f7rw/AACW2iWUoWqFdb4sO-ZuRIK0a?dl=0). I made use a separate directory spec/slash similar to spec/convo, for slash command files. Made simple assumption that the test starts with one direct convo (so that team registration and welcome messages are taken care) and then the slash commands are run.

Here is the current behavior observed:

  1. Conversation continues to work as in your original version
  2. Bot receives the slash command and sends the response. I can see it from my Bot's debug statements. However, the mock is not receiving the response that the Bot sends.

Thanks!

ndileep avatar Jul 04 '17 14:07 ndileep

I can make you a collaborator for this project so we could work on this topic in a feature branch. Would be more easy than sharing code in dropbox ...

codeforequity-at avatar Jul 04 '17 15:07 codeforequity-at

Sure. I guess it would be a minor change to make slash commands work. Do you see anything obvious in the code I sent? I tried with different request_urls (like https://hooks.slack.com/.... and https://slack.com/...., http://...), but none of them brings the slash command responses to the mock. I think the mock connection is good because convo messages work well. Thanks!

ndileep avatar Jul 04 '17 16:07 ndileep

What bot are you testing with ? A possible problem could be that the current slack-mocker doesn't react to ephemeral responses, just to delayed responses. I think the slash commands could be integrated into the normal conversation flow by making the slack-mocker recognize the command (checking for "/" + word ...). so no extra treatment outside of the mocker required.

codeforequity-at avatar Jul 06 '17 19:07 codeforequity-at

I am testing a new bot not yet released to the public.

I also tested by changing the "hears" method alone to accommodate commands starting with "/" and see the same behavior (of bot response not reaching the mock). Got the invite to collaborate. Do you want me to checkin the partial code?

ndileep avatar Jul 07 '17 00:07 ndileep

yes, please create a feature branch and open a pull request to see the changes! We will see if I can help then!

codeforequity-at avatar Jul 08 '17 06:07 codeforequity-at

Opened pull request. Thanks!

ndileep avatar Jul 12 '17 00:07 ndileep