Replace draft broadcast payload
Replaces a draft’s complete payload and can schedule it when saveAsDraft is false. Call broadcasts.get to inspect the draft first, or use broadcasts.schedule to keep its payload.
curl --request PUT \
--url https://app.chatbotx.io/api/v1/broadcasts/{id}/draft \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"schedulesAt": "<string>",
"contactFilter": {
"conditions": [
{
"field": "locale",
"value": "<string>"
}
],
"timezone": "<string>"
},
"flowId": "<string>",
"templateId": "<string>",
"integrationWhatsappId": "<string>",
"integrationMessengerId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [
{
"product_retailer_id": "<string>"
}
]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [
{}
],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [
"<unknown>"
]
}
]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
],
"targets": [
{
"inboxId": "<string>",
"flowId": "<string>",
"templateId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [
"<unknown>"
]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [
{
"image": {
"link": "<unknown>"
},
"video": {
"link": "<unknown>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
"<unknown>"
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
"<unknown>"
]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
]
}
],
"inboxIds": [
"<string>"
],
"saveAsDraft": true
}
'import requests
url = "https://app.chatbotx.io/api/v1/broadcasts/{id}/draft"
payload = {
"schedulesAt": "<string>",
"contactFilter": {
"conditions": [
{
"field": "locale",
"value": "<string>"
}
],
"timezone": "<string>"
},
"flowId": "<string>",
"templateId": "<string>",
"integrationWhatsappId": "<string>",
"integrationMessengerId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [{ "product_retailer_id": "<string>" }]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [{}],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": ["<unknown>"]
}
]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
],
"targets": [
{
"inboxId": "<string>",
"flowId": "<string>",
"templateId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": ["<unknown>"]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [
{
"image": { "link": "<unknown>" },
"video": { "link": "<unknown>" }
}
],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": ["<unknown>"],
"thumbnail_product_retailer_id": "<string>",
"sections": ["<unknown>"]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
]
}
],
"inboxIds": ["<string>"],
"saveAsDraft": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schedulesAt: '<string>',
contactFilter: {conditions: [{field: 'locale', value: '<string>'}], timezone: '<string>'},
flowId: '<string>',
templateId: '<string>',
integrationWhatsappId: '<string>',
integrationMessengerId: '<string>',
templateData: {
header: [
{
text: '<string>',
parameter_name: '<string>',
location: {
latitude: '<string>',
longitude: '<string>',
name: '<string>',
address: '<string>'
}
}
],
body: JSON.stringify([{text: '<string>', type: 'text', parameter_name: '<string>'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: [{paramKey: '<string>', customFieldId: '<string>', paramLabel: '<string>'}],
thumbnail_product_retailer_id: '<string>',
sections: [{title: '<string>', product_items: [{product_retailer_id: '<string>'}]}]
}
],
carousel: [
{
card_index: 123,
header: [{}],
body: JSON.stringify([{text: '<string>', type: 'text'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: [{paramKey: '<string>', customFieldId: '<string>', paramLabel: '<string>'}],
thumbnail_product_retailer_id: '<string>',
sections: [{title: '<string>', product_items: ['<unknown>']}]
}
]
}
]
},
buttons: [{id: '<string>', label: '<string>', flowId: '<string>'}],
targets: [
{
inboxId: '<string>',
flowId: '<string>',
templateId: '<string>',
templateData: {
header: [
{
text: '<string>',
parameter_name: '<string>',
location: {
latitude: '<string>',
longitude: '<string>',
name: '<string>',
address: '<string>'
}
}
],
body: JSON.stringify([{text: '<string>', type: 'text', parameter_name: '<string>'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: [{paramKey: '<string>', customFieldId: '<string>', paramLabel: '<string>'}],
thumbnail_product_retailer_id: '<string>',
sections: [{title: '<string>', product_items: ['<unknown>']}]
}
],
carousel: [
{
card_index: 123,
header: [{image: {link: '<unknown>'}, video: {link: '<unknown>'}}],
body: JSON.stringify([{text: '<string>', type: 'text'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: ['<unknown>'],
thumbnail_product_retailer_id: '<string>',
sections: ['<unknown>']
}
]
}
]
},
buttons: [{id: '<string>', label: '<string>', flowId: '<string>'}]
}
],
inboxIds: ['<string>'],
saveAsDraft: true
})
};
fetch('https://app.chatbotx.io/api/v1/broadcasts/{id}/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://app.chatbotx.io/api/v1/broadcasts/{id}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'schedulesAt' => '<string>',
'contactFilter' => [
'conditions' => [
[
'field' => 'locale',
'value' => '<string>'
]
],
'timezone' => '<string>'
],
'flowId' => '<string>',
'templateId' => '<string>',
'integrationWhatsappId' => '<string>',
'integrationMessengerId' => '<string>',
'templateData' => [
'header' => [
[
'text' => '<string>',
'parameter_name' => '<string>',
'location' => [
'latitude' => '<string>',
'longitude' => '<string>',
'name' => '<string>',
'address' => '<string>'
]
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text',
'parameter_name' => '<string>'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
[
'paramKey' => '<string>',
'customFieldId' => '<string>',
'paramLabel' => '<string>'
]
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
[
'title' => '<string>',
'product_items' => [
[
'product_retailer_id' => '<string>'
]
]
]
]
]
],
'carousel' => [
[
'card_index' => 123,
'header' => [
[
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
[
'paramKey' => '<string>',
'customFieldId' => '<string>',
'paramLabel' => '<string>'
]
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
[
'title' => '<string>',
'product_items' => [
'<unknown>'
]
]
]
]
]
]
]
],
'buttons' => [
[
'id' => '<string>',
'label' => '<string>',
'flowId' => '<string>'
]
],
'targets' => [
[
'inboxId' => '<string>',
'flowId' => '<string>',
'templateId' => '<string>',
'templateData' => [
'header' => [
[
'text' => '<string>',
'parameter_name' => '<string>',
'location' => [
'latitude' => '<string>',
'longitude' => '<string>',
'name' => '<string>',
'address' => '<string>'
]
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text',
'parameter_name' => '<string>'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
[
'paramKey' => '<string>',
'customFieldId' => '<string>',
'paramLabel' => '<string>'
]
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
[
'title' => '<string>',
'product_items' => [
'<unknown>'
]
]
]
]
],
'carousel' => [
[
'card_index' => 123,
'header' => [
[
'image' => [
'link' => '<unknown>'
],
'video' => [
'link' => '<unknown>'
]
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
'<unknown>'
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
'<unknown>'
]
]
]
]
]
],
'buttons' => [
[
'id' => '<string>',
'label' => '<string>',
'flowId' => '<string>'
]
]
]
],
'inboxIds' => [
'<string>'
],
'saveAsDraft' => true
]),
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://app.chatbotx.io/api/v1/broadcasts/{id}/draft"
payload := strings.NewReader("{\n \"schedulesAt\": \"<string>\",\n \"contactFilter\": {\n \"conditions\": [\n {\n \"field\": \"locale\",\n \"value\": \"<string>\"\n }\n ],\n \"timezone\": \"<string>\"\n },\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"integrationWhatsappId\": \"<string>\",\n \"integrationMessengerId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n {\n \"product_retailer_id\": \"<string>\"\n }\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {}\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ],\n \"targets\": [\n {\n \"inboxId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {\n \"image\": {\n \"link\": \"<unknown>\"\n },\n \"video\": {\n \"link\": \"<unknown>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n \"<unknown>\"\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ]\n }\n ],\n \"inboxIds\": [\n \"<string>\"\n ],\n \"saveAsDraft\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.chatbotx.io/api/v1/broadcasts/{id}/draft")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"schedulesAt\": \"<string>\",\n \"contactFilter\": {\n \"conditions\": [\n {\n \"field\": \"locale\",\n \"value\": \"<string>\"\n }\n ],\n \"timezone\": \"<string>\"\n },\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"integrationWhatsappId\": \"<string>\",\n \"integrationMessengerId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n {\n \"product_retailer_id\": \"<string>\"\n }\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {}\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ],\n \"targets\": [\n {\n \"inboxId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {\n \"image\": {\n \"link\": \"<unknown>\"\n },\n \"video\": {\n \"link\": \"<unknown>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n \"<unknown>\"\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ]\n }\n ],\n \"inboxIds\": [\n \"<string>\"\n ],\n \"saveAsDraft\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatbotx.io/api/v1/broadcasts/{id}/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schedulesAt\": \"<string>\",\n \"contactFilter\": {\n \"conditions\": [\n {\n \"field\": \"locale\",\n \"value\": \"<string>\"\n }\n ],\n \"timezone\": \"<string>\"\n },\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"integrationWhatsappId\": \"<string>\",\n \"integrationMessengerId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n {\n \"product_retailer_id\": \"<string>\"\n }\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {}\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ],\n \"targets\": [\n {\n \"inboxId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {\n \"image\": {\n \"link\": \"<unknown>\"\n },\n \"video\": {\n \"link\": \"<unknown>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n \"<unknown>\"\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ]\n }\n ],\n \"inboxIds\": [\n \"<string>\"\n ],\n \"saveAsDraft\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "scheduled"
}{
"defined": true,
"code": "businessError",
"status": 400,
"message": "An error occurred while processing your request",
"data": "<unknown>"
}{
"defined": true,
"code": "UNAUTHORIZED",
"status": 401,
"message": "Authentication required",
"data": "<unknown>"
}{
"defined": true,
"code": "FORBIDDEN",
"status": 403,
"message": "You do not have permission to perform this action",
"data": "<unknown>"
}{
"defined": true,
"code": "notFound",
"status": 404,
"message": "Resource not found",
"data": "<unknown>"
}{
"defined": true,
"code": "invalidRequestData",
"status": 422,
"message": "Input validation failed",
"data": {
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}
}{
"defined": true,
"code": "tooManyRequests",
"status": 429,
"message": "Too many requests",
"data": "<unknown>"
}{
"defined": true,
"code": "INTERNAL_SERVER_ERROR",
"status": 500,
"message": "An unexpected error occurred",
"data": "<unknown>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Broadcast id. Get it from broadcasts.list.
^\d+$Body
Channel to send the broadcast over.
omnichannel, webchat, messenger, whatsapp, zalo, smtp, telegram, instagram, threads, tiktok, api Audience sub-action filter.
allContacts, messengerActiveContacts, messengerTemplateMessage, whatsappTemplateMessage, whatsappWithin24Hours, instagramActiveContacts, telegramAllContacts, tiktokActiveContacts When to send: immediately (now) or at schedulesAt (future).
now, future ISO 8601 send time, required when schedulesType is future and not a draft.
Structured filter selecting the recipient audience. See contacts.listFilterFields.
Show child attributes
Show child attributes
Flow id (numeric string) to send. Provide this or templateId, not both.
^\d+$WhatsApp template id (numeric string) to send. Provide this or flowId, not both.
^\d+$WhatsApp integration id (numeric string) to send from.
^\d+$Messenger integration id (numeric string) to send from.
^\d+$Parameters for the WhatsApp template, when sending a single-page broadcast.
- Option 1
- Option 2
Show child attributes
Show child attributes
Button overrides for the WhatsApp template.
Show child attributes
Show child attributes
Per-page targets for a multi-page broadcast, each with its own template/flow.
Show child attributes
Show child attributes
Inbox ids (numeric strings) this broadcast sends from.
^\d+$Save as a draft instead of scheduling/sending immediately.
Was this page helpful?
curl --request PUT \
--url https://app.chatbotx.io/api/v1/broadcasts/{id}/draft \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"schedulesAt": "<string>",
"contactFilter": {
"conditions": [
{
"field": "locale",
"value": "<string>"
}
],
"timezone": "<string>"
},
"flowId": "<string>",
"templateId": "<string>",
"integrationWhatsappId": "<string>",
"integrationMessengerId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [
{
"product_retailer_id": "<string>"
}
]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [
{}
],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [
"<unknown>"
]
}
]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
],
"targets": [
{
"inboxId": "<string>",
"flowId": "<string>",
"templateId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [
"<unknown>"
]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [
{
"image": {
"link": "<unknown>"
},
"video": {
"link": "<unknown>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
"<unknown>"
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
"<unknown>"
]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
]
}
],
"inboxIds": [
"<string>"
],
"saveAsDraft": true
}
'import requests
url = "https://app.chatbotx.io/api/v1/broadcasts/{id}/draft"
payload = {
"schedulesAt": "<string>",
"contactFilter": {
"conditions": [
{
"field": "locale",
"value": "<string>"
}
],
"timezone": "<string>"
},
"flowId": "<string>",
"templateId": "<string>",
"integrationWhatsappId": "<string>",
"integrationMessengerId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": [{ "product_retailer_id": "<string>" }]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [{}],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": ["<unknown>"]
}
]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
],
"targets": [
{
"inboxId": "<string>",
"flowId": "<string>",
"templateId": "<string>",
"templateData": {
"header": [
{
"text": "<string>",
"parameter_name": "<string>",
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
}
}
],
"body": [
{
"text": "<string>",
"type": "text",
"parameter_name": "<string>"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": [
{
"paramKey": "<string>",
"customFieldId": "<string>",
"paramLabel": "<string>"
}
],
"thumbnail_product_retailer_id": "<string>",
"sections": [
{
"title": "<string>",
"product_items": ["<unknown>"]
}
]
}
],
"carousel": [
{
"card_index": 123,
"header": [
{
"image": { "link": "<unknown>" },
"video": { "link": "<unknown>" }
}
],
"body": [
{
"text": "<string>",
"type": "text"
}
],
"button": [
{
"index": 123,
"text": "<string>",
"coupon_code": "<string>",
"payload": "<string>",
"flow_token": "<string>",
"flow_action_data": {},
"flowSourceId": "<string>",
"navigateScreenId": "<string>",
"fieldMappings": ["<unknown>"],
"thumbnail_product_retailer_id": "<string>",
"sections": ["<unknown>"]
}
]
}
]
},
"buttons": [
{
"id": "<string>",
"label": "<string>",
"flowId": "<string>"
}
]
}
],
"inboxIds": ["<string>"],
"saveAsDraft": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schedulesAt: '<string>',
contactFilter: {conditions: [{field: 'locale', value: '<string>'}], timezone: '<string>'},
flowId: '<string>',
templateId: '<string>',
integrationWhatsappId: '<string>',
integrationMessengerId: '<string>',
templateData: {
header: [
{
text: '<string>',
parameter_name: '<string>',
location: {
latitude: '<string>',
longitude: '<string>',
name: '<string>',
address: '<string>'
}
}
],
body: JSON.stringify([{text: '<string>', type: 'text', parameter_name: '<string>'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: [{paramKey: '<string>', customFieldId: '<string>', paramLabel: '<string>'}],
thumbnail_product_retailer_id: '<string>',
sections: [{title: '<string>', product_items: [{product_retailer_id: '<string>'}]}]
}
],
carousel: [
{
card_index: 123,
header: [{}],
body: JSON.stringify([{text: '<string>', type: 'text'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: [{paramKey: '<string>', customFieldId: '<string>', paramLabel: '<string>'}],
thumbnail_product_retailer_id: '<string>',
sections: [{title: '<string>', product_items: ['<unknown>']}]
}
]
}
]
},
buttons: [{id: '<string>', label: '<string>', flowId: '<string>'}],
targets: [
{
inboxId: '<string>',
flowId: '<string>',
templateId: '<string>',
templateData: {
header: [
{
text: '<string>',
parameter_name: '<string>',
location: {
latitude: '<string>',
longitude: '<string>',
name: '<string>',
address: '<string>'
}
}
],
body: JSON.stringify([{text: '<string>', type: 'text', parameter_name: '<string>'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: [{paramKey: '<string>', customFieldId: '<string>', paramLabel: '<string>'}],
thumbnail_product_retailer_id: '<string>',
sections: [{title: '<string>', product_items: ['<unknown>']}]
}
],
carousel: [
{
card_index: 123,
header: [{image: {link: '<unknown>'}, video: {link: '<unknown>'}}],
body: JSON.stringify([{text: '<string>', type: 'text'}]),
button: [
{
index: 123,
text: '<string>',
coupon_code: '<string>',
payload: '<string>',
flow_token: '<string>',
flow_action_data: {},
flowSourceId: '<string>',
navigateScreenId: '<string>',
fieldMappings: ['<unknown>'],
thumbnail_product_retailer_id: '<string>',
sections: ['<unknown>']
}
]
}
]
},
buttons: [{id: '<string>', label: '<string>', flowId: '<string>'}]
}
],
inboxIds: ['<string>'],
saveAsDraft: true
})
};
fetch('https://app.chatbotx.io/api/v1/broadcasts/{id}/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://app.chatbotx.io/api/v1/broadcasts/{id}/draft",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'schedulesAt' => '<string>',
'contactFilter' => [
'conditions' => [
[
'field' => 'locale',
'value' => '<string>'
]
],
'timezone' => '<string>'
],
'flowId' => '<string>',
'templateId' => '<string>',
'integrationWhatsappId' => '<string>',
'integrationMessengerId' => '<string>',
'templateData' => [
'header' => [
[
'text' => '<string>',
'parameter_name' => '<string>',
'location' => [
'latitude' => '<string>',
'longitude' => '<string>',
'name' => '<string>',
'address' => '<string>'
]
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text',
'parameter_name' => '<string>'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
[
'paramKey' => '<string>',
'customFieldId' => '<string>',
'paramLabel' => '<string>'
]
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
[
'title' => '<string>',
'product_items' => [
[
'product_retailer_id' => '<string>'
]
]
]
]
]
],
'carousel' => [
[
'card_index' => 123,
'header' => [
[
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
[
'paramKey' => '<string>',
'customFieldId' => '<string>',
'paramLabel' => '<string>'
]
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
[
'title' => '<string>',
'product_items' => [
'<unknown>'
]
]
]
]
]
]
]
],
'buttons' => [
[
'id' => '<string>',
'label' => '<string>',
'flowId' => '<string>'
]
],
'targets' => [
[
'inboxId' => '<string>',
'flowId' => '<string>',
'templateId' => '<string>',
'templateData' => [
'header' => [
[
'text' => '<string>',
'parameter_name' => '<string>',
'location' => [
'latitude' => '<string>',
'longitude' => '<string>',
'name' => '<string>',
'address' => '<string>'
]
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text',
'parameter_name' => '<string>'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
[
'paramKey' => '<string>',
'customFieldId' => '<string>',
'paramLabel' => '<string>'
]
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
[
'title' => '<string>',
'product_items' => [
'<unknown>'
]
]
]
]
],
'carousel' => [
[
'card_index' => 123,
'header' => [
[
'image' => [
'link' => '<unknown>'
],
'video' => [
'link' => '<unknown>'
]
]
],
'body' => [
[
'text' => '<string>',
'type' => 'text'
]
],
'button' => [
[
'index' => 123,
'text' => '<string>',
'coupon_code' => '<string>',
'payload' => '<string>',
'flow_token' => '<string>',
'flow_action_data' => [
],
'flowSourceId' => '<string>',
'navigateScreenId' => '<string>',
'fieldMappings' => [
'<unknown>'
],
'thumbnail_product_retailer_id' => '<string>',
'sections' => [
'<unknown>'
]
]
]
]
]
],
'buttons' => [
[
'id' => '<string>',
'label' => '<string>',
'flowId' => '<string>'
]
]
]
],
'inboxIds' => [
'<string>'
],
'saveAsDraft' => true
]),
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://app.chatbotx.io/api/v1/broadcasts/{id}/draft"
payload := strings.NewReader("{\n \"schedulesAt\": \"<string>\",\n \"contactFilter\": {\n \"conditions\": [\n {\n \"field\": \"locale\",\n \"value\": \"<string>\"\n }\n ],\n \"timezone\": \"<string>\"\n },\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"integrationWhatsappId\": \"<string>\",\n \"integrationMessengerId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n {\n \"product_retailer_id\": \"<string>\"\n }\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {}\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ],\n \"targets\": [\n {\n \"inboxId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {\n \"image\": {\n \"link\": \"<unknown>\"\n },\n \"video\": {\n \"link\": \"<unknown>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n \"<unknown>\"\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ]\n }\n ],\n \"inboxIds\": [\n \"<string>\"\n ],\n \"saveAsDraft\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.chatbotx.io/api/v1/broadcasts/{id}/draft")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"schedulesAt\": \"<string>\",\n \"contactFilter\": {\n \"conditions\": [\n {\n \"field\": \"locale\",\n \"value\": \"<string>\"\n }\n ],\n \"timezone\": \"<string>\"\n },\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"integrationWhatsappId\": \"<string>\",\n \"integrationMessengerId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n {\n \"product_retailer_id\": \"<string>\"\n }\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {}\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ],\n \"targets\": [\n {\n \"inboxId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {\n \"image\": {\n \"link\": \"<unknown>\"\n },\n \"video\": {\n \"link\": \"<unknown>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n \"<unknown>\"\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ]\n }\n ],\n \"inboxIds\": [\n \"<string>\"\n ],\n \"saveAsDraft\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.chatbotx.io/api/v1/broadcasts/{id}/draft")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schedulesAt\": \"<string>\",\n \"contactFilter\": {\n \"conditions\": [\n {\n \"field\": \"locale\",\n \"value\": \"<string>\"\n }\n ],\n \"timezone\": \"<string>\"\n },\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"integrationWhatsappId\": \"<string>\",\n \"integrationMessengerId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n {\n \"product_retailer_id\": \"<string>\"\n }\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {}\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ],\n \"targets\": [\n {\n \"inboxId\": \"<string>\",\n \"flowId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"templateData\": {\n \"header\": [\n {\n \"text\": \"<string>\",\n \"parameter_name\": \"<string>\",\n \"location\": {\n \"latitude\": \"<string>\",\n \"longitude\": \"<string>\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\",\n \"parameter_name\": \"<string>\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n {\n \"paramKey\": \"<string>\",\n \"customFieldId\": \"<string>\",\n \"paramLabel\": \"<string>\"\n }\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n {\n \"title\": \"<string>\",\n \"product_items\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ],\n \"carousel\": [\n {\n \"card_index\": 123,\n \"header\": [\n {\n \"image\": {\n \"link\": \"<unknown>\"\n },\n \"video\": {\n \"link\": \"<unknown>\"\n }\n }\n ],\n \"body\": [\n {\n \"text\": \"<string>\",\n \"type\": \"text\"\n }\n ],\n \"button\": [\n {\n \"index\": 123,\n \"text\": \"<string>\",\n \"coupon_code\": \"<string>\",\n \"payload\": \"<string>\",\n \"flow_token\": \"<string>\",\n \"flow_action_data\": {},\n \"flowSourceId\": \"<string>\",\n \"navigateScreenId\": \"<string>\",\n \"fieldMappings\": [\n \"<unknown>\"\n ],\n \"thumbnail_product_retailer_id\": \"<string>\",\n \"sections\": [\n \"<unknown>\"\n ]\n }\n ]\n }\n ]\n },\n \"buttons\": [\n {\n \"id\": \"<string>\",\n \"label\": \"<string>\",\n \"flowId\": \"<string>\"\n }\n ]\n }\n ],\n \"inboxIds\": [\n \"<string>\"\n ],\n \"saveAsDraft\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "scheduled"
}{
"defined": true,
"code": "businessError",
"status": 400,
"message": "An error occurred while processing your request",
"data": "<unknown>"
}{
"defined": true,
"code": "UNAUTHORIZED",
"status": 401,
"message": "Authentication required",
"data": "<unknown>"
}{
"defined": true,
"code": "FORBIDDEN",
"status": 403,
"message": "You do not have permission to perform this action",
"data": "<unknown>"
}{
"defined": true,
"code": "notFound",
"status": 404,
"message": "Resource not found",
"data": "<unknown>"
}{
"defined": true,
"code": "invalidRequestData",
"status": 422,
"message": "Input validation failed",
"data": {
"issues": [
{
"message": "<string>",
"path": [
"<string>"
]
}
]
}
}{
"defined": true,
"code": "tooManyRequests",
"status": 429,
"message": "Too many requests",
"data": "<unknown>"
}{
"defined": true,
"code": "INTERNAL_SERVER_ERROR",
"status": 500,
"message": "An unexpected error occurred",
"data": "<unknown>"
}