Platforms: Slack

Slack bots allow people and teams who use Slack to make their experience on Slack more useful, customized, and even fun (no guarantees on the fun). Follow the step-by-step instructions found on the Platform configuration page to get started with deploying and launching your Slack bot, and take a look below for some detailed descriptions on concepts.

Your Dexter Bots Only Respond If They Are @-Mentioned

We also think it's pretty annoying when bots interrupt your team's message flow unprompted. If you want to respond with something silly to any keyword in Slack, consider a Slackbot response instead.

Event Types

Event Types describe things that happen on Slack (e.g., a message was sent in a channel), and you must explicitly configure your app to be able to respond to certain events. We recommend enabling all of the message events.

Event Types

Enable the message.im event if you want your users to be able to direct message your bot. You don't have to @-mention your bot in a DM.
Make sure you are adding Bot Events, NOT Team Events!

User Names

The userFirstName, userLastName, and userFullName data fields are automatically populated for use in Slack bot responses.

+ hello
- Hi <get userFirstName>! Thanks for messaging me.

Mentioning Other Users In Slack

To have your bot @-mention other people inside of Slack, you can use special syntax:

+ meeting time
- <!here> it's time for our weekly meeting!
 
+ [*] welcome [*]
- let's all welcome our new teammate <@danny>!

Slash Commands

It's incredibly easy to give your Dexter Slack bot the ability to support slash commands. Slash commands are special triggers that starts with your slack command name and is followed by any additional input you may need for your slash command. (They can be placed in any topic.) For example, if you had a /randomnumber slash command, your slack command trigger might look like:

+ randomnumber
- 42. It's always 42.

Or if you wanted to call an API based on user input, you might write something like the below to support a /weather 10014 slash command (this example uses the star and HTTP GET syntax):

+ weather *
$ GET https://myweatherapi.com/zipcode/<star>
- The current weather in ${{data.temperature}} degrees.

Once you've written your slash command trigger, find your app inside Slack (https://api.slack.com/apps) and click on "Slash Commands" in the left menu:

  1. Click Create New Command
  2. Give it a command name that matches exactly your command name inside Dexter
  3. Copy the Event Subscription Request URL from your Dexter bot into the Request URL field in the Slack app
  4. Fill out the rest of the information as you see fit

Slash commands

Once you hit Save inside of Slack and publish the topic where the slash command resides, you should be able to use your slash command!

Troubleshooting

How come my Slack bot doesn't unfurl my media messages?

Slack controls whether or not to expand a link, so sometimes if that link has been displayed recently, or is on a blacklist for your team, it won't expand. Learn more about unfurling on Slack here.

How do I talk to my Slack bot after deploying?

There's a few ways to talk to your bot:

Not Responsive

If your bot is on your team but isn't responding to your script, check the following: