Slack

Build a Slackbot with Voiceflow's Dialog Manager and deploy to Heroku

Get started

Use Voiceflow Dialog Manager API to run a Slack Bot

🚧

Before you start

Setup

Create your Slack App

Go to to https://api.slack.com/apps?new_app=1 to create your Slack app

Select From an app manifest

513

Select the workspace you want to publish the app to

511

Choose JSON on the next screen and replace evrything with the manifest bellow

514
{
    "display_information": {
        "name": "Voiceflow Slack Demo",
        "description": "Slack Assistant using Voiceflow Dialog Manager API",
        "background_color": "#37393d"
    },
    "features": {
        "app_home": {
            "home_tab_enabled": true,
            "messages_tab_enabled": true,
            "messages_tab_read_only_enabled": false
        },
        "bot_user": {
            "display_name": "Voiceflow Demo",
            "always_online": true
        }
    },
    "oauth_config": {
        "scopes": {
            "user": [
                "users:read"
            ],
            "bot": [
                "app_mentions:read",
                "channels:history",
                "chat:write",
                "im:history",
                "im:read",
                "im:write",
                "mpim:history",
                "mpim:read",
                "mpim:write",
                "users.profile:read",
                "users:read"
            ]
        }
    },
    "settings": {
        "event_subscriptions": {
            "user_events": [
                "message.app_home",
                "user_change"
            ],
            "bot_events": [
                "app_home_opened",
                "app_mention",
                "message.channels",
                "message.im",
                "message.mpim",
                "user_change"
            ]
        },
        "interactivity": {
            "is_enabled": true
        },
        "org_deploy_enabled": false,
        "socket_mode_enabled": true,
        "token_rotation_enabled": false
    }
}

Click Next at the bottom of the window

Review the app details and comfirm by clicking on Create

512

Install the newly created app on your workspace

979

Click on Allow to finish to install the app on your Workspace

572

Generate a signin key and tokens

On the main screen, you want to copy the secret key and keep it for later

679

Scroll down and click on Generate Token and Scopes

681

Give this Token a name and add the connections:write scope to it. Then click on Generate

513

Copy the app token and save it for later

511

Go to the OAuth & Permissions section, copy the Bot User OAuth Token from there and save it for later

969

You should now have:

a **secret key**
an **app token**
a **bot token**

Voiceflow

Get your project Dialog API key

Go to Voiceflow Creator and open the Chat Assistant project you want to use

On your project, click on Integration from the left sidebar (or press the 3 key)

351

Click Copy to copy your Voiceflow Dialog API Key and save it for later

1066

Heroku

Deploy this code to Heroku

Heroku logo

Setup the Heroku app

Choose a name for your app
Set the config var with all the info you've previously saved

SLACK_APP_TOKEN
Slack app secret (starting with xapp-)

SLACK_BOT_TOKEN
Slack bot token (starting with xoxb-)

SLACK_SIGNING_SECRET
Slack app signing secret

VOICEFLOW_API_KEY
Voiceflow project API key (from the Integration section)

Click on Deploy app

727

Wait for your app to be fully deployed

651

Last important thing we want to do is to swap ressources on your Heroky app.
Here we want to turn off the web and turn on the worker as the Slack bot is setup in socket mode

776 767

After the changes, your config should look like this:

768

Slack

Install your Slack App

On your Slack workspace, click on Apps > Add apps

855

Search for 'Voiceflow Slack Demo' or the app name you've created earlier on Slack API website and click on it in the Search results list to install it

848

The app is now available and you can click on Messages to start interacting with your bot.

849 775