Webhook template service#

OpenAPI file: WebhookTemplateService.json

Endpoints#

Validate template#

POST /scout/v1/webhook-templates/validate

Validates a Handlebars webhook template and returns the evaluated payload. Checks for template syntax errors and validates that the result is valid JSON.

Body

template string required

Handlebars template string to validate

sampleContext map of string to any JSON value

Sample variable values for template evaluation

Response

valid boolean

Whether the template is syntactically valid and produces valid JSON

evaluatedPayload string

Evaluated JSON payload if template is valid

errors array of ValidationError

List of validation errors

Fields of ValidationError
message string

Error message

line integer

Line number where error occurred

column integer

Column number where error occurred

warnings array of ValidationWarning

List of validation warnings

Fields of ValidationWarning
message string

Warning message

Request

curl -X POST "https://api.gov.nominal.io/api/scout/v1/webhook-templates/validate" \
  -H "Authorization: Bearer <api key>" \
  -H "Content-Type: application/json" \
  --data '{
  "template": "<template>"
}'
import requests

response = requests.post(
    "https://api.gov.nominal.io/api/scout/v1/webhook-templates/validate",
    headers={"Authorization": "Bearer <api key>"},
    json={"template": "<template>"},
)
response.raise_for_status()
print(response.json())
import httpx

response = httpx.post(
    "https://api.gov.nominal.io/api/scout/v1/webhook-templates/validate",
    headers={"Authorization": "Bearer <api key>"},
    json={"template": "<template>"},
)
response.raise_for_status()
print(response.json())
import asyncio

import aiohttp


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.post(
            "https://api.gov.nominal.io/api/scout/v1/webhook-templates/validate",
            headers={"Authorization": "Bearer <api key>"},
            json={"template": "<template>"},
        ) as response:
            response.raise_for_status()
            print(await response.json())


asyncio.run(main())

Response: 200

{
  "valid": true,
  "evaluatedPayload": "<evaluated payload>",
  "errors": [
    {
      "message": "<message>",
      "line": 1,
      "column": 1
    }
  ],
  "warnings": [
    {
      "message": "<message>"
    }
  ]
}

Test webhook#

POST /scout/v1/webhook-templates/test

Sends a test webhook using the specified integration and template. This allows users to verify their webhook configuration before using it in procedures.

Body

integrationRid string (RID) required

RID of the SimpleWebhookIntegration to use

template string required

Handlebars template for webhook payload

sampleContext map of string to any JSON value

Sample variable values for template evaluation

eventType string

Event type header value (default: test.webhook)

Response

success boolean

Whether the webhook was delivered successfully

statusCode integer

HTTP status code from the webhook endpoint, or 0 if delivery failed before any HTTP request was sent (for example due to template errors, invalid JSON, or URL validation failures).

responseBody string

Response body from webhook endpoint

errorMessage string

Error message if delivery failed

evaluatedPayload string

The actual JSON payload that was sent

latencyMillis integer (int64)

Time taken to deliver webhook in milliseconds

Request

curl -X POST "https://api.gov.nominal.io/api/scout/v1/webhook-templates/test" \
  -H "Authorization: Bearer <api key>" \
  -H "Content-Type: application/json" \
  --data '{
  "integrationRid": "<integration rid>",
  "template": "<template>"
}'
import requests

response = requests.post(
    "https://api.gov.nominal.io/api/scout/v1/webhook-templates/test",
    headers={"Authorization": "Bearer <api key>"},
    json={"integrationRid": "<integration rid>", "template": "<template>"},
)
response.raise_for_status()
print(response.json())
import httpx

response = httpx.post(
    "https://api.gov.nominal.io/api/scout/v1/webhook-templates/test",
    headers={"Authorization": "Bearer <api key>"},
    json={"integrationRid": "<integration rid>", "template": "<template>"},
)
response.raise_for_status()
print(response.json())
import asyncio

import aiohttp


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.post(
            "https://api.gov.nominal.io/api/scout/v1/webhook-templates/test",
            headers={"Authorization": "Bearer <api key>"},
            json={"integrationRid": "<integration rid>", "template": "<template>"},
        ) as response:
            response.raise_for_status()
            print(await response.json())


asyncio.run(main())

Response: 200

{
  "success": true,
  "statusCode": 1,
  "responseBody": "<response body>",
  "errorMessage": "<error message>",
  "evaluatedPayload": "<evaluated payload>",
  "latencyMillis": 1
}

Types#

ValidationError#

A validation error with optional location information

message string required

Error message

line integer

Line number where error occurred

column integer

Column number where error occurred

ValidationWarning#

A validation warning

message string required

Warning message

Page design based on Scalar, MIT License.