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_experiment/<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
- 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.
- Navigate to Server Settings and then to Integrations.
- Create a new webhook.
- 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.
- 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:
Slack
- 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.
- Click on dropdown arrow next to the name of your workspace. This will create a dropdown menu. Select Tools & settings and then Manage apps.
- 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.
- 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.
- Pick the channel where you want your Antithesis results to be posted, and click Allow.
- 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.
- 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: