Discord and Slack integrations

When you run tests, Antithesis will generate triage reports and email them to you. In addition, you may configure the test to post back results to a platform of your choice. This document covers how to configure this integration with Discord and Slack.

This is an example of an Antithesis webhook that kicks off a test and posts the results back to Discord (and also Github):

curl --fail -u 'user:password' \
    -X POST https://<tenant>.antithesis.com/api/v1/launch/<endpoint> \
    -d '{"params": { "antithesis.description":"Nightly testing on main", 
        "antithesis.integrations.discord.callback_url": "https://discord.com/api/webhooks/1234567890123456789/",
        "antithesis.integrations.discord.token": "<secret>",
        "antithesis.integrations.github.callback_url": "<url>",
        "antithesis.integrations.gitub.token": "<secret>",
        "antithesis.images":"my_images_with_version_list" } }'

See the webhooks documentation for the syntax of webhook calls in general. The remainder of this document describes how to generate the following webhook parameters for Antithesis:

antithesis.integrations.<integration type>.callback_url
antithesis.integrations.<integration type>.token

where <integration type> is discord or slack.

Importantly, you will need to go to your messaging app to generate these parameters, but then paste the generated parameters into your Antithesis webhook call.

Discord

  1. Begin in the server where you want your Antithesis results to be posted. Follow the directions in the Discord webhook docs, to create a new webhook. The steps below are correct as of September 2024.
  2. Navigate to Server Settings and then to Integrations.
  3. Create a new webhook.
  4. Copy the webhook URL.

The URL will look something like:

https://discord.com/api/webhooks/000000000000000000/1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

Everything up to and including the final forward slash is the callback url. Everything after the final forward slash is the token. You should treat the token as a secret.

  1. Paste the callback url and token into your webhook call as follows:
antithesis.integrations.discord.callback_url: https://discord.com/api/webhooks/000000000000000000/
antithesis.integrations.discord.token: 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

When this integration is enabled, you will see results like the following:

Discord Integration Example

Slack

  1. First, create a Slack app associated with the workspace where you want to post the results. The most current directions for doing this can be found at the Slack webhook docs documentation. The steps below are correct as of September 2024.
  2. Click on dropdown arrow next to the name of your workspace. This will create a dropdown menu. Select Tools & settings and then Manage apps.
  3. On the new screen, select Build. The Create New App button will pop up a menu. Select From scratch. Follow the prompts to create a new app.
  4. On the new screen, select Incoming Webhooks in the Features section. Ensure that incoming webhooks are enabled and click the button labeled Add New Webhook to Workspace.
  5. Pick the channel where you want your Antithesis results to be posted, and click Allow.
  6. You should now see a section Webhook URLs for Your Workspace. Copy the webhook URL, which will look something like:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

Everything up to and including the final forward slash is the callback url. Everything after the final forward slash is the token. You should treat the token as a secret.

  1. Following the example at the top of this page, paste the callback url and token into your webhook call:
antithesis.integrations.slack.callback_url: https://hooks.slack.com/services/T00000000/B00000000/
antithesis.integrations.slack.token: XXXXXXXXXXXXXXXXXXXXXXXX

When this integration is enabled, you will see results like the following:

Slack Integration Example