> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BrowserStack Webhook Setup Guide

> Configure BrowserStack to deliver events to StackOne.

## Prerequisites

The connector should already be set up, with a Connector Profile and a Linked Account. See [Getting Started](https://docs.stackone.com/connectors/browserstack.md#getting-started) on the BrowserStack connector page.

## Get the Native Webhook URL

The **Native Webhook URL** is shown in StackOne Hub when you link the account. Both Percy and BrowserStack platform webhooks send events to this URL.

<ul>
  <li>Open the account linking form in StackOne Hub.</li>
  <li>Copy the value from **Native Webhook URL**.</li>
</ul>

## Percy project webhooks

Percy webhooks are set per project and send a fixed payload, so no body needs to be written. Repeat these steps for each Percy project you want events from.

**1. Add the webhook**

Sign in to [Percy](https://percy.io) and open the project.

<ul>
  <li>Click **Integrations**.</li>
  <li>Under **Web Hooks**, click **Add Webhook**.</li>
  <li>**URL**: the **Native Webhook URL** from StackOne</li>
</ul>

![Percy Edit webhook form with the URL field highlighted](https://mintcdn.com/stackone-60/shEZUsyIRboZBeFm/connectors/browserstack/images/events-percy-webhook-url.png?fit=max\&auto=format\&n=shEZUsyIRboZBeFm\&q=85\&s=840968c87f7cd5fc2d9743112e6f2c4c)

**2. Subscribe to events**

Under **Subscribed events (choose at least one)**, select the events to send to StackOne.

<ul>
  <li>Select **ping**.</li>
  <li>Select **build\_created**.</li>
  <li>Select **build\_approved**.</li>
  <li>Select **build\_finished**.</li>
  <li>Select **build\_changes\_requested**.</li>
  <li>Select **build\_unreviewed**.</li>
  <li>Click **Create webhook**.</li>
  <li>Percy sends a **ping** event when the webhook is created or updated.</li>
</ul>

![Percy Subscribed events list with the six supported events and the Create webhook button highlighted](https://mintcdn.com/stackone-60/shEZUsyIRboZBeFm/connectors/browserstack/images/events-percy-subscribed-events.png?fit=max\&auto=format\&n=shEZUsyIRboZBeFm\&q=85\&s=3b8888a16eb235951497e4bc8cfdc361)

## BrowserStack platform webhooks

Test Management and Test Reporting & Analytics webhooks send a body you write yourself, so each webhook covers one event and its body tells StackOne which event it is. Create one webhook for each event you want.

**1. Choose the event**

Sign in to [BrowserStack Test Management](https://test-management.browserstack.com) and open **Settings**.

<ul>
  <li>Under **TM Global Settings**, click **Webhooks**.</li>
  <li>Click **Create webhook**.</li>
  <li>**Webhook Name**: a name that identifies the event, for example `StackOne test case created`</li>
  <li>**Projects**: the projects to send events for</li>
  <li>**Event Type**: the event, for example **Test Case**</li>
  <li>**Trigger condition**: the action, for example **Create**</li>
  <li>**Test Reporting & Analytics:** Sign in to [Test Reporting & Analytics](https://automation.browserstack.com), open **Settings** > **Webhooks** and click **Create webhook**. Its **Event Type** options are **Build Finish**, **Test Failure**, **Quality Gate Result** and **Alert Trigger**.</li>
</ul>

![BrowserStack Create Webhook form with the Webhook Name, Event Type and Trigger condition highlighted](https://mintcdn.com/stackone-60/shEZUsyIRboZBeFm/connectors/browserstack/images/events-browserstack-create-webhook.png?fit=max\&auto=format\&n=shEZUsyIRboZBeFm\&q=85\&s=98b3a0448f45a311b839dfc0694a4b6d)

**2. Set the payload URL**

Scroll to **Payload** in the same form.

<ul>
  <li>Click **Custom**.</li>
  <li>**Method**: **POST**</li>
  <li>**URL**: the **Native Webhook URL** from StackOne</li>
</ul>

![BrowserStack payload settings with Custom and the URL field highlighted](https://mintcdn.com/stackone-60/shEZUsyIRboZBeFm/connectors/browserstack/images/events-browserstack-custom-payload.png?fit=max\&auto=format\&n=shEZUsyIRboZBeFm\&q=85\&s=ce3364fe9444d4296152cbbe52a07cee)

**3. Add the body**

In the **Body** tab, write a JSON body. Two fields are required, and you can add any other fields you want after them.

```
{
  "event_type": "test_case_created",
  "record_id": "{{TC_ID}}",
  "details": {
    "title": "{{TC_TITLE}}"
  }
}
```

<ul>
  <li>`event_type` (required): the event key for this webhook, such as `build_finish`, `test_failure`, `quality_gate_result`, `alert_triggered`, `test_case_created`, `test_case_updated`, `test_case_deleted`, `test_case_archived`, `test_plan_created`, `test_plan_updated`, `test_plan_completed`, `test_plan_deleted` or `test_result_added`</li>
  <li>`record_id` (required): `{{BUILD_ID}}` for Test Reporting & Analytics events, `{{TC_ID}}` for test cases, `{{TP_ID}}` for test plans and `{{TEST_NAME}}` for test results</li>
  <li>`occurred_at` (optional): a timestamp variable when the event has one, such as `{{BUILD_FINISHED_AT}}`</li>
  <li>Any other fields (optional): add BrowserStack variables from **Variables**, for example under `details`</li>
  <li>Click **Create**.</li>
</ul>

![BrowserStack payload body editor with an example body containing event\_type and record\_id](https://mintcdn.com/stackone-60/shEZUsyIRboZBeFm/connectors/browserstack/images/events-browserstack-body.png?fit=max\&auto=format\&n=shEZUsyIRboZBeFm\&q=85\&s=df35971d2f6d7640bdec0370f112814a)

## Verify

Your Connector should now be able to receive and process events. Try triggering an event and you should see an Event appear in the Connector logs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.