import requests
url = "https://app.langwatch.ai/api/v1/trigger/slack"
payload = { "name": "<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({name: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/trigger/slack', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/trigger/slack \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>"
}
'{
"message": "<string>"
}This response has no body data.This response has no body data.This response has no body data.This response has no body data.Create a Slack alert trigger
Create a trigger that posts to Slack when traces match its filters, through a Slack connection (slack_connection_id, plus slack_channel_id for a bot) or an incoming webhook URL (slack_webhook), which is stored as a connection. The trigger stores no secret of its own. The /api/triggers family supersedes this narrower form, which stays for callers written against it.
import requests
url = "https://app.langwatch.ai/api/v1/trigger/slack"
payload = { "name": "<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({name: '<string>'})
};
fetch('https://app.langwatch.ai/api/v1/trigger/slack', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/trigger/slack \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>"
}
'{
"message": "<string>"
}This response has no body data.This response has no body data.This response has no body data.This response has no body data.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
How the trigger is listed in the app
CRITICAL, WARNING, INFO Incoming webhook URL the alert is posted to. It is stored as a Slack connection this project can use (an existing one holding the same URL, else a new project connection). Send this or slack_connection_id, not both.
The Slack connection the alert posts through: an organization connection or one of this project's, as GET /api/slack-connections and langwatch slack-connection list list them. Send this or slack_webhook, not both.
1The channel a bot connection posts in; required with one. Invite the LangWatch app to it first.
1Extra line included with each alert
Which traces the trigger fires on. An empty object fires on all of them.
Show child attributes
Show child attributes
Response
Success
Was this page helpful?