Built-in variables
This guide explains and is the reference for variables available in webhook payloads from BrowserStack Test Reporting & Analytics events.
Page contents:
Before you begin
To create a webhook and subscribe it to events, follow Get started with webhooks. For platform-wide concepts such as event types, payload templates, and auto-retrigger, see Core concepts.
How variables work
Variables let webhook payloads carry dynamic data from each event. When a build completes, for example, a webhook can send the build name, status, and duration to a downstream tool, which uses those values to create a Jira ticket or post a Slack message.
You can also use response-body variables to access data returned from a previous webhook call. Response-body variables enable webhook sequencing and the auto-retrigger feature. For details, see Retrigger webhooks when failing tests or builds start passing again.
Reference syntax
Wrap each variable in handlebars when you reference it in a URL, header, or payload body. For example: ``.
Available variables
Use these variables as test run variables in Test Management.
The following variables populate by default in webhook payloads. Custom variables you define for a webhook also become available in the same syntax.
| Variables | Sample Value |
|---|---|
| {{BUILD_NAME}} | “wdio-cucumber-samples” |
| {{BUILD_ORIGINAL_NAME}} | “e2e regression” |
| {{BUILD_STATUS}} | “failed” |
| {{BUILD_DURATION}} | 254005 |
| {{BUILD_USER}} | “AKIIII” |
| {{BUILD_TAGS}} | “perf,wdio” |
| {{BUILD_ID}} | “81yobvicuiuozd1bncaeegvubey7rbl8naevwets” |
| {{BUILD_NUMBER}} | 235 |
| {{BUILD_STARTED_AT}} | “2024-05-08T12:45:34.651+00:00” |
| {{BUILD_FINISHED_AT}} | “2024-05-08T12:49:48.656+00:00” |
| {{BUILD_TOTAL_PASSED}} | 30 |
| {{BUILD_TOTAL_FAILED}} | 24 |
| {{BUILD_TOTAL_PENDING}} | 0 |
| {{BUILD_TOTAL_SKIPPED}} | 8 |
| {{BUILD_TOTAL_UNKNOWN}} | 0 |
| {{BUILD_TOTAL_TO_BE_INVESTIGATED}} | 24 |
| {{BUILD_TOTAL_AUTOMATION_BUG}} | 0 |
| {{BUILD_TOTAL_PRODUCT_BUG}} | 0 |
| {{BUILD_TOTAL_NO_DEFECT}} | 0 |
| {{BUILD_TOTAL_ENVIRONMENT_ISSUE}} | 0 |
| {{BUILD_TOTAL_FLAKY_TESTS}} | 6 |
| {{BUILD_TOTAL_ALWAYS_FAILING}} | 5 |
| {{BUILD_TOTAL_PERFORMANCE_ANOMALY}} | 0 |
| {{BUILD_TOTAL_NEW_FAILURES}} | 1 |
| {{BUILD_ALERTS}} | “Alert 1: Build duration above 10 secs:CRITICAL, Alert 2:..” |
| {{UNIQUE_ERRORS_COUNT}} | 4 |
| {{UNIQUE_ERRORS_INSIGHT}} | “96% failures caused by 3 unique errors” |
| {{GIT_SHA}} | “695155b136e6a6d6db50a4318ff4a39da843f418” |
| {{GIT_REPO_URL}} | “https://github.com/browserstack/test-observability-samplesConnect your Github account” |
| {{GIT_BRANCH}} | “master” |
| {{GIT_COMMIT_URL}} | “https://github.com/browserstack/test-observability-samples/commit/695155b136e6a6d6db50a4318ff4a39da843f418Connect your Github account” |
| {{CI_JOB_NAME}} | “staging-sanity/wdio-cucumber” |
| {{CI_PLATFORM}} | “Jenkins” |
| {{CI_BUILD_NUMBER}} | “4165” |
| {{CI_BUILD_URL}} | “http://localhost:8080/job/staging-sanity/job/wdio-cucumber/4165/” |
| {{FRAMEWORK_VERSION}} | 1.21 |
| {{FRAMEWORK_NAME}} | “WebdriverIO-cucumber” |
| {{SDK_VERSION}} | “8.36.1” |
| {{HOSTNAME}} | “EC2AMAZ-658H8P8” |
| {{HOST_OS}} | “Linux” |
| {{OBSERVABILITY_URL}} | “https://automation.browserstack.com/projects/Test+Observability+Samples/builds/wdio-cucumber-samples/235” |
| {{TOP_ERROR_1}} | “AssertionError: assert.fail()” |
| {{TOP_ERROR_1_IMPACT}} | 9 |
| {{TOP_ERROR_2}} | “Error: function timed out, ensure the promise resolves within 10000 milliseconds” |
| {{TOP_ERROR_2_IMPACT}} | 7 |
| {{TOP_ERROR_3}} | “AssertionError: assert.fail()” |
| {{TOP_ERROR_3_IMPACT}} | 7 |
| {{QG_RESULT}} | “passed” |
| {{QG_PROFILE_ID}} | “b7b534ae-8258-4b30-a76d-b4bbac15c74e” |
| {{QG_PROFILE_1_NAME}} | “Browserstack Default Profile” |
| {{QG_PROFILE_1_TYPE}} | “pass if” |
| {{QG_PROFILE_1_RESULT}} | “passed” |
| {{QG_PROFILE_1_RULE_1_CONDITION}} | “Flaky in the overall build is less than 15%” |
| {{QG_PROFILE_1_RULE_1_VALUE}} | 0 |
| {{QG_PROFILE_1_RULE_1_RESULT}} | “passed” |
| {{TEST_TYPE}} | “TEST” |
| {{TEST_NAME}} | “Verify Logging - Browserstack Logo Text (1)” |
| {{TEST_PLATFORM}} | Chrome 116, Windows 11 |
| {{TEST_FILE_PATH}} | /folder/file.js |
| {{TEST_STATUS}} | “failed” |
| {{TEST_URL}} | “BrowserStack Test Reporting & Analytics” |
| {{SMART_TAGGED}} | [Flaky, New Failure, etc.] |
| {{IS_AUTO_ANALYZED}} | FALSE |
| {{FAILURE_CATEGORY}} | [Product Bug, Automation Bug, To Be Investigated, etc.] |
| {{IS_PERFORMANCE_ANOMALY}} | FALSE |
| {{IS_MUTED}} | FALSE |
| {{TEST_TAGS}} | [“@browser”] |
| {{RUN_COUNT}} | 1 |
| {{TEST_DURATION}} | 191122 |
| {{TEST_FAILURE_LOG}} | “Error: Can’t call setValue on element with selector "#username input" because element wasn’t found” (clipped after 100 chars) |
| {{ALERT_NAME}} | “Verify Logging - Browserstack Logo Text” |
Test Management webhook variables
Test Management webhooks use a different variable namespace because they fire for different events. See:
- Test case variables for test case lifecycle events.
- Test plan variables for test plan lifecycle events.
- Test result variables for test result events.
Next steps
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!