curl --request POST \
--url https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"steps": [
{
"id": "5001",
"type": "dayTimeSplitter",
"name": "Opening hours",
"branches": [
{
"days": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday"
],
"holidays": false,
"from": "08:00",
"to": "17:00",
"steps": [
{
"id": "5002",
"type": "ivrMenu",
"name": "Main menu",
"soundId": "79",
"waitSeconds": 5,
"options": {
"1": [
{
"id": "5003",
"type": "ringGroup",
"groupId": "611",
"ringSeconds": 30,
"onAnswered": [],
"onNoAnswer": [
{
"id": "5006",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "accountDefault",
"attachRecording": "accountDefault"
}
]
}
],
"2": [
{
"id": "5004",
"type": "voiceAgent",
"voiceAgentId": "674b87da2a8347e6682cca8d",
"onAnswered": [
{
"id": "5008",
"type": "conditionSplitter",
"branches": [
{
"conditions": [
{
"field": "voiceAgent.5004.resolved",
"operator": "equals",
"value": "false"
}
],
"steps": [
{
"id": "5009",
"type": "ringGroup",
"groupId": "568",
"ringSeconds": 40,
"onAnswered": [],
"onNoAnswer": []
}
]
}
],
"otherwise": [
{
"id": "5010",
"type": "markResolved"
}
]
}
],
"onNoAnswer": [
{
"id": "5011",
"type": "jumpTo",
"target": "5003",
"targetNumberId": "600"
}
]
}
]
},
"noInput": [
{
"id": "5005",
"type": "jumpTo",
"target": "5002",
"targetNumberId": "600"
}
]
}
]
}
],
"otherwise": [
{
"id": "5007",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "on",
"attachRecording": "off"
}
]
}
]
}
'import requests
url = "https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate"
payload = { "steps": [
{
"id": "5001",
"type": "dayTimeSplitter",
"name": "Opening hours",
"branches": [
{
"days": ["monday", "tuesday", "wednesday", "thursday", "friday"],
"holidays": False,
"from": "08:00",
"to": "17:00",
"steps": [
{
"id": "5002",
"type": "ivrMenu",
"name": "Main menu",
"soundId": "79",
"waitSeconds": 5,
"options": {
"1": [
{
"id": "5003",
"type": "ringGroup",
"groupId": "611",
"ringSeconds": 30,
"onAnswered": [],
"onNoAnswer": [
{
"id": "5006",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "accountDefault",
"attachRecording": "accountDefault"
}
]
}
],
"2": [
{
"id": "5004",
"type": "voiceAgent",
"voiceAgentId": "674b87da2a8347e6682cca8d",
"onAnswered": [
{
"id": "5008",
"type": "conditionSplitter",
"branches": [
{
"conditions": [
{
"field": "voiceAgent.5004.resolved",
"operator": "equals",
"value": "false"
}
],
"steps": [
{
"id": "5009",
"type": "ringGroup",
"groupId": "568",
"ringSeconds": 40,
"onAnswered": [],
"onNoAnswer": []
}
]
}
],
"otherwise": [
{
"id": "5010",
"type": "markResolved"
}
]
}
],
"onNoAnswer": [
{
"id": "5011",
"type": "jumpTo",
"target": "5003",
"targetNumberId": "600"
}
]
}
]
},
"noInput": [
{
"id": "5005",
"type": "jumpTo",
"target": "5002",
"targetNumberId": "600"
}
]
}
]
}
],
"otherwise": [
{
"id": "5007",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "on",
"attachRecording": "off"
}
]
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
steps: [
{
id: '5001',
type: 'dayTimeSplitter',
name: 'Opening hours',
branches: [
{
days: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'],
holidays: false,
from: '08:00',
to: '17:00',
steps: [
{
id: '5002',
type: 'ivrMenu',
name: 'Main menu',
soundId: '79',
waitSeconds: 5,
options: {
'1': [
{
id: '5003',
type: 'ringGroup',
groupId: '611',
ringSeconds: 30,
onAnswered: [],
onNoAnswer: [
{
id: '5006',
type: 'voicemail',
voicemailBoxId: '88',
emailNotification: 'accountDefault',
attachRecording: 'accountDefault'
}
]
}
],
'2': [
{
id: '5004',
type: 'voiceAgent',
voiceAgentId: '674b87da2a8347e6682cca8d',
onAnswered: [
{
id: '5008',
type: 'conditionSplitter',
branches: [
{
conditions: [{field: 'voiceAgent.5004.resolved', operator: 'equals', value: 'false'}],
steps: [
{
id: '5009',
type: 'ringGroup',
groupId: '568',
ringSeconds: 40,
onAnswered: [],
onNoAnswer: []
}
]
}
],
otherwise: [{id: '5010', type: 'markResolved'}]
}
],
onNoAnswer: [{id: '5011', type: 'jumpTo', target: '5003', targetNumberId: '600'}]
}
]
},
noInput: [{id: '5005', type: 'jumpTo', target: '5002', targetNumberId: '600'}]
}
]
}
],
otherwise: [
{
id: '5007',
type: 'voicemail',
voicemailBoxId: '88',
emailNotification: 'on',
attachRecording: 'off'
}
]
}
]
})
};
fetch('https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate', 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://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate",
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([
'steps' => [
[
'id' => '5001',
'type' => 'dayTimeSplitter',
'name' => 'Opening hours',
'branches' => [
[
'days' => [
'monday',
'tuesday',
'wednesday',
'thursday',
'friday'
],
'holidays' => false,
'from' => '08:00',
'to' => '17:00',
'steps' => [
[
'id' => '5002',
'type' => 'ivrMenu',
'name' => 'Main menu',
'soundId' => '79',
'waitSeconds' => 5,
'options' => [
'1' => [
[
'id' => '5003',
'type' => 'ringGroup',
'groupId' => '611',
'ringSeconds' => 30,
'onAnswered' => [
],
'onNoAnswer' => [
[
'id' => '5006',
'type' => 'voicemail',
'voicemailBoxId' => '88',
'emailNotification' => 'accountDefault',
'attachRecording' => 'accountDefault'
]
]
]
],
'2' => [
[
'id' => '5004',
'type' => 'voiceAgent',
'voiceAgentId' => '674b87da2a8347e6682cca8d',
'onAnswered' => [
[
'id' => '5008',
'type' => 'conditionSplitter',
'branches' => [
[
'conditions' => [
[
'field' => 'voiceAgent.5004.resolved',
'operator' => 'equals',
'value' => 'false'
]
],
'steps' => [
[
'id' => '5009',
'type' => 'ringGroup',
'groupId' => '568',
'ringSeconds' => 40,
'onAnswered' => [
],
'onNoAnswer' => [
]
]
]
]
],
'otherwise' => [
[
'id' => '5010',
'type' => 'markResolved'
]
]
]
],
'onNoAnswer' => [
[
'id' => '5011',
'type' => 'jumpTo',
'target' => '5003',
'targetNumberId' => '600'
]
]
]
]
],
'noInput' => [
[
'id' => '5005',
'type' => 'jumpTo',
'target' => '5002',
'targetNumberId' => '600'
]
]
]
]
]
],
'otherwise' => [
[
'id' => '5007',
'type' => 'voicemail',
'voicemailBoxId' => '88',
'emailNotification' => 'on',
'attachRecording' => 'off'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate"
payload := strings.NewReader("{\n \"steps\": [\n {\n \"id\": \"5001\",\n \"type\": \"dayTimeSplitter\",\n \"name\": \"Opening hours\",\n \"branches\": [\n {\n \"days\": [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\"\n ],\n \"holidays\": false,\n \"from\": \"08:00\",\n \"to\": \"17:00\",\n \"steps\": [\n {\n \"id\": \"5002\",\n \"type\": \"ivrMenu\",\n \"name\": \"Main menu\",\n \"soundId\": \"79\",\n \"waitSeconds\": 5,\n \"options\": {\n \"1\": [\n {\n \"id\": \"5003\",\n \"type\": \"ringGroup\",\n \"groupId\": \"611\",\n \"ringSeconds\": 30,\n \"onAnswered\": [],\n \"onNoAnswer\": [\n {\n \"id\": \"5006\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"accountDefault\",\n \"attachRecording\": \"accountDefault\"\n }\n ]\n }\n ],\n \"2\": [\n {\n \"id\": \"5004\",\n \"type\": \"voiceAgent\",\n \"voiceAgentId\": \"674b87da2a8347e6682cca8d\",\n \"onAnswered\": [\n {\n \"id\": \"5008\",\n \"type\": \"conditionSplitter\",\n \"branches\": [\n {\n \"conditions\": [\n {\n \"field\": \"voiceAgent.5004.resolved\",\n \"operator\": \"equals\",\n \"value\": \"false\"\n }\n ],\n \"steps\": [\n {\n \"id\": \"5009\",\n \"type\": \"ringGroup\",\n \"groupId\": \"568\",\n \"ringSeconds\": 40,\n \"onAnswered\": [],\n \"onNoAnswer\": []\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5010\",\n \"type\": \"markResolved\"\n }\n ]\n }\n ],\n \"onNoAnswer\": [\n {\n \"id\": \"5011\",\n \"type\": \"jumpTo\",\n \"target\": \"5003\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n },\n \"noInput\": [\n {\n \"id\": \"5005\",\n \"type\": \"jumpTo\",\n \"target\": \"5002\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5007\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"on\",\n \"attachRecording\": \"off\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"steps\": [\n {\n \"id\": \"5001\",\n \"type\": \"dayTimeSplitter\",\n \"name\": \"Opening hours\",\n \"branches\": [\n {\n \"days\": [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\"\n ],\n \"holidays\": false,\n \"from\": \"08:00\",\n \"to\": \"17:00\",\n \"steps\": [\n {\n \"id\": \"5002\",\n \"type\": \"ivrMenu\",\n \"name\": \"Main menu\",\n \"soundId\": \"79\",\n \"waitSeconds\": 5,\n \"options\": {\n \"1\": [\n {\n \"id\": \"5003\",\n \"type\": \"ringGroup\",\n \"groupId\": \"611\",\n \"ringSeconds\": 30,\n \"onAnswered\": [],\n \"onNoAnswer\": [\n {\n \"id\": \"5006\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"accountDefault\",\n \"attachRecording\": \"accountDefault\"\n }\n ]\n }\n ],\n \"2\": [\n {\n \"id\": \"5004\",\n \"type\": \"voiceAgent\",\n \"voiceAgentId\": \"674b87da2a8347e6682cca8d\",\n \"onAnswered\": [\n {\n \"id\": \"5008\",\n \"type\": \"conditionSplitter\",\n \"branches\": [\n {\n \"conditions\": [\n {\n \"field\": \"voiceAgent.5004.resolved\",\n \"operator\": \"equals\",\n \"value\": \"false\"\n }\n ],\n \"steps\": [\n {\n \"id\": \"5009\",\n \"type\": \"ringGroup\",\n \"groupId\": \"568\",\n \"ringSeconds\": 40,\n \"onAnswered\": [],\n \"onNoAnswer\": []\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5010\",\n \"type\": \"markResolved\"\n }\n ]\n }\n ],\n \"onNoAnswer\": [\n {\n \"id\": \"5011\",\n \"type\": \"jumpTo\",\n \"target\": \"5003\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n },\n \"noInput\": [\n {\n \"id\": \"5005\",\n \"type\": \"jumpTo\",\n \"target\": \"5002\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5007\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"on\",\n \"attachRecording\": \"off\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"steps\": [\n {\n \"id\": \"5001\",\n \"type\": \"dayTimeSplitter\",\n \"name\": \"Opening hours\",\n \"branches\": [\n {\n \"days\": [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\"\n ],\n \"holidays\": false,\n \"from\": \"08:00\",\n \"to\": \"17:00\",\n \"steps\": [\n {\n \"id\": \"5002\",\n \"type\": \"ivrMenu\",\n \"name\": \"Main menu\",\n \"soundId\": \"79\",\n \"waitSeconds\": 5,\n \"options\": {\n \"1\": [\n {\n \"id\": \"5003\",\n \"type\": \"ringGroup\",\n \"groupId\": \"611\",\n \"ringSeconds\": 30,\n \"onAnswered\": [],\n \"onNoAnswer\": [\n {\n \"id\": \"5006\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"accountDefault\",\n \"attachRecording\": \"accountDefault\"\n }\n ]\n }\n ],\n \"2\": [\n {\n \"id\": \"5004\",\n \"type\": \"voiceAgent\",\n \"voiceAgentId\": \"674b87da2a8347e6682cca8d\",\n \"onAnswered\": [\n {\n \"id\": \"5008\",\n \"type\": \"conditionSplitter\",\n \"branches\": [\n {\n \"conditions\": [\n {\n \"field\": \"voiceAgent.5004.resolved\",\n \"operator\": \"equals\",\n \"value\": \"false\"\n }\n ],\n \"steps\": [\n {\n \"id\": \"5009\",\n \"type\": \"ringGroup\",\n \"groupId\": \"568\",\n \"ringSeconds\": 40,\n \"onAnswered\": [],\n \"onNoAnswer\": []\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5010\",\n \"type\": \"markResolved\"\n }\n ]\n }\n ],\n \"onNoAnswer\": [\n {\n \"id\": \"5011\",\n \"type\": \"jumpTo\",\n \"target\": \"5003\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n },\n \"noInput\": [\n {\n \"id\": \"5005\",\n \"type\": \"jumpTo\",\n \"target\": \"5002\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5007\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"on\",\n \"attachRecording\": \"off\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"valid": false,
"errors": [
{
"code": "CALL_FLOWS.UNKNOWN_GROUP",
"message": "Group 568 is not in your account.",
"target": "/steps/0/branches/0/steps/0/options/2/0/onAnswered/0/branches/0/steps/0/groupId"
}
],
"warnings": [
{
"code": "RING_TIME_BELOW_GROUP_MINIMUM",
"message": "The group rings each agent for 30 seconds. Ring the group for at least 40 seconds.",
"target": "/steps/0/branches/0/steps/0/options/1/0/ringSeconds"
},
{
"code": "JUMP_TARGETS_REMOVED",
"message": "Number 77 has a Jump to step that points at step 5012, which this change removes. That step will be deleted.",
"target": "/steps"
}
],
"changes": {
"added": [],
"updated": [
{
"id": "5003",
"target": "/steps/0/branches/0/steps/0/options/1/0",
"fields": [
"ringSeconds"
]
}
],
"removed": [
{
"id": "5012",
"type": "ringUser"
}
],
"otherNumbers": [
{
"numberId": "77",
"removedJumpToStepIds": [
"4410"
]
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}{
"code": "UNAUTHORIZED",
"message": "You are not authorized to access this resource."
}{
"error": {
"code": "FORBIDDEN",
"message": "This account is not active."
},
"requestId": "3b0e51c7a9"
}{
"error": {
"code": "CALL_FLOWS.NUMBER_NOT_FOUND",
"message": "No number with this id in your account."
},
"requestId": "c41f0a9e2b"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "VALIDATION.INVALID_BODY",
"message": "Request body is too large."
},
"requestId": "8c1f4a2e60"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}<string>{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}Validate a call flow
Checks a document as Replace a number’s call flow would, without saving. Returns every error and warning with a JSON pointer, and a summary of what a save would change. Use it to preview a change for a person, or to let an agent fix its own mistakes before saving.
- The answer is
200also when the document has errors:validisfalseanderrorslists them. If-Matchis optional. When sent and stale,errorshasCALL_FLOWS.ETAG_MISMATCH; there is no412.changes.otherNumberslists the numbers whose Jump to steps a save would delete.- When the voice agents cannot be looked up, their ids are not checked and
warningshasVOICE_AGENT_CHECK_SKIPPED: a save may still answer502 CALL_FLOWS.UPSTREAM_UNAVAILABLE.
curl --request POST \
--url https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"steps": [
{
"id": "5001",
"type": "dayTimeSplitter",
"name": "Opening hours",
"branches": [
{
"days": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday"
],
"holidays": false,
"from": "08:00",
"to": "17:00",
"steps": [
{
"id": "5002",
"type": "ivrMenu",
"name": "Main menu",
"soundId": "79",
"waitSeconds": 5,
"options": {
"1": [
{
"id": "5003",
"type": "ringGroup",
"groupId": "611",
"ringSeconds": 30,
"onAnswered": [],
"onNoAnswer": [
{
"id": "5006",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "accountDefault",
"attachRecording": "accountDefault"
}
]
}
],
"2": [
{
"id": "5004",
"type": "voiceAgent",
"voiceAgentId": "674b87da2a8347e6682cca8d",
"onAnswered": [
{
"id": "5008",
"type": "conditionSplitter",
"branches": [
{
"conditions": [
{
"field": "voiceAgent.5004.resolved",
"operator": "equals",
"value": "false"
}
],
"steps": [
{
"id": "5009",
"type": "ringGroup",
"groupId": "568",
"ringSeconds": 40,
"onAnswered": [],
"onNoAnswer": []
}
]
}
],
"otherwise": [
{
"id": "5010",
"type": "markResolved"
}
]
}
],
"onNoAnswer": [
{
"id": "5011",
"type": "jumpTo",
"target": "5003",
"targetNumberId": "600"
}
]
}
]
},
"noInput": [
{
"id": "5005",
"type": "jumpTo",
"target": "5002",
"targetNumberId": "600"
}
]
}
]
}
],
"otherwise": [
{
"id": "5007",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "on",
"attachRecording": "off"
}
]
}
]
}
'import requests
url = "https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate"
payload = { "steps": [
{
"id": "5001",
"type": "dayTimeSplitter",
"name": "Opening hours",
"branches": [
{
"days": ["monday", "tuesday", "wednesday", "thursday", "friday"],
"holidays": False,
"from": "08:00",
"to": "17:00",
"steps": [
{
"id": "5002",
"type": "ivrMenu",
"name": "Main menu",
"soundId": "79",
"waitSeconds": 5,
"options": {
"1": [
{
"id": "5003",
"type": "ringGroup",
"groupId": "611",
"ringSeconds": 30,
"onAnswered": [],
"onNoAnswer": [
{
"id": "5006",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "accountDefault",
"attachRecording": "accountDefault"
}
]
}
],
"2": [
{
"id": "5004",
"type": "voiceAgent",
"voiceAgentId": "674b87da2a8347e6682cca8d",
"onAnswered": [
{
"id": "5008",
"type": "conditionSplitter",
"branches": [
{
"conditions": [
{
"field": "voiceAgent.5004.resolved",
"operator": "equals",
"value": "false"
}
],
"steps": [
{
"id": "5009",
"type": "ringGroup",
"groupId": "568",
"ringSeconds": 40,
"onAnswered": [],
"onNoAnswer": []
}
]
}
],
"otherwise": [
{
"id": "5010",
"type": "markResolved"
}
]
}
],
"onNoAnswer": [
{
"id": "5011",
"type": "jumpTo",
"target": "5003",
"targetNumberId": "600"
}
]
}
]
},
"noInput": [
{
"id": "5005",
"type": "jumpTo",
"target": "5002",
"targetNumberId": "600"
}
]
}
]
}
],
"otherwise": [
{
"id": "5007",
"type": "voicemail",
"voicemailBoxId": "88",
"emailNotification": "on",
"attachRecording": "off"
}
]
}
] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
steps: [
{
id: '5001',
type: 'dayTimeSplitter',
name: 'Opening hours',
branches: [
{
days: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'],
holidays: false,
from: '08:00',
to: '17:00',
steps: [
{
id: '5002',
type: 'ivrMenu',
name: 'Main menu',
soundId: '79',
waitSeconds: 5,
options: {
'1': [
{
id: '5003',
type: 'ringGroup',
groupId: '611',
ringSeconds: 30,
onAnswered: [],
onNoAnswer: [
{
id: '5006',
type: 'voicemail',
voicemailBoxId: '88',
emailNotification: 'accountDefault',
attachRecording: 'accountDefault'
}
]
}
],
'2': [
{
id: '5004',
type: 'voiceAgent',
voiceAgentId: '674b87da2a8347e6682cca8d',
onAnswered: [
{
id: '5008',
type: 'conditionSplitter',
branches: [
{
conditions: [{field: 'voiceAgent.5004.resolved', operator: 'equals', value: 'false'}],
steps: [
{
id: '5009',
type: 'ringGroup',
groupId: '568',
ringSeconds: 40,
onAnswered: [],
onNoAnswer: []
}
]
}
],
otherwise: [{id: '5010', type: 'markResolved'}]
}
],
onNoAnswer: [{id: '5011', type: 'jumpTo', target: '5003', targetNumberId: '600'}]
}
]
},
noInput: [{id: '5005', type: 'jumpTo', target: '5002', targetNumberId: '600'}]
}
]
}
],
otherwise: [
{
id: '5007',
type: 'voicemail',
voicemailBoxId: '88',
emailNotification: 'on',
attachRecording: 'off'
}
]
}
]
})
};
fetch('https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate', 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://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate",
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([
'steps' => [
[
'id' => '5001',
'type' => 'dayTimeSplitter',
'name' => 'Opening hours',
'branches' => [
[
'days' => [
'monday',
'tuesday',
'wednesday',
'thursday',
'friday'
],
'holidays' => false,
'from' => '08:00',
'to' => '17:00',
'steps' => [
[
'id' => '5002',
'type' => 'ivrMenu',
'name' => 'Main menu',
'soundId' => '79',
'waitSeconds' => 5,
'options' => [
'1' => [
[
'id' => '5003',
'type' => 'ringGroup',
'groupId' => '611',
'ringSeconds' => 30,
'onAnswered' => [
],
'onNoAnswer' => [
[
'id' => '5006',
'type' => 'voicemail',
'voicemailBoxId' => '88',
'emailNotification' => 'accountDefault',
'attachRecording' => 'accountDefault'
]
]
]
],
'2' => [
[
'id' => '5004',
'type' => 'voiceAgent',
'voiceAgentId' => '674b87da2a8347e6682cca8d',
'onAnswered' => [
[
'id' => '5008',
'type' => 'conditionSplitter',
'branches' => [
[
'conditions' => [
[
'field' => 'voiceAgent.5004.resolved',
'operator' => 'equals',
'value' => 'false'
]
],
'steps' => [
[
'id' => '5009',
'type' => 'ringGroup',
'groupId' => '568',
'ringSeconds' => 40,
'onAnswered' => [
],
'onNoAnswer' => [
]
]
]
]
],
'otherwise' => [
[
'id' => '5010',
'type' => 'markResolved'
]
]
]
],
'onNoAnswer' => [
[
'id' => '5011',
'type' => 'jumpTo',
'target' => '5003',
'targetNumberId' => '600'
]
]
]
]
],
'noInput' => [
[
'id' => '5005',
'type' => 'jumpTo',
'target' => '5002',
'targetNumberId' => '600'
]
]
]
]
]
],
'otherwise' => [
[
'id' => '5007',
'type' => 'voicemail',
'voicemailBoxId' => '88',
'emailNotification' => 'on',
'attachRecording' => 'off'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate"
payload := strings.NewReader("{\n \"steps\": [\n {\n \"id\": \"5001\",\n \"type\": \"dayTimeSplitter\",\n \"name\": \"Opening hours\",\n \"branches\": [\n {\n \"days\": [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\"\n ],\n \"holidays\": false,\n \"from\": \"08:00\",\n \"to\": \"17:00\",\n \"steps\": [\n {\n \"id\": \"5002\",\n \"type\": \"ivrMenu\",\n \"name\": \"Main menu\",\n \"soundId\": \"79\",\n \"waitSeconds\": 5,\n \"options\": {\n \"1\": [\n {\n \"id\": \"5003\",\n \"type\": \"ringGroup\",\n \"groupId\": \"611\",\n \"ringSeconds\": 30,\n \"onAnswered\": [],\n \"onNoAnswer\": [\n {\n \"id\": \"5006\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"accountDefault\",\n \"attachRecording\": \"accountDefault\"\n }\n ]\n }\n ],\n \"2\": [\n {\n \"id\": \"5004\",\n \"type\": \"voiceAgent\",\n \"voiceAgentId\": \"674b87da2a8347e6682cca8d\",\n \"onAnswered\": [\n {\n \"id\": \"5008\",\n \"type\": \"conditionSplitter\",\n \"branches\": [\n {\n \"conditions\": [\n {\n \"field\": \"voiceAgent.5004.resolved\",\n \"operator\": \"equals\",\n \"value\": \"false\"\n }\n ],\n \"steps\": [\n {\n \"id\": \"5009\",\n \"type\": \"ringGroup\",\n \"groupId\": \"568\",\n \"ringSeconds\": 40,\n \"onAnswered\": [],\n \"onNoAnswer\": []\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5010\",\n \"type\": \"markResolved\"\n }\n ]\n }\n ],\n \"onNoAnswer\": [\n {\n \"id\": \"5011\",\n \"type\": \"jumpTo\",\n \"target\": \"5003\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n },\n \"noInput\": [\n {\n \"id\": \"5005\",\n \"type\": \"jumpTo\",\n \"target\": \"5002\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5007\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"on\",\n \"attachRecording\": \"off\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"steps\": [\n {\n \"id\": \"5001\",\n \"type\": \"dayTimeSplitter\",\n \"name\": \"Opening hours\",\n \"branches\": [\n {\n \"days\": [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\"\n ],\n \"holidays\": false,\n \"from\": \"08:00\",\n \"to\": \"17:00\",\n \"steps\": [\n {\n \"id\": \"5002\",\n \"type\": \"ivrMenu\",\n \"name\": \"Main menu\",\n \"soundId\": \"79\",\n \"waitSeconds\": 5,\n \"options\": {\n \"1\": [\n {\n \"id\": \"5003\",\n \"type\": \"ringGroup\",\n \"groupId\": \"611\",\n \"ringSeconds\": 30,\n \"onAnswered\": [],\n \"onNoAnswer\": [\n {\n \"id\": \"5006\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"accountDefault\",\n \"attachRecording\": \"accountDefault\"\n }\n ]\n }\n ],\n \"2\": [\n {\n \"id\": \"5004\",\n \"type\": \"voiceAgent\",\n \"voiceAgentId\": \"674b87da2a8347e6682cca8d\",\n \"onAnswered\": [\n {\n \"id\": \"5008\",\n \"type\": \"conditionSplitter\",\n \"branches\": [\n {\n \"conditions\": [\n {\n \"field\": \"voiceAgent.5004.resolved\",\n \"operator\": \"equals\",\n \"value\": \"false\"\n }\n ],\n \"steps\": [\n {\n \"id\": \"5009\",\n \"type\": \"ringGroup\",\n \"groupId\": \"568\",\n \"ringSeconds\": 40,\n \"onAnswered\": [],\n \"onNoAnswer\": []\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5010\",\n \"type\": \"markResolved\"\n }\n ]\n }\n ],\n \"onNoAnswer\": [\n {\n \"id\": \"5011\",\n \"type\": \"jumpTo\",\n \"target\": \"5003\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n },\n \"noInput\": [\n {\n \"id\": \"5005\",\n \"type\": \"jumpTo\",\n \"target\": \"5002\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5007\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"on\",\n \"attachRecording\": \"off\"\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudtalk.io/v1/numbers/{numberId}/call-flow/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"steps\": [\n {\n \"id\": \"5001\",\n \"type\": \"dayTimeSplitter\",\n \"name\": \"Opening hours\",\n \"branches\": [\n {\n \"days\": [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\"\n ],\n \"holidays\": false,\n \"from\": \"08:00\",\n \"to\": \"17:00\",\n \"steps\": [\n {\n \"id\": \"5002\",\n \"type\": \"ivrMenu\",\n \"name\": \"Main menu\",\n \"soundId\": \"79\",\n \"waitSeconds\": 5,\n \"options\": {\n \"1\": [\n {\n \"id\": \"5003\",\n \"type\": \"ringGroup\",\n \"groupId\": \"611\",\n \"ringSeconds\": 30,\n \"onAnswered\": [],\n \"onNoAnswer\": [\n {\n \"id\": \"5006\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"accountDefault\",\n \"attachRecording\": \"accountDefault\"\n }\n ]\n }\n ],\n \"2\": [\n {\n \"id\": \"5004\",\n \"type\": \"voiceAgent\",\n \"voiceAgentId\": \"674b87da2a8347e6682cca8d\",\n \"onAnswered\": [\n {\n \"id\": \"5008\",\n \"type\": \"conditionSplitter\",\n \"branches\": [\n {\n \"conditions\": [\n {\n \"field\": \"voiceAgent.5004.resolved\",\n \"operator\": \"equals\",\n \"value\": \"false\"\n }\n ],\n \"steps\": [\n {\n \"id\": \"5009\",\n \"type\": \"ringGroup\",\n \"groupId\": \"568\",\n \"ringSeconds\": 40,\n \"onAnswered\": [],\n \"onNoAnswer\": []\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5010\",\n \"type\": \"markResolved\"\n }\n ]\n }\n ],\n \"onNoAnswer\": [\n {\n \"id\": \"5011\",\n \"type\": \"jumpTo\",\n \"target\": \"5003\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n },\n \"noInput\": [\n {\n \"id\": \"5005\",\n \"type\": \"jumpTo\",\n \"target\": \"5002\",\n \"targetNumberId\": \"600\"\n }\n ]\n }\n ]\n }\n ],\n \"otherwise\": [\n {\n \"id\": \"5007\",\n \"type\": \"voicemail\",\n \"voicemailBoxId\": \"88\",\n \"emailNotification\": \"on\",\n \"attachRecording\": \"off\"\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"valid": false,
"errors": [
{
"code": "CALL_FLOWS.UNKNOWN_GROUP",
"message": "Group 568 is not in your account.",
"target": "/steps/0/branches/0/steps/0/options/2/0/onAnswered/0/branches/0/steps/0/groupId"
}
],
"warnings": [
{
"code": "RING_TIME_BELOW_GROUP_MINIMUM",
"message": "The group rings each agent for 30 seconds. Ring the group for at least 40 seconds.",
"target": "/steps/0/branches/0/steps/0/options/1/0/ringSeconds"
},
{
"code": "JUMP_TARGETS_REMOVED",
"message": "Number 77 has a Jump to step that points at step 5012, which this change removes. That step will be deleted.",
"target": "/steps"
}
],
"changes": {
"added": [],
"updated": [
{
"id": "5003",
"target": "/steps/0/branches/0/steps/0/options/1/0",
"fields": [
"ringSeconds"
]
}
],
"removed": [
{
"id": "5012",
"type": "ringUser"
}
],
"otherNumbers": [
{
"numberId": "77",
"removedJumpToStepIds": [
"4410"
]
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}{
"code": "UNAUTHORIZED",
"message": "You are not authorized to access this resource."
}{
"error": {
"code": "FORBIDDEN",
"message": "This account is not active."
},
"requestId": "3b0e51c7a9"
}{
"error": {
"code": "CALL_FLOWS.NUMBER_NOT_FOUND",
"message": "No number with this id in your account."
},
"requestId": "c41f0a9e2b"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}{
"error": {
"code": "VALIDATION.INVALID_BODY",
"message": "Request body is too large."
},
"requestId": "8c1f4a2e60"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}<string>{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"target": "<string>"
}
],
"target": "<string>"
},
"requestId": "<string>"
}Authorizations
HTTP Basic Authentication. Use your API Access Key ID as the username and your API Access Key Secret as the password. Generate keys in the CloudTalk Dashboard under Account -> Settings -> API Keys (https://dashboard.cloudtalk.io/menu/account/settings/API-keys).
Headers
Path Parameters
The number id, as List and search numbers returns it.
"600"
Body
The whole flow to save. The read-only fields of a read may be sent back and are ignored; any other unknown field is 400 VALIDATION.INVALID_BODY.
1 to 200 steps in the whole flow. Keep a step by sending its id; steps you leave out are deleted, and steps without an id are created. To remove every step, use Delete a number's call flow.
1One step of a call flow. type picks its fields. A step that branches, or that ends the call, is the last in its array. A branch is an array of steps with the same rules.
- Ring user
- Ring favorite user
- Ring group
- Voice agent
- Playback
- Voicemail
- Redirect
- Call recording
- Fax
- Change of caller
- Dial by extension
- IVR menu
- Day/time splitter
- Jump to
- Condition splitter
- HTTP request
- Collect input
- Mark call as resolved
- Unsupported step
Show child attributes
Show child attributes
Response
The result of the check.