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
  2. Create a Webhook
  3. Setup a Webhook in Qovery
  4. Try it!

1. Create a Slack App

  1. Go to the Slack page to create apps and create a new app:

    Create a slack app - step 1

  2. Create a Slack app from scratch:

    Create a slack app - step 2

  3. Call it Qovery and connect it to the workspace of your choice:

    Create a slack app - step 3

  4. Feel free to use an image from here as the app's logo:

    Create a slack app - step 4

2. Create a Webhook

  1. Go to the Incoming Webhooks page for your newly-created app and toggle Activate Incoming Webhooks to turn it on:

    Create a webhook integration on Slack - step 1

  2. Click on Add New Webhook to Workspace:

    Create a webhook integration on Slack - step 2

  3. Select the channel that the notifications will be posted to:

    Create a webhook integration on Slack - step 3

  4. Copy the webhook URL:

    Create a webhook integration on Slack - step 4

3. Create a Webhook in Qovery

To create a webhook in Qovery:

  1. Install the Qovery CLI.

  2. Generate an API Token.

  3. 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"
  4. Replace <Your API Token> with your Qovery API token.

  5. Replace <Your Slack Webhook URL> with your Slack Webhook URL.

  6. 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 is 70c9a78d-454b-41dc-8478-d1f95bd08fd7

  7. 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.