Slack
If you'd like to automatically notify your team on a Slack workspace whenever a change has occurred on your apps, this integration will help you out. You can choose which actions should trigger messages on your Slack workspace.
Here are the steps that we are going through:
1. Create a Slack App
Go to the Slack page to create apps and create a new app:
Create a Slack app from scratch:
Call it
Qovery
and connect it to the workspace of your choice:Feel free to use an image from here as the app's logo:
2. Create a Webhook
Go to the
Incoming Webhooks
page for your newly-created app and toggleActivate Incoming Webhooks
to turn it on:Click on
Add New Webhook to Workspace
:Select the channel that the notifications will be posted to:
Copy the webhook URL:
3. Create a Webhook in Qovery
To create a webhook in Qovery:
Install the Qovery CLI.
Generate an API Token.
Copy the following cURL command:
curl -X POST -H 'Content-type: application/json' -H 'Authorization: Token <Your API Token>' -d \'{"description": "slack notifications", "target_url": "<Your Slack Webhook URL>", "events": ["DEPLOYMENT_STARTED", "DEPLOYMENT_CANCELLED", "DEPLOYMENT_SUCCESSFUL", "DEPLOYMENT_FAILURE"], "kind": "SLACK", "enabled": true}' \"https://api.qovery.com/organization/{Your Organization ID}/webhook"Replace
<Your API Token>
with your Qovery API token.Replace
<Your Slack Webhook URL>
with your Slack Webhook URL.Replace
{Your Organization ID}
with your Qovery organization ID.Learn how to get your Organization ID
Your Organization ID is the first ID in your console.qovery.com URL. E.g. for
https://console.qovery.com/platform/organization/70c9a78d-454b-41dc-8478-d1f95bd08fd7/projects
the Organization ID is70c9a78d-454b-41dc-8478-d1f95bd08fd7
Run the complete cURL command in your terminal.
You must receive a REST response from the API if it's all good!
Filter your Event Notifications
You can also add the following properties to your cURL command:
project_names_filter
to only get notified about events happening in projects whose IDs match the specified filter.environment_types_filter
to only get notified about events happening on one or several specific types of environments.
Here is an example of command to send webhook events only for production and staging environments:
curl -X POST -H 'Content-type: application/json' -H 'Authorization: Token <Your API Token>' -d \'{"description": "slack notifications", "target_url": "<Your Slack Webhook URL>", "environment_types_filter": ["PRODUCTION", "STAGING"], "events": ["DEPLOYMENT_STARTED", "DEPLOYMENT_CANCELLED", "DEPLOYMENT_SUCCESSFUL", "DEPLOYMENT_FAILURE"], "kind": "SLACK", "enabled": true}' \"https://api.qovery.com/organization/{Your Organization ID}/webhook"
And another to send webhook events only for project with names starting by product
or equal to analytics
:
curl -X POST -H 'Content-type: application/json' -H 'Authorization: Token <Your API Token>' -d \'{"description": "slack notifications", "target_url": "<Your Slack Webhook URL>", "project_names_filter": ["product*", "analytics"], "events": ["DEPLOYMENT_STARTED", "DEPLOYMENT_CANCELLED", "DEPLOYMENT_SUCCESSFUL", "DEPLOYMENT_FAILURE"], "kind": "SLACK", "enabled": true}' \"https://api.qovery.com/organization/{Your Organization ID}/webhook"
Considerations
- You can have multiple webhooks targeting different Slack channels.
- You can specify the events that you want to receive. E.g. if you just want to be notified when a deployment failed, then use
"events": ["DEPLOYMENT_FAILURE"]
. All the events and the description are available on our API doc. - You can turn off or delete your webhooks at any time with this API call.
- The Qovery web interface will integrate the Webhook configuration. :)
Check out this page for further details on how to use the WebHook API.
4. Try it!
Launch a deployment with Qovery, and you will see a message like the one below appearing in your Slack channel 🎉
Open a thread on our forum if you have any questions.