Create a trigger
Creates a cron or webhook trigger that starts sessions on this environment unattended. A webhook trigger’s response carries webhook_url and the signing secret, shown only here and on rotate-secret. Refused (400 ask_not_allowed) when the environment’s latest version asks for approval: nobody is there to answer.
curl --request POST \
--url https://api.veri.studio/v1/environments/{env_id}/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"kind": "<string>",
"prompt": "<string>",
"name": "<string>",
"cron": "<string>",
"timezone": "<string>",
"provider": "<string>",
"session_mode": "<string>",
"reuse_session_id": "<string>",
"budget_usd": 123,
"output": {
"kind": "<string>",
"target": "<string>"
}
}
'import requests
url = "https://api.veri.studio/v1/environments/{env_id}/triggers"
payload = {
"kind": "<string>",
"prompt": "<string>",
"name": "<string>",
"cron": "<string>",
"timezone": "<string>",
"provider": "<string>",
"session_mode": "<string>",
"reuse_session_id": "<string>",
"budget_usd": 123,
"output": {
"kind": "<string>",
"target": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
kind: '<string>',
prompt: '<string>',
name: '<string>',
cron: '<string>',
timezone: '<string>',
provider: '<string>',
session_mode: '<string>',
reuse_session_id: '<string>',
budget_usd: 123,
output: {kind: '<string>', target: '<string>'}
})
};
fetch('https://api.veri.studio/v1/environments/{env_id}/triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"object": "<string>",
"id": "<string>",
"environment_id": "<string>",
"kind": "<string>",
"session_mode": "<string>",
"prompt": "<string>",
"budget_usd": 123,
"output": {
"kind": "<string>",
"target": "<string>"
},
"status": "<string>",
"consecutive_failures": 123,
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"provider": "<string>",
"cron": "<string>",
"timezone": "<string>",
"reuse_session_id": "<string>",
"paused_reason": "<string>",
"next_fire_at": "2023-11-07T05:31:56Z",
"webhook_url": "<string>",
"secret": "<string>",
"previous_secret_expires_at": "2023-11-07T05:31:56Z",
"last_execution": {
"object": "<string>",
"id": "<string>",
"trigger_id": "<string>",
"kind": "<string>",
"status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"delivery_id": "<string>",
"session_id": "<string>",
"failure_reason": "<string>",
"payload_excerpt": "<string>",
"result_excerpt": "<string>",
"output_error": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
}
}Authorizations
API key with the vk_ prefix. Create one from the dashboard.
Path Parameters
Environment ID
Body
cron or webhook.
The message each firing sends. {{payload}} = the webhook body as JSON
(at most 16 KiB), {{.a.b}} = one field of it; missing fields render
empty. Cron firings have no payload.
Display name, at most 64 characters.
cron: a five-field POSIX cron expression (minute granularity; weekdays 0-6 = Sunday-Saturday) or an @nickname (@hourly, @daily, ...).
cron: IANA time zone the expression is read in (default UTC).
webhook: github, gitlab or custom (Standard Webhooks; default).
fresh (default): a new session per firing, ended when the run
completes. reuse: wake reuse_session_id, send, pause it again.
Spend ceiling per fresh session in USD (default 2.00).
Where results go besides trigger.execution.* webhooks (default none).
Show child attributes
Show child attributes
Response
The new trigger (with its secret, for a webhook trigger)
cron | webhook
fresh | reuse
Slack URLs are masked.
Show child attributes
Show child attributes
active | paused
webhook: github | gitlab | custom
Why the trigger is paused, when it was not paused by hand (five consecutive failures, a deleted environment, ...).
cron: when it fires next (absent while paused).
webhook: the URL to give the provider.
webhook: the signing secret. Returned ONLY by create and rotate-secret; store it then.
webhook: until when the previous secret still verifies (rotation grace).
Show child attributes
Show child attributes
curl --request POST \
--url https://api.veri.studio/v1/environments/{env_id}/triggers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"kind": "<string>",
"prompt": "<string>",
"name": "<string>",
"cron": "<string>",
"timezone": "<string>",
"provider": "<string>",
"session_mode": "<string>",
"reuse_session_id": "<string>",
"budget_usd": 123,
"output": {
"kind": "<string>",
"target": "<string>"
}
}
'import requests
url = "https://api.veri.studio/v1/environments/{env_id}/triggers"
payload = {
"kind": "<string>",
"prompt": "<string>",
"name": "<string>",
"cron": "<string>",
"timezone": "<string>",
"provider": "<string>",
"session_mode": "<string>",
"reuse_session_id": "<string>",
"budget_usd": 123,
"output": {
"kind": "<string>",
"target": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
kind: '<string>',
prompt: '<string>',
name: '<string>',
cron: '<string>',
timezone: '<string>',
provider: '<string>',
session_mode: '<string>',
reuse_session_id: '<string>',
budget_usd: 123,
output: {kind: '<string>', target: '<string>'}
})
};
fetch('https://api.veri.studio/v1/environments/{env_id}/triggers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"object": "<string>",
"id": "<string>",
"environment_id": "<string>",
"kind": "<string>",
"session_mode": "<string>",
"prompt": "<string>",
"budget_usd": 123,
"output": {
"kind": "<string>",
"target": "<string>"
},
"status": "<string>",
"consecutive_failures": 123,
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"provider": "<string>",
"cron": "<string>",
"timezone": "<string>",
"reuse_session_id": "<string>",
"paused_reason": "<string>",
"next_fire_at": "2023-11-07T05:31:56Z",
"webhook_url": "<string>",
"secret": "<string>",
"previous_secret_expires_at": "2023-11-07T05:31:56Z",
"last_execution": {
"object": "<string>",
"id": "<string>",
"trigger_id": "<string>",
"kind": "<string>",
"status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"delivery_id": "<string>",
"session_id": "<string>",
"failure_reason": "<string>",
"payload_excerpt": "<string>",
"result_excerpt": "<string>",
"output_error": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z"
}
}
