How do DeployBot and Slack work together?
It is possible to use Slack in tandem with your DeployBot account. If you would like to have DeployBot deployment notifications in Slack, or to trigger a deployment from Slack itself, read on.
For any repository in your DeployBot account, navigate to the Settings > Integrations page from the menu at the top of the page. Click Connect next to the Slack icon.
You will then need to grant DeployBot limited access to your Slack account. Click the Authorize button to grant this access.
For each environment that you want to be notified of in Slack, go to Environment Settings, and under the Triggers section, check the “Notify Slack” box. Then choose the channel name where the notifications should be directed. That’s it, now you’ll never miss a deployment again!
Triggering deployments from Slack
It is possible to use Slack’s slash commands for various functions and integrations. DeployBot is no different. You can think of slash commands as regular messages that start with a slash (/) character.
When sent, if the Slack server recognizes the command, it executes it according to default rules. Some connected 3rd party apps may add new slash commands to your Slack, and your own team can define custom slash commands too. And now, a little known fact: DeployBot’s deploy webhooks support Slack’s formatting and can be used as target URLs for slash commands.
Start with picking a name for your future slash command. You can use a descriptive token like /deploybot-production, or go wild with /letsroll, /dragonsahead, or whatever you like. Just remember to let your teammates know what this is about. Once you’re satisfied with the command name, browse to your Apps & Integrations page in Slack and click “Add Slash Command Integration”. This can be a little hard to find, so here is the full path:
- Start here: https://youraccountname.slack.com/home
- Click Configure Apps in the sidebar
- Click Build in the menu at the top right of the page
- Click on the Make a Custom Integration box
- Choose Slash commands from the list
- Use the name you’ve chosen
To configure the command you’ll need a webhook URL for triggering deployments. In DeployBot, go to “Webhooks & Badges” section of your repository settings, and copy the one associated with your environment of choice.
Now let’s go over the configuration fields of a slash command integration in Slack:
- Command. The name you picked when you created the integration. Feel free to modify it if you changed your mind.
- URL. The deploy webhook URL you copied from DeployBot, paste it here.
- Method. HTTP request method, should be POST.
- Token. It has a pre-set value by default — leave it be or delete it. DeployBot’s webhook URL already includes a secret token called secret.
- Customize Name. We suggest that you set it to "DeployBot", but you can do what you like.
- Customize Icon. If you picked “DeployBot” on the previous step, you might as well use our avatar here.
- Show this command in the autocomplete list. Check this, unless you want this slash command to stay a secret.
- Autocomplete help text. Especially useful if you went with a “creative” name for your slash command. It’s a good place to explain what the command actually does, i.e. “Deploy Project Alpha to production”.
- Descriptive Label. A label to distinguish this command amongst your other integrations in Slack. For example, “DeployBot production”. ￼ Once you’ve completed the configuration, click “Save Integration”. You should be able to see this command in autocomplete dropdown in Slack (unless you chose the option to exclude it from there). From now on, every time your environment is behind, using this slash command will trigger a deployment of the latest available commit in the branch associated with the environment.
That’s it. Happy deploying!
If a deployment is triggered from Slack, who shows as the deploying user?
The committing user is shown as the one deploying in your DeployBot account. Because a deployment can be triggered by anyone who has access to Slack, even if they do not exist in your DeployBot account, we use the commit information to show the deploying user.
Why do I not see my channel in DeployBot?
There are some scenarios where DeployBot will not see a new channel in your Slack account.
- If your account was renamed, simply click the Connect button once again from the Settings > Integrations page in your DeployBot account.
- If the connection from Slack has been interrupted and new channels are not showing, you can rename your Slack channel, then change it back to the original name. This will force a re-sync.
We’re missing notifications in Slack. What do I do?
In some situations with multi-server environments, a deployment may fail or be skipped. There are times when this results in no notification being sent to Slack. You can add the following command in DeployBot to put a delay on one server in an multi-server environment:
This will increase the chances that the delayed server will complete successfully, even others do not.