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

Allow hubot to send slash commands #202

Closed
tigris opened this issue Jun 16, 2015 · 4 comments
Closed

Allow hubot to send slash commands #202

tigris opened this issue Jun 16, 2015 · 4 comments

Comments

@tigris
Copy link

tigris commented Jun 16, 2015

The use case I am trying to implement is actually to just get hubot to /leave. Since 99% of users on our slack team can't /kick rebot, it'd be nice to be able to ask hubot to leave instead of asking an admin to come into the channel and kick it for us.

However, it seems hubot can only send raw text messages. I can't get it to send commands to slack. Not sure if I'm doing something wrong or what. I guess a mechanism to send any arbitray /slash commands to slack would be pretty useful.

Unless there are some security/abuse issues there. E.g. usage of the /kick command on slack teams where anyone can kick, or usage of commands like /msg to message other users via hubot without the receiver knowing who it was really from. Similar for /invite and not even sure what /feedback could be abused for but i'm sure it could.

@ORBAT
Copy link

ORBAT commented Jul 2, 2015

@tigris, until there's something official, I've made a Hubot wrapper for the Slack web API that'd allow you to leave a channel with robot.slack.channels.leave({channel: "#somechan"}).

Edit (5 Jul): Nevermind, I'm an idiot, channels.leave can't be called by bots. That's a bit silly.

@technicalpickles
Copy link
Contributor

Under the hood, most of the slash commands you've cited are just API methods that you'd be able to call. The main restriction is that bot users can't call everything, as @ORBAT pointed out. channel.leave isn't one of those though. https://api.slack.com/bot-users is the list of function.

So, I think we can close this as a feature request to be able to run slash commands, and instead open something to make it possible for hubot to leave a room. Does that sound reasonable?

@calvertdw
Copy link

calvertdw commented Sep 25, 2018

Still looking for a solution to bot users being able to trigger slash commands. In my case, I want to trigger prompts to slash commands with cron, but maintain only one CLI.

Edit: I found an answer here: https://stackoverflow.com/questions/39829741/execute-slash-command-as-slack-bot

@DEGoodmanWilson
Copy link

Unfortunately, the chat.command endpoint requires a scope that is no longer available to third party developers, so the only way to call it is by logging in as a user, with username and password…and then we veer into highly undocumented and super insecure territory 😢 (👋 ex-Slack platform engineer and developer relations here 😉)

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

No branches or pull requests

5 participants