Skip to main content

Send Discord Messages with TestingBot Webhooks

With the Discord webhook template, an embed is posted to your Discord channel whenever a test completes, or only when a test fails. The embed title links straight to the test details page, with inline fields for the browser, platform and duration.

Prerequisites

You need a webhook URL for the Discord channel that should receive the messages:

  1. In Discord, open the channel settings (the gear icon next to the channel name).
  2. Go to Integrations > Webhooks.
  3. Click New Webhook, give it a name and pick the channel.
  4. Click Copy Webhook URL.

You need the Manage Webhooks permission on the server to create channel webhooks.

Set up the webhook in TestingBot

  1. Log in to the member area and go to the Webhooks page.
  2. Click Create webhook.
  3. Under Start from a template, pick the Discord tile. This prefills the HTTP method and the embed payload.
  4. Paste your https://discord.com/api/webhooks/... URL in the URL field.
  5. Adjust the triggers: failures only or all tests, the test type and an optional name filter.
  6. Click Create webhook at the bottom of the form to save the configuration.

Template payload

The Discord template sends this embed payload:

{
  "embeds": [
    {
      "title": "Test {{TEST_STATUS}}: {{TEST_NAME}}",
      "url": "{{TEST_URL}}",
      "description": "The test finished with status {{TEST_STATUS}}.",
      "fields": [
        { "name": "Browser", "value": "{{BROWSER_NAME}} {{BROWSER_VERSION}}", "inline": true },
        { "name": "Platform", "value": "{{PLATFORM}}", "inline": true },
        { "name": "Duration", "value": "{{TEST_DURATION}} seconds", "inline": true }
      ]
    }
  ]
}

There are no placeholders to replace: the channel is determined by the webhook URL. You can customize the embed, for example add a color field; the {{...}} tokens are listed on the built-in variables page.

Test it

Click Test Webhook in the form to send a sample embed right away. On success, the embed appears in your Discord channel and the Response panel shows a 204 No Content status with an empty body, which is how Discord acknowledges a delivery.

Common failure causes:

  • The webhook was deleted in the channel settings, which returns a 404 Unknown Webhook error.
  • The URL is incomplete, for example the token part after the webhook id is missing.
  • The payload was edited into invalid JSON or an invalid embed; Discord returns a 400 with validation details in the response body.

Related: Webhooks Quick Start, all webhook templates and the Core Concepts page.

Was this page helpful?
Last updated