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
templatestring requiredHandlebars template string to validate
sampleContextmap of string to any JSON valueSample variable values for template evaluation
Response
validbooleanWhether the template is syntactically valid and produces valid JSON
evaluatedPayloadstringEvaluated JSON payload if template is valid
errorsarray ofValidationErrorList of validation errors
Fields of
ValidationErrormessagestringError message
lineintegerLine number where error occurred
columnintegerColumn number where error occurred
warningsarray ofValidationWarningList of validation warnings
Fields of
ValidationWarningmessagestringWarning 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
integrationRidstring (RID) requiredRID of the SimpleWebhookIntegration to use
templatestring requiredHandlebars template for webhook payload
sampleContextmap of string to any JSON valueSample variable values for template evaluation
eventTypestringEvent type header value (default: test.webhook)
Response
successbooleanWhether the webhook was delivered successfully
statusCodeintegerHTTP 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).
responseBodystringResponse body from webhook endpoint
errorMessagestringError message if delivery failed
evaluatedPayloadstringThe actual JSON payload that was sent
latencyMillisinteger (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
messagestring requiredError message
lineintegerLine number where error occurred
columnintegerColumn number where error occurred
ValidationWarning#
A validation warning
messagestring requiredWarning message
Page design based on Scalar, MIT License.