Use the slack command as a shortcut to multiple commands

My company has recently switched to Slack, and I still like it. I will learn about Slack Custom commands, and I would like to try writing some.

One of my first ideas was to create a shortcut for leaving - either for lunch or for a short break. When I go to dinner, I set my status to “Away” using the command /awayand delayed notifications using /dnd 1 hour. It would be nice if I could create a custom Slack command, called /lunchthat does both of these things, and another /backthat switches back to Internet mode rather than Snoozed.

All documentation for user commands is focused on interacting with an external API, but is there a way to write a user command that runs actions inside Slack itself? Will it require the use of the Slack API?

+4
source share
1 answer

Yes, you will have to use the Slack API. But this is great because it is really fun to use :)

You can programmatically set your awaypreference using this method: https://api.slack.com/methods/users.setPresence

And you can set the duration do not disturbwith this: https://api.slack.com/methods/dnd.setSnooze

User Integration Getting Started Guide here.

, :)

+2

All Articles