curl --request POST \
--url https://{projectID}.texterchat.com/server/api/v2/scenarios/manage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My custom automation",
"triggerEvent": "domain.chat.resolved"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'My custom automation', triggerEvent: 'domain.chat.resolved'})
};
fetch('https://{projectID}.texterchat.com/server/api/v2/scenarios/manage', 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"
payload = {
"name": "My custom automation",
"triggerEvent": "domain.chat.resolved"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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>"
}Create Empty Scenario
Create a new, empty scenario as a draft with a single trigger event. Build its loaders, conditions and actions afterwards with the Update Draft operations, then publish it with Create Revision. For webhook subscriptions, the simpler path is Import Subscription with a ready template.
curl --request POST \
--url https://{projectID}.texterchat.com/server/api/v2/scenarios/manage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My custom automation",
"triggerEvent": "domain.chat.resolved"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'My custom automation', triggerEvent: 'domain.chat.resolved'})
};
fetch('https://{projectID}.texterchat.com/server/api/v2/scenarios/manage', 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"
payload = {
"name": "My custom automation",
"triggerEvent": "domain.chat.resolved"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(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>"
}Create scenarios, Manage scenarios on behalf of user (both are required)
Note: unlike the other scenario-management operations, this endpoint does not accept an authorUid field (unknown body fields are rejected with 400).הרשאות
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.
גוף
תגובה
The created scenario (as a 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