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"
}
]
'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)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));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
[
'addTriggerEvent' => 'domain.chat.pending'
],
[
'rename' => '(SUB) Chat waiting alert'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft"
payload := strings.NewReader("[\n {\n \"addTriggerEvent\": \"domain.chat.pending\"\n },\n {\n \"rename\": \"(SUB) Chat waiting alert\"\n }\n]")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"addTriggerEvent\": \"domain.chat.pending\"\n },\n {\n \"rename\": \"(SUB) Chat waiting alert\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"addTriggerEvent\": \"domain.chat.pending\"\n },\n {\n \"rename\": \"(SUB) Chat waiting alert\"\n }\n]"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"system": "<string>",
"drafts": [
{}
],
"inactiveRevisions": [
{
"_id": "<string>",
"scenarioId": "<string>",
"name": "<string>",
"description": "<string>",
"version": 123,
"parentVersion": 123,
"revisionComment": "<string>",
"triggerEvents": [
"<string>"
],
"conditions": [
[
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
],
"loaders": {
"beforeConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"afterConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
},
"actions": [
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"loops": [
{
"loop": {}
}
],
"tags": [
"<string>"
],
"attachedData": {},
"system": "<string>",
"options": {
"unorderedActions": true
},
"metadata": {
"authorUid": "<string>",
"created": 123,
"modified": 123,
"activated": 123,
"activations": [
{
"timestamp": 123,
"userUid": "<string>"
}
]
}
}
],
"activeRevision": {
"_id": "<string>",
"scenarioId": "<string>",
"name": "<string>",
"description": "<string>",
"version": 123,
"parentVersion": 123,
"revisionComment": "<string>",
"triggerEvents": [
"<string>"
],
"conditions": [
[
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
],
"loaders": {
"beforeConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"afterConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
},
"actions": [
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"loops": [
{
"loop": {}
}
],
"tags": [
"<string>"
],
"attachedData": {},
"system": "<string>",
"options": {
"unorderedActions": true
},
"metadata": {
"authorUid": "<string>",
"created": 123,
"modified": 123,
"activated": 123,
"activations": [
{
"timestamp": 123,
"userUid": "<string>"
}
]
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}Update Draft
Apply a list of edit operations to the scenario’s draft. The body is an array of operations, 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"
}
]
'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)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));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
[
'addTriggerEvent' => 'domain.chat.pending'
],
[
'rename' => '(SUB) Chat waiting alert'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft"
payload := strings.NewReader("[\n {\n \"addTriggerEvent\": \"domain.chat.pending\"\n },\n {\n \"rename\": \"(SUB) Chat waiting alert\"\n }\n]")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"addTriggerEvent\": \"domain.chat.pending\"\n },\n {\n \"rename\": \"(SUB) Chat waiting alert\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage/{scenarioId}/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"addTriggerEvent\": \"domain.chat.pending\"\n },\n {\n \"rename\": \"(SUB) Chat waiting alert\"\n }\n]"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"system": "<string>",
"drafts": [
{}
],
"inactiveRevisions": [
{
"_id": "<string>",
"scenarioId": "<string>",
"name": "<string>",
"description": "<string>",
"version": 123,
"parentVersion": 123,
"revisionComment": "<string>",
"triggerEvents": [
"<string>"
],
"conditions": [
[
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
],
"loaders": {
"beforeConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"afterConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
},
"actions": [
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"loops": [
{
"loop": {}
}
],
"tags": [
"<string>"
],
"attachedData": {},
"system": "<string>",
"options": {
"unorderedActions": true
},
"metadata": {
"authorUid": "<string>",
"created": 123,
"modified": 123,
"activated": 123,
"activations": [
{
"timestamp": 123,
"userUid": "<string>"
}
]
}
}
],
"activeRevision": {
"_id": "<string>",
"scenarioId": "<string>",
"name": "<string>",
"description": "<string>",
"version": 123,
"parentVersion": 123,
"revisionComment": "<string>",
"triggerEvents": [
"<string>"
],
"conditions": [
[
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
],
"loaders": {
"beforeConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"afterConditions": [
{
"name": "<string>",
"alias": "<string>",
"params": "<unknown>",
"confidentialData": true
}
]
},
"actions": [
{
"name": "<string>",
"params": "<unknown>",
"confidentialData": true
}
],
"loops": [
{
"loop": {}
}
],
"tags": [
"<string>"
],
"attachedData": {},
"system": "<string>",
"options": {
"unorderedActions": true
},
"metadata": {
"authorUid": "<string>",
"created": 123,
"modified": 123,
"activated": 123,
"activations": [
{
"timestamp": 123,
"userUid": "<string>"
}
]
}
}
}{
"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 / removeLoop | Loop definition / position |
rename | New name string |
setUnorderedActions | Boolean |
authorUid body field (a Texter user UID) to attribute the action to a specific user; when omitted, it is attributed automatically.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