Zenbot provides a Slack integration, so that your Slack bot can easily start to talk with users on natural language.

How to create a Slack bot

There is a complete guide on how to create a Slack bot. You just need a couple of clicks to obtain your Slack bot's Token.

Simply copy this token and paste it into “Slack settings” in your Zenbot's bot settings.

  Note that you do not have to install any webhooks for your Slack bot.

Slash commands

Zenbot enables your bot to react on any Slash commands as well as regular messages.

  Slash commands allows the user to request your bot in any channel.

To make it work just use a URL like https://zenbot.org/api/slack/<your bot id> as a URL for your slash command inside an “Integration Settings” section on the “Slash Commands” configuration page.

In your Botscript define an input pattern which looks like /<you slash command>. For example, if you would like your bot to respond on a slash command like /doit something, you have to define an input pattern /doit $Text.

Distribute your Slack bot

If you would like to share your Slack bot, you have to create a Slack Application with bundled bot to distribute it to another teams. This guide completely describes this process.

All you have to do - is to create a Slack Application in your Slack team account, provide Redirect URI and obtain Client ID and Client Secret.

Redirect URI

The application creation process requires you to define a Redirect URI for OAuth authorization.

Just paste here the URI which looks like https://zenbot.org/api/slack/<your bot id>.

You can find this URL on your bot's settings page in Zenbot web console.

Client ID and Secret

Once you have created your Slack application, you have to open “App Credentials” and copy your app's “Client ID” and “Client Secret” and paste them into appropriate fields in your bot's setting page in in Zenbot's web console.

  Note that Zenbot cannot connect your bot with your Slack app before this step.

Success and Error redirect URLs

As you can see there are two more optional fields inside the “Slack settings” section. There are “OAuth Success Redirect URL” and “OAuth Error Redirect URL”.

Once user has successfully installed your Slack app, Zenbot redirects her to the “OAuth Success Redirect URL”. Otherwise Zenbot redirects her to the “OAuth Error Redirect URL”.

You can define your own URLs for this, otherwise Zenbot will use default URLs.

  Thus in the case of successful installation Zenbot will redirect user to the Slack web client page. Otherwise Zenbot will show a page with error message.

OAuth Scopes

Once you decided to share your Slack bot with others, you have to pay attention to OAuth Scopes in Slack.

If your bot is not actually a “bot” in terms of Slack (but a Slack app instead), then you have to check that your Slack Button contains users:read access scope. Because Zenbot has to obtain some user's data for each request (like time offset, real name and email address).

Message Formatting

Note that you can also use Slack's Message Formatting for complex responses. As well as Attachments and plain text (of course).

Zenbot will automatically understand your bot's response format and generate an appropriate request to the Slack's API. You have not to worry about this anymore.

Interactive messages

Interactive messages enables your bot to generate and process buttons in each response.

To enable this feature you have to enable “Interactive Messages” in the settings of your Slack application. It will ask you about “Request URL”. Please use the URL like https://zenbot.org/api/slack/<your bot ID>.

Than you can use sample tag to generate buttons from your Botscript.

Slack Interactive messages

  Note that you have to create a Slack Application and provide it's Client ID and Client Secret in the bot's preferences to use buttons.

Native output

If you wish to generate a complex output (instead of simple text and buttons) you can use a Slack API related JSON formatted message in the output tag.

  "text": "Relative time in *$CityName ($CityCountry)*",
  "attachments" : [
          "fallback": "Your client doesn't support attachments",
          "color": "#ffbb00",
          "fields" : [
              {"title" : "$CityName", "value" : "$Time", "short" : true},
              {"title" : "Here", "value" : "$TimeHere", "short" : true}
          "fallback": "Your client doesn't support attachments",
          "color": "#00a2ff",
          "fields" : [
              {"title" : "Here", "value" : "$Time", "short" : true},
              {"title" : "$CityName", "value" : "$TimeThere", "short" : true}

In this case Zenbot will generate a native output that will be rendered in Slack client as is:

Test your Slack bot

Now you can select your bot in Slack's contacts list and send a direct text message. Your Zenbot's bot will respond with some text regarding the Botscript.

  Note that you can use only direct messages to communicate with your bot.


Each time Zenbot receives a request from Slack, it generates a set of special variables you can use inside a Botscript.

  • req_slack_token - the token of your Slack bot
  • req_slack_channel - ID of the channel from where the request was sent
  • req_slack_team - ID of the team from where the request was sent
  • req_slack_user - ID of the user who has sent the request
  • req_slack_username - user's name
  • req_slack_username_real - user's real name
  • req_slack_usermail - user's email address

Find more available variables in Global Variables chapter.