Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slash callback configuration in frontend #5732

Closed
soundstorm opened this issue Jan 23, 2017 · 4 comments
Closed

Slash callback configuration in frontend #5732

soundstorm opened this issue Jan 23, 2017 · 4 comments

Comments

@soundstorm
Copy link
Contributor

Currently there is only support for slash commands in distributed in packages (and only loaded after restarting the server, correct me, if I'm wrong).
Slack features - nearly from the beginning on - a simple way to configure a slash command via the frontend, without needing packages and restarts. What they do? Simply take a command /cmd params[] and create a POST or GET to a given server address.
A token is transferred too, to verify the payload. Params (POST/GET) are as follow (copy from the slack site):

token=VOu9CYSVcJVT3kvck0hlf2JR
team_id=T0001
team_domain=example
channel_id=C2147483705
channel_name=test
user_id=U2147483697
user_name=Steve
command=/weather
text=94070
response_url=https://hooks.slack.com/commands/1234/5678

The body replied from the requested URL is then shown in the same context (channel where the message was sent from, so current window), but only visible to the person, who posted the message (only temporary cached message, if restarting the app or closing the window the message from the bot is gone).
But as we don't want to simply copy something, let's do it a bit better:
Add an (optional) incoming web hook url in payload (e.g. a /notify @user 12:00 command that simply sends a message (via incoming wh) to the user at 12 o'clock; I use it for internal orders, so /order add @other_user item adds the item to a list, confirms that the order has been placed to the user and sends a notification to other_user, currently this was a hardcoded incoming wh url for slack).

It's something like hubot, but simply reduced to a slash command and adds some backwards compatibility to Slack.

@engelgabriel
Copy link
Member

engelgabriel commented Jan 24, 2017

@soundstorm our integrations have similar capabilities, with the option for you to add a JavaScript class that will be executed before hand. This way you can do pretty much anything you want.

Take a look at https://rocket.chat/docs/administrator-guides/integrations/#outgoing-webhook-scripting

@graywolf336 can we take a look and map the Slack slash commands to add to our compatibility effort?

@soundstorm
Copy link
Contributor Author

@engelgabriel just created a bot reacting to direct messages. A regular outgoing web hook AFAIK can only listen on public, private OR direct messages. A slash command works (or should work) everywhere. While you can assign any keyword to listen for, anything starting with a slash is impossible. BTW: the custom hubot documentation is empty :/

@graywolf336
Copy link
Contributor

@soundstorm I know this is old, but for anyone else wondering a regular outgoing webhook can listen on every channel type - public, private, and direct messages. :)

@timkinnane
Copy link
Contributor

Closing this as it's handled (depending on particular needs) by either #6583, #1086, or #6890.

@theorenck theorenck removed this from the Short-term milestone Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants