import requests
url = "https://app.langwatch.ai/api/triggers"
payload = {
"action": "SEND_EMAIL",
"actionParams": { "members": ["<string>"] },
"name": "<string>",
"customGraphId": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'SEND_EMAIL',
actionParams: {members: ['<string>']},
name: '<string>',
customGraphId: '<string>'
})
};
fetch('https://app.langwatch.ai/api/triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/triggers \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"action": "SEND_EMAIL",
"actionParams": {
"members": [
"<string>"
]
},
"name": "<string>",
"customGraphId": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"action": "SEND_EMAIL",
"actionParams": {},
"graphAlert": {
"threshold": 123,
"operator": "gt",
"timePeriod": 1,
"seriesName": "<string>"
},
"report": {
"source": {
"kind": "dashboard",
"dashboardId": "<string>"
},
"schedule": {
"cron": "<string>",
"timezone": "<string>"
},
"compareToPrevious": false
},
"filters": {},
"filterQuery": "<string>",
"kind": "AUTOMATION",
"customGraphId": "<string>",
"notificationCadence": "<string>",
"traceDebounceMs": 123,
"templates": {
"slackTemplateType": "string",
"slackTemplate": "<string>",
"emailSubjectTemplate": "<string>",
"emailBodyTemplate": "<string>"
},
"active": true,
"message": "<string>",
"alertType": "CRITICAL",
"createdAt": "<string>",
"updatedAt": "<string>",
"platformUrl": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Create a new trigger
Create an automation. Send customGraphId + graphAlert for an alert on a metric, report for a scheduled report, or conditions for a trace automation. The delivery channel is fixed at creation.
import requests
url = "https://app.langwatch.ai/api/triggers"
payload = {
"action": "SEND_EMAIL",
"actionParams": { "members": ["<string>"] },
"name": "<string>",
"customGraphId": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'SEND_EMAIL',
actionParams: {members: ['<string>']},
name: '<string>',
customGraphId: '<string>'
})
};
fetch('https://app.langwatch.ai/api/triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/triggers \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"action": "SEND_EMAIL",
"actionParams": {
"members": [
"<string>"
]
},
"name": "<string>",
"customGraphId": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"action": "SEND_EMAIL",
"actionParams": {},
"graphAlert": {
"threshold": 123,
"operator": "gt",
"timePeriod": 1,
"seriesName": "<string>"
},
"report": {
"source": {
"kind": "dashboard",
"dashboardId": "<string>"
},
"schedule": {
"cron": "<string>",
"timezone": "<string>"
},
"compareToPrevious": false
},
"filters": {},
"filterQuery": "<string>",
"kind": "AUTOMATION",
"customGraphId": "<string>",
"notificationCadence": "<string>",
"traceDebounceMs": 123,
"templates": {
"slackTemplateType": "string",
"slackTemplate": "<string>",
"emailSubjectTemplate": "<string>",
"emailBodyTemplate": "<string>"
},
"active": true,
"message": "<string>",
"alertType": "CRITICAL",
"createdAt": "<string>",
"updatedAt": "<string>",
"platformUrl": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.
Body
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
"SEND_EMAIL"Email delivery.
Show child attributes
Show child attributes
1Show child attributes
Show child attributes
The trace query this automation is about, in the syntax the traces view uses. When set it supersedes filters.
CRITICAL, WARNING, INFO Set to make this an alert on that graph. graphAlert and alertType are then required.
The rule an alert fires by: series, operator, threshold, window.
Show child attributes
Show child attributes
What a scheduled report renders and when it sends.
Show child attributes
Show child attributes
The Liquid templates this automation's message is rendered from. Absent fields render the LangWatch default for the channel.
Show child attributes
Show child attributes
How often a notification automation is allowed to send. A new one starts on a five-minute digest, which is what keeps a broad condition from sending a message per matching trace.
immediate, 5min_digest, 15min_digest, hourly_digest How long to wait for a trace to settle before the conditions are read.
0 <= x <= 600000Response
Trigger created
SEND_EMAIL, ADD_TO_DATASET, ADD_TO_ANNOTATION_QUEUE, SEND_SLACK_MESSAGE, SEND_WEBHOOK Where this automation delivers, with every credential value replaced by the [redacted] placeholder. Which channel is configured, which destination is set and which header names are in play all survive; the values never leave; a Slack automation names its connection by slackIntegrationId and carries no secret. Sending the placeholder back on an update keeps the stored value. The rule this automation fires by is not here — it is stated in graphAlert or report, and sending it in this field is refused.
Show child attributes
Show child attributes
The rule an alert fires by. Null for anything that is not one.
Show child attributes
Show child attributes
What a report renders and when. Null for anything else.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
What this automation is about: matching traces, a metric crossing a threshold, or a schedule.
AUTOMATION, ALERT, REPORT The Liquid templates this automation's message is rendered from. Absent fields render the LangWatch default for the channel.
Show child attributes
Show child attributes
CRITICAL, WARNING, INFO, null Was this page helpful?