Some testRTC products come equipped with a notification system designed to catch a rich set of events within the system and inform you about your test results. This article will provide a clear guide on configuring the notification engine to seamlessly deliver test results to your specified endpoint.
- Notifications
- Run results
- Custom alerts
Webhook
When using webhooks there are two options that you can choose from.
- Simply paste the webhook URL. If you choose this option, we will be sending out
the content in json/object
format.
https://webhook.site/80e9df96-8f69-4297-927a-00a28d723191
- Specify the exact format and
headers.
{ // Specify the format of the payload: "json/object", "json/text", or "cloudevent" "format": "json/object", // URL where the webhook payload will be sent "url": "https://webhook.site/80e9df96-8f69-4297-927a-00a28d723191", // Headers to include in the webhook request "headers": { "Authorization": "Bearer eyJ0eXAi...", ... }, // Optional // Parent field name encapsulating the primary data payload "fieldname": "anything-you-want", // Optional // Check Data Mapping section in this guide "body": { ... } }
Response Examples
-
json/object
{ "_id": 123, "name": "obj" }
-
json/text
{ "username": "testRTC_bot", "text": "{\"_id\":123,\"name\":\"obj\"}" }
-
CloudEvents
{ "_id": 123, "name": "obj" }
When using CloudEvents, further headers will be included by testRTC to identify the source and type.ce-source testrtc ce-type “testingrtc” “qualityrtc” “probertc” “none” Note: For more information, read CloudEvents.
Amazon Simple Notification Service (SNS)
There are two possible configurations when using Amazon SNS.
- If the SNS service is configured in one account (trusting) and the user is
configured in another account (trusted), your configuration should look like
this:
{ "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "roleArn": "arn:aws:iam::999999999999:role/Example", "topicArn": "arn:aws:sns:eu-central-1:999999999999:event", // Optional: Your schema for data mapping. "body": { ... } }
Note: For more information see Delegating access across AWS accounts using IAM roles. - In any case where the SNS service and user are configured in the same account,
use the following
configuration:
{ "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "topicArn": "arn:aws:sns:eu-central-1:999999999999:event", // Optional: Your schema for data mapping. "body": { ... } }
Response Example
{
...
"Message": "{\"_id\":123, \"name\":\"obj\"}"
}
Data Mapping
You are allowed to map data and include custom fields in your response. To accomplish this, simply include a new "body" field in the configuration, outlining your mapping scheme.
-
Format
{ ... "body": { "MyCustomID": "Session 12: VPN enabled", "MyCustomField": "<%this.fieldName%>" } }
-
Data
Example
{ "_id": "65afcc00332951a4e115c2f3", "name": "New Test", "project": { "_id": "83568359254fdj75847jfs99", "name": "My Cool Company" } }
-
Mapping Schema Example
(JSON)
{ ... "body": { "testRunID": "<%this._id%>", "projectName": "<%this.project.name%>", "thereIsNoSuchField": "<%this.isItMonday%>" } }
-
DTO Example (mapping schema
applied)
{ "testRunID": "65afcc00332951a4e115c2f3", "projectName": "My Cool Company", "thereIsNoSuchField": "UNKNOWN-VAR" }
-
Mapping Schema WITH “fieldname” Option Example
(JSON)
{ ... "body": { "testRunID": "<%this._id%>", "projectName": "<%this.project.name%>", "thereIsNoSuchField": "<%this.isItMonday%>" }, "fieldname": "testResult" }
-
DTO Example (mapping schema & “fieldname” option
applied)
{ "testResult": { "testRunID": "65afcc00332951a4e115c2f3", "projectName": "My Cool Company", "thereIsNoSuchField": "UNKNOWN-VAR" } }
Recommendations
- Slack: When working with Slack webhooks, you should use json/text format for seamless integration.
Find Configuration Form in testRTC
-
testingRTC / upRTC
-
qualityRTC
-
watchRTC