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 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!

Interactive Messages

Slack attachments can include buttons and other interactive menus that lead to more dynamic actions when interacted with. This is needed for usage with buttons in the ^template() and the ^buttonsSlack() shortcodes.

Slack Attachment with Interactive Buttons

In order to make sure that these buttons respond to clicked actions, you must follow these steps to prepare your Slack app:

  1. Venture to the Apps page for Slack and find the App associated with your bot.
  2. In the Interactive Messages section to the left, include the Webhook URL from your bot page to your left in the text frield for Request URL.
  3. Tap Save Changes.

Slack Interactive Messages

User Names

The _userFirstName, _userLastName, and _userFullName namespace variables 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. In your Dexter bot, create a new topic named slack-commands (it must be named exactly this, NOT "slash-commands"). Inside this topic, simply create triggers that match your slash command's name. For example, if you had a /randomnumber slash command, your slack-commands topic 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<star>
- The current weather in ${{data.temperature}} degrees.

Once you've written your slash command trigger, find your app inside Slack ( 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 slack-commands topic, you should be able to use your slash command!


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: