curl --request PATCH \
--url https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"addTriggerEvent": "domain.chat.pending"
},
{
"rename": "(SUB) Chat waiting alert"
}
]
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([{addTriggerEvent: 'domain.chat.pending'}, {rename: '(SUB) Chat waiting alert'}])
};
fetch('https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft"
payload = [{ "addTriggerEvent": "domain.chat.pending" }, { "rename": "(SUB) Chat waiting alert" }]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"_id": "6970b3c1d2e3f40123456789",
"drafts": [],
"inactiveRevisions": [],
"activeRevision": {
"_id": "6970b3c1d2e3f4012345678a",
"scenarioId": "6970b3c1d2e3f40123456789",
"name": "(SUB) New Incoming Messages",
"description": "Sends a webhook for each new incoming message",
"status": "active",
"version": 1,
"triggerEvents": [
"domain.message.created"
],
"conditions": [
[
{
"name": "filtrex",
"params": {
"expression": "direction == \"incoming\""
},
"confidentialData": false
}
]
],
"loaders": {
"afterConditions": [
{
"name": "chat",
"alias": "chat",
"params": {},
"confidentialData": false
}
]
},
"actions": [
{
"name": "request",
"params": {
"url": "https://example.com/hook",
"method": "post",
"json": true
},
"confidentialData": false
}
],
"options": {
"unorderedActions": false
},
"metadata": {
"authorUid": "4d170fc7-5cd6-4496-98e4-f4f03a11456e",
"created": 1768314807488,
"activated": 1768314808000
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}Update Draft
Apply a list of edit operations to the scenario’s draft. The body is an array of operations (1-1000), each containing exactly one of:
curl --request PATCH \
--url https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"addTriggerEvent": "domain.chat.pending"
},
{
"rename": "(SUB) Chat waiting alert"
}
]
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([{addTriggerEvent: 'domain.chat.pending'}, {rename: '(SUB) Chat waiting alert'}])
};
fetch('https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft"
payload = [{ "addTriggerEvent": "domain.chat.pending" }, { "rename": "(SUB) Chat waiting alert" }]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"_id": "6970b3c1d2e3f40123456789",
"drafts": [],
"inactiveRevisions": [],
"activeRevision": {
"_id": "6970b3c1d2e3f4012345678a",
"scenarioId": "6970b3c1d2e3f40123456789",
"name": "(SUB) New Incoming Messages",
"description": "Sends a webhook for each new incoming message",
"status": "active",
"version": 1,
"triggerEvents": [
"domain.message.created"
],
"conditions": [
[
{
"name": "filtrex",
"params": {
"expression": "direction == \"incoming\""
},
"confidentialData": false
}
]
],
"loaders": {
"afterConditions": [
{
"name": "chat",
"alias": "chat",
"params": {},
"confidentialData": false
}
]
},
"actions": [
{
"name": "request",
"params": {
"url": "https://example.com/hook",
"method": "post",
"json": true
},
"confidentialData": false
}
],
"options": {
"unorderedActions": false
},
"metadata": {
"authorUid": "4d170fc7-5cd6-4496-98e4-f4f03a11456e",
"created": 1768314807488,
"activated": 1768314808000
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}Edit scenarios, Manage scenarios on behalf of user (both are required)
| Operation | Payload |
|---|---|
addTriggerEvent / removeTriggerEvent | Event name string |
addLoader | { name, position, params, alias, confidentialData? } |
removeLoader | { index, position } |
addCondition | { name, params, groupIndex, confidentialData? } |
removeCondition | { groupIndex, index } |
addAction / removeAction | Action definition / index |
addLoop | { loop, position, index? } |
removeLoop | { index } |
changeDescription | New description string |
rename | New name string |
setUnorderedActions | Boolean |
Authorizations
API token generated in Texter: gear icon → Developers → API Tokens. When creating a token, assign it the scopes required by the endpoints you plan to call - each endpoint lists its required scopes.
Path Parameters
The unique identifier of the subscription (scenario). Use List All Subscriptions to find it under scenarios[]._id
Body
1Response
The scenario with the updated draft. Field-by-field reference: The Scenario object
An event subscription (scenario) in Texter
Unique identifier of the subscription/scenario
System scenario identifier. Present only on built-in system scenarios (returned when includeSystem=true)
Draft revisions of this scenario being edited. Same shape as a revision, but with status: "draft", no version/revisionComment, and metadata limited to authorUid/created/modified
Inactive revisions
Show child attributes
Show child attributes
The currently active version of the scenario
Show child attributes
Show child attributes