Connect any Voiceflow agent to a Slack App via the dialog API
- Connect to any Voiceflow Agent
- Supports messages, buttons, and images (when sent individually)
- Passes the user's full Slack name to Voiceflow
- Create an app
- Select
From a manifest - Select the workspace you want to use your app in
- Replace the JSON with:
{
"display_information": {
"name": "Voiceflow Slack Demo",
"description": "Slack Bot using Voiceflow's 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
NextthenCreate - Navigate to the
Install Apptab on the left - Click
Install - Click
Allow
- Navigate to the
Basic Informationtab on the left - Copy the
Signing Secretand save it somewhere for later
- Scroll down and click
Generate Token and Scopes - Name the token
Voiceflow Token - Click
Add Scopeand selectconnections:write - Click Generate
- Copy the app token and save it somewhere for later
- Navigate to the
OAuth & Permissions tabon the left - Copy the
Bot User OAuth Tokenand save it somewhere for later
- Open a Voiceflow Agent
- Make sure it works and that you've Published it (Green publish button in the top right)
Tip
Slack's formatting works different for apps then users, consider adding this to your agent's prompt
Note
Ensure that your Agent has an end function. (Logic > End). Anytime you edit your agent you will need to publish it, and start a new chat for the changes to take effect.
- Open
Settingsby pressing7or clicking the cogwheel on the left
- Navigate to the
API Keystab on the left - Copy your
Primary keyand save it somewhere for later
- Navigate to the
Generaltab on the left - Copy the
Project Keyand save it somewhere for later - Copy the
Version IDand save it somewhere for later
- Click
Run on Replitbelow
- Click
Import from GitHub - A
Configure Replwindow should have opened, scroll down and clickConfirm and Close - Press the Search button on the top right of the screen
- Search for
Secretsand click the first option - Click
Edit as JSONin the bottom left of the secrets tab and replace the content in it with:
{
"VOICEFLOW_API_KEY":"VF.12345678",
"VOICEFLOW_VERSION_ID":"12345678",
"VOICEFLOW_PROJECT_ID":"12345678",
"VOICEFLOW_RUNTIME_ENDPOINT":"general-runtime.voiceflow.com",
"SLACK_APP_TOKEN":"xapp-XXXXX",
"SLACK_BOT_TOKEN":"xoxb-",
"SLACK_SIGNING_SECRET":"XXXXXXX"
}Important
Switch out all of the placeholders with the keys and tokens you saved for later earlier
- Press
Save - Click
Deployin the top right - Make sure
Reserved VMis selected - Click
Set up your deployment - Under App Type select
Background Worker - Press the
Deploybutton at the bottom
- In Slack search for 'Voiceflow Slack Demo' or the app name you created earlier.
- Navigate to the Messages tab from the app's page
Important
Your app will respond to every message in channels it's added to
- Open the Slack channel you want to add it to
- @ the bot in a message and attempt to send it
- Slack will prompt you
Want to add this person instead?, pressAdd to Channel
- Send
hito not pass a message to Voiceflow, and have it generate a response. - @ the bot in a message to check if the server is online, regardless of being hooked up to Voiceflow
Images are only supported when sent via the image block in voiceflow, not from an agent message.
This usually happens when your Replit secrets are entered wrong, or a message broke the voiceflow loging (i.e. a message over 4,000 characters was sent). Once you're sure your secrets are entered correctly:
- Create a new channel
- Add your app to the channel
- Sending a message should break the
Error. Please try again a bit laterloop.
If you forgot to add an end chat flow, unfortunately the easiest workaround is to:
- Duplicate your agent in Voiceflow
- Change the secrets in Replit to match the new agent
- Redeploy Replit
- Create a new channel
- Add your app to the channel
- Send a message there to fix the logging error.
If the slack app is using an older published version of your voiceflow agent, first try ending the chat and creating a new one. If that doesn't fix the issue, try removing the VOICEFLOW_VERSION_ID secret from Replit.
