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",
"description": "Notify our ERP when a chat is resolved",
"triggerEvent": "domain.chat.resolved"
}
'import requests
url = "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage"
payload = {
"name": "My custom automation",
"description": "Notify our ERP when a chat is resolved",
"triggerEvent": "domain.chat.resolved"
}
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({
name: 'My custom automation',
description: 'Notify our ERP when a chat is resolved',
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));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My custom automation',
'description' => 'Notify our ERP when a chat is resolved',
'triggerEvent' => 'domain.chat.resolved'
]),
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"
payload := strings.NewReader("{\n \"name\": \"My custom automation\",\n \"description\": \"Notify our ERP when a chat is resolved\",\n \"triggerEvent\": \"domain.chat.resolved\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My custom automation\",\n \"description\": \"Notify our ERP when a chat is resolved\",\n \"triggerEvent\": \"domain.chat.resolved\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My custom automation\",\n \"description\": \"Notify our ERP when a chat is resolved\",\n \"triggerEvent\": \"domain.chat.resolved\"\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>"
}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",
"description": "Notify our ERP when a chat is resolved",
"triggerEvent": "domain.chat.resolved"
}
'import requests
url = "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage"
payload = {
"name": "My custom automation",
"description": "Notify our ERP when a chat is resolved",
"triggerEvent": "domain.chat.resolved"
}
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({
name: 'My custom automation',
description: 'Notify our ERP when a chat is resolved',
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));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{projectID}.texterchat.com/server/api/v2/scenarios/manage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My custom automation',
'description' => 'Notify our ERP when a chat is resolved',
'triggerEvent' => 'domain.chat.resolved'
]),
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"
payload := strings.NewReader("{\n \"name\": \"My custom automation\",\n \"description\": \"Notify our ERP when a chat is resolved\",\n \"triggerEvent\": \"domain.chat.resolved\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My custom automation\",\n \"description\": \"Notify our ERP when a chat is resolved\",\n \"triggerEvent\": \"domain.chat.resolved\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{projectID}.texterchat.com/server/api/v2/scenarios/manage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My custom automation\",\n \"description\": \"Notify our ERP when a chat is resolved\",\n \"triggerEvent\": \"domain.chat.resolved\"\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>"
}Create scenarios, Manage scenarios on behalf of user (both are required)
Optionally, you can include an authorUid body field (a Texter user UID) to attribute the action to a specific user; when omitted, it is attributed automatically.הרשאות
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