{"openapi":"3.1.2","info":{"title":"WhatsApp service API","description":"Using the API for WhatsApp chatbots, you can integrate your system with SendPulse\u2019s chatbots service and get detailed information about your account, bots, subscribers, variables, flows, and chats. You can also create campaigns, launch flows, assign and remove variables and tags.\n\n\nOn the right, there is a button for authorizing requests made on this page. Click \u201cAuthorize,\u201d then insert the ID and Secret from your account.\n\n\nTo perform a request directly from the page, click the \"Try it out\" button within each method block. Then fill in input fields if any (for URL parameters, the description is right below the URL request; for body parameters, the description is under the \u201cScheme\u201d button to the right of the example), and click \u201cRun.\u201d You'll find the server response and description of received parameters below.\n        ","version":"1.0.0"},"servers":[{"url":"https:\/\/api.sendpulse.com\/whatsapp","description":"SendPulse production API server"}],"security":[{"apiKey":[]}],"tags":[{"name":"account","description":"Account information: pricing plan limits and usage statistics"},{"name":"bots","description":"Connected WhatsApp bots and their statistics"},{"name":"contacts","description":"Bot contacts (subscribers): search and create contacts, send messages and templates, manage tags, variables, notes, operators, and chat state"},{"name":"variables","description":"Bot variables"},{"name":"flows","description":"Bot flows and running them for a contact"},{"name":"triggers","description":"Triggers (keywords and events) that start flows"},{"name":"chats","description":"Chats with contacts and their message history"},{"name":"campaigns","description":"Campaigns (broadcasts) sent to bot contacts"},{"name":"tags","description":"Contact tags of a bot"},{"name":"templates","description":"WhatsApp message templates of a bot"}],"paths":{"\/contacts\/get":{"get":{"operationId":"getContact","summary":"Get contact info via a contact ID","description":"Returns information on the selected contact: bot and contact ID, information from messenger, list of tags and variables, activity data and date added","tags":["contacts"],"parameters":[{"in":"query","name":"id","required":true,"description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContactResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts":{"post":{"operationId":"createContact","summary":"Create a contact","description":"Creates a contact in the bot by phone number. Unlike other endpoints, the response body is the contact object itself, without the `success`\/`data` envelope.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["phone","bot_id"],"properties":{"phone":{"type":"string","description":"Contact phone number in international format, digits only","examples":["380931234567"]},"bot_id":{"type":"string","description":"Bot ID","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"name":{"type":["string","null"],"description":"Contact name","examples":["John Doe"]},"tags":{"type":"array","description":"Contact tags","maxItems":100,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":32},"examples":[["vip","newsletter"]]},"variables":{"type":"array","description":"Contact variables","maxItems":100,"items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string","description":"Variable name","examples":["city"]},"value":{"$ref":"#\/components\/schemas\/VariableValue"}}}}}},"example":{"phone":"380931234567","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","name":"John Doe","tags":["vip"],"variables":[{"name":"city","value":"Kyiv"}]}}}},"responses":{"200":{"description":"Contact created successfully","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Contact"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/getByPhone":{"get":{"operationId":"getContactByPhone","summary":"Get contact info by phone number","description":"Returns information on the selected contact: bot and contact ID, information from messenger, list of tags and variables, activity data and date added","tags":["contacts"],"parameters":[{"in":"query","name":"phone","required":true,"description":"Contact phone number in international format, digits only","schema":{"type":"string"},"example":"380931234567"},{"in":"query","name":"bot_id","required":true,"description":"Bot ID","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f0"}],"responses":{"200":{"description":"Contact data","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContactResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/getByTag":{"get":{"operationId":"getContactsByTag","summary":"Get a list of contacts by tag","description":"Returns a list of contacts by tag for the specified bot","tags":["contacts"],"parameters":[{"in":"query","name":"tag","required":true,"description":"Created contact\u2019s tag to search by","schema":{"type":"string","minLength":1,"maxLength":32},"example":"vip"},{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContactPageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/getByVariable":{"get":{"operationId":"getContactsByVariable","summary":"Get contacts by variable","description":"Returns contacts by variable identifier or variable name for the specified bot","tags":["contacts"],"parameters":[{"in":"query","name":"variable_id","required":false,"description":"Contact\u2019s variable ID to search by; required parameter if you do not pass variable_name and bot_id.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"in":"query","name":"variable_name","required":false,"description":"Contact\u2019s variable name to search by; required parameter and passed with the bot_id parameter, if you do not pass variable_id.","schema":{"type":"string","minLength":1,"maxLength":255},"example":"city"},{"in":"query","name":"bot_id","required":false,"description":"Bot ID; required parameter and passed with the variable_name parameter, if you do not pass variable_id. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"in":"query","name":"variable_value","required":true,"description":"Contact's variable value","schema":{"type":"string"},"example":"Kyiv"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContactPageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/send":{"post":{"operationId":"sendMessage","summary":"Send a message to a contact","description":"Sends a text message, image, or a file to a contact. Address the contact either by its contact ID, or - for contacts that have no phone number, for example the ones that wrote to you from WhatsApp business calling or a \"Click to WhatsApp\" flow - by bot ID and business-scoped user ID (BSUID). To view an example of the request body, select a message type from the drop-down list.\n\n You can also use the original data structures specified in Meta\\'s documentation https:\/\/developers.facebook.com\/docs\/whatsapp\/cloud-api\/guides\/send-messages by specifying the correct 'type' and the corresponding data structure for that type.","tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","description":"Bot ID. Required when the contact is addressed by BSUID, because a BSUID is only unique within a bot.","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"bsuid":{"type":"string","examples":["US.13491208655302741918"],"description":"Contact's business-scoped user ID: an ISO 3166 alpha-2 country code and a period, followed by up to 128 alphanumeric characters, for example US.13491208655302741918. An alternative to contact_id for contacts that have no phone number."},"message":{"type":"object","description":"Message to send, specifying the type and content of the campaign","properties":{"type":{"type":"string","enum":["text","image","document","audio","video","interactive"],"description":"Message type, can have the values \"text,\" \"image,\" or \"document\"","examples":["text"]},"text":{"type":"object","properties":{"body":{"type":"string","description":"The content of the text message. You can add text with emoji of up to 1024 unicode characters.","examples":["Hello!"]}},"required":["body"]},"image":{"$ref":"#\/components\/schemas\/WaImageMessage"},"document":{"$ref":"#\/components\/schemas\/WaDocumentMessage"},"audio":{"$ref":"#\/components\/schemas\/WaAudioMessage"},"video":{"type":"object","description":"The video you want to send. Includes the URL to the video","properties":{"link":{"type":"string","description":"Full HTTPS URL of the video file you want to send. Only SSL-secured links are allowed.","examples":["https:\/\/www.example.com\/video.mp4"]},"caption":{"type":["string","null"],"description":"Caption for the video (max 1024 characters)","examples":["Example caption"]}},"required":["link"]},"interactive":{"$ref":"#\/components\/schemas\/WaInteractiveMessage"},"reply_to":{"type":"object","description":"Reply to a specific message","properties":{"message_id":{"type":"string","description":"WhatsApp message ID to reply to","examples":["wamid.HBgMMzgwNjcxMjM0NTY3FQIAERgSNTk3RjQyRkI2QzE0QjQ4RUY2AA=="]}},"required":["message_id"]}},"required":["type"]}},"required":["message"],"oneOf":[{"required":["contact_id"]},{"required":["bot_id","bsuid"]}]},"examples":{"Send a text message":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"text","text":{"body":"Hello!"}}}},"Send a text message with reply_to":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"text","text":{"body":"Hello!"},"reply_to":{"message_id":"wamid.HBgMMzgwOTAwMDAwMDAwFgUyAgESGAEwMDAwMDAwMDAwMDAwMDAwMDAwMA=="}}}},"Send a text message by BSUID":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","bsuid":"US.13491208655302741918","message":{"type":"text","text":{"body":"Hello!"}}}},"Send a message with an image":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"image","image":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}}},"Send a message with a file":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"document","document":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}}},"Send a message with audio":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"audio","audio":{"link":"https:\/\/www.example.com\/file.pdf","voice":true}}}},"Send a message with a video":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"video","video":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}}},"Send a message with payload button":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"interactive","interactive":{"type":"button","body":{"text":"Example text"},"action":{"buttons":[{"type":"reply","to_chain_id":"60c9d4b8e0f3b2a1c4d5e6f8","reply":{"title":"Example payload button"}}]}}}}},"Send a message with a carousel":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message":{"type":"interactive","interactive":{"type":"carousel","action":{"cards":[{"type":"cta_url","header":{"type":"image","image":{"link":"https:\/\/www.example.com\/image1.jpg"}},"body":{"text":"First card description"},"action":{"name":"cta_url","parameters":{"display_text":"Open","url":"https:\/\/www.example.com\/1"}}},{"type":"cta_url","header":{"type":"image","image":{"link":"https:\/\/www.example.com\/image2.jpg"}},"body":{"text":"Second card description"},"action":{"name":"cta_url","parameters":{"display_text":"Open","url":"https:\/\/www.example.com\/2"}}}]}}}}}}}}},"responses":{"200":{"description":"The sent message. If sending fails because of an unexpected error, the endpoint still responds with HTTP 200, `data: false`, and `message: \"Internal error\"`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageResponse"}}}},"400":{"$ref":"#\/components\/responses\/WaSendFailed"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"402":{"$ref":"#\/components\/responses\/PaymentRequired"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/sendByPhone":{"post":{"operationId":"sendMessageByPhone","summary":"Send a free message to a contact by phone number","description":"Sends a message to the active contact with the specified phone number. You can send a text message, an image, or a file. To view an example of the request body, select a message type from the drop-down list","tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"bot_id":{"type":"string","description":"Bot ID to whose audience you are sending a message. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"phone":{"type":"string","examples":["380631112233"],"description":"Contact's phone number in international format."},"message":{"type":"object","description":"Message to send, specifying the type and content of the campaign","properties":{"type":{"type":"string","enum":["text","image","document","audio","interactive"],"description":"Message type, can have the values \"text,\" \"image,\" or \"document\"","examples":["text"]},"text":{"type":"object","properties":{"body":{"type":"string","description":"The content of the text message. You can add text with emoji of up to 1024 unicode characters.","examples":["Hello!"]}},"required":["body"]},"image":{"$ref":"#\/components\/schemas\/WaImageMessage"},"document":{"$ref":"#\/components\/schemas\/WaDocumentMessage"},"audio":{"$ref":"#\/components\/schemas\/WaAudioMessage"},"interactive":{"$ref":"#\/components\/schemas\/WaInteractiveMessage"},"reply_to":{"type":"object","description":"Reply to a specific message","properties":{"message_id":{"type":"string","description":"WhatsApp message ID to reply to","examples":["wamid.HBgMMzgwNjcxMjM0NTY3FQIAERgSNTk3RjQyRkI2QzE0QjQ4RUY2AA=="]}},"required":["message_id"]}},"required":["type"]}},"required":["bot_id","phone","message"]},"examples":{"Send a text message":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","message":{"type":"text","text":{"body":"Hello!"}}}},"Send a message with an image":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","message":{"type":"image","image":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}}},"Send a message with a file":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","message":{"type":"document","document":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}}},"Send a message with audio":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","message":{"type":"audio","audio":{"link":"https:\/\/www.example.com\/file.pdf","voice":true}}}},"Send a message with payload button":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","message":{"type":"interactive","interactive":{"type":"button","body":{"text":"Example text"},"action":{"buttons":[{"type":"reply","to_chain_id":"60c9d4b8e0f3b2a1c4d5e6f8","reply":{"title":"Example payload button"}}]}}}}},"Send a message with a carousel":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","message":{"type":"interactive","interactive":{"type":"carousel","action":{"cards":[{"type":"cta_url","header":{"type":"image","image":{"link":"https:\/\/www.example.com\/image1.jpg"}},"body":{"text":"First card description"},"action":{"name":"cta_url","parameters":{"display_text":"Open","url":"https:\/\/www.example.com\/1"}}},{"type":"cta_url","header":{"type":"image","image":{"link":"https:\/\/www.example.com\/image2.jpg"}},"body":{"text":"Second card description"},"action":{"name":"cta_url","parameters":{"display_text":"Open","url":"https:\/\/www.example.com\/2"}}}]}}}}}}}}},"responses":{"200":{"description":"The sent message; `redirected_from_contact_id` is set when the message was sent to another contact with the same phone number. If sending fails because of an unexpected error, the endpoint still responds with HTTP 200, `data: false`, and `message: \"Internal error\"`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageResponse"}}}},"400":{"$ref":"#\/components\/responses\/WaSendFailed"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"402":{"$ref":"#\/components\/responses\/PaymentRequired"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/sendTemplate":{"post":{"operationId":"sendTemplateMessage","summary":"Send a template message to the specified contact","description":"Sends a pre-approved template message to the contact with the specified contact ID. You can send a template with variables, buttons, image, or document headers. To view an example of the request body, select a message template from the drop-down list.","tags":["contacts"],"requestBody":{"description":"Sends a pre-approved template message to the contact with the specified contact ID. You can send a template with variables, buttons, image, or document headers. To view an example of the request body, select a message template from the drop-down list.","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","description":"Bot ID. Required when the contact is addressed by BSUID, because a BSUID is only unique within a bot.","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"bsuid":{"type":"string","examples":["US.13491208655302741918"],"description":"Contact's business-scoped user ID: an ISO 3166 alpha-2 country code and a period, followed by up to 128 alphanumeric characters, for example US.13491208655302741918. An alternative to contact_id for contacts that have no phone number."},"template":{"$ref":"#\/components\/schemas\/WaTemplateInput"}},"required":["template"],"oneOf":[{"required":["contact_id"]},{"required":["bot_id","bsuid"]}]},"examples":{"Send a simple template message":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","template":{"name":"thanks_for_buying","language":{"code":"en"},"components":[]}}},"Send a template by BSUID":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","bsuid":"US.13491208655302741918","template":{"name":"thanks_for_buying","language":{"code":"en"},"components":[]}}},"Send a template message with variables":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","template":{"name":"thanks_for_buying_personal","language":{"code":"en"},"components":[{"type":"body","parameters":[{"type":"text","text":"Firstname"},{"type":"text","text":"Secondname"}]}]}}},"Send a template message with an image":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","template":{"name":"thanks_for_buying_image","language":{"code":"en"},"components":[{"type":"header","parameters":[{"type":"image","image":{"link":"https:\/\/www.example.com\/image.jpg"}}]}]}}},"Send a template message with a document":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","template":{"name":"thanks_for_buying_document","language":{"code":"en"},"components":[{"type":"header","parameters":[{"type":"document","document":{"link":"https:\/\/www.example.com\/file.zip","filename":"file.zip"}}]}]}}},"Send a template message with a video":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","template":{"name":"thanks_for_buying_video","language":{"code":"en"},"components":[{"type":"header","parameters":[{"type":"video","video":{"link":"https:\/\/www.example.com\/video.mov"}}]}]}}},"Send a template message with payload buttons":{"value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","template":{"name":"thanks_for_buying_image","language":{"code":"en"},"components":[{"type":"body","parameters":[{"type":"text","text":"some text"}]},{"type":"button","sub_type":"quick_reply","index":0,"parameters":[{"type":"payload","payload":{"to_chain_id":"60c9d4b8e0f3b2a1c4d5e6f8"}}]}]}}}}}}},"responses":{"200":{"description":"The sent template message","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageResponse"}}}},"400":{"$ref":"#\/components\/responses\/WaSendFailed"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"402":{"$ref":"#\/components\/responses\/PaymentRequired"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"},"500":{"$ref":"#\/components\/responses\/WaInternalError"}}}},"\/contacts\/sendTemplateByPhone":{"post":{"operationId":"sendTemplateMessageByPhone","summary":"Send a template message to a contact by phone number","description":"Sends a pre-approved template message to a new or existing contact with the specified phone number. You can send a template with variables, buttons, image, or document headers. To view an example of the request body, select a message template from the drop-down list","tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"bot_id":{"type":"string","description":"Bot ID to whose audience you are sending a message. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"phone":{"type":"string","description":"Contact's phone number in international format.","examples":["+380671234567"]},"template":{"$ref":"#\/components\/schemas\/WaTemplateInput"}},"required":["bot_id","phone","template"]},"examples":{"Send a simple template message":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","template":{"name":"thanks_for_buying","language":{"code":"en"},"components":[]}}},"Send a template message with variables":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","template":{"name":"thanks_for_buying_personal","language":{"code":"en"},"components":[{"type":"body","parameters":[{"type":"text","text":"Firstname"},{"type":"text","text":"Secondname"}]}]}}},"Send a template message with an image":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","template":{"name":"thanks_for_buying_image","language":{"code":"en"},"components":[{"type":"header","parameters":[{"type":"image","image":{"link":"https:\/\/www.example.com\/image.jpg"}}]}]}}},"Send a template message with a document":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","template":{"name":"thanks_for_buying_document","language":{"code":"en"},"components":[{"type":"header","parameters":[{"type":"document","document":{"link":"https:\/\/www.example.com\/file.zip","filename":"file.zip"}}]}]}}},"Send a template message with a video":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","template":{"name":"thanks_for_buying_video","language":{"code":"en"},"components":[{"type":"header","parameters":[{"type":"video","video":{"link":"https:\/\/www.example.com\/video.mp4"}}]}]}}},"Send a template message with payload buttons":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","phone":"380931112233","template":{"name":"thanks_for_buying_image","language":{"code":"en"},"components":[{"type":"body","parameters":[{"type":"text","text":"some text"}]},{"type":"button","sub_type":"quick_reply","index":0,"parameters":[{"type":"payload","payload":{"to_chain_id":"60c9d4b8e0f3b2a1c4d5e6f8"}}]}]}}}}}}},"responses":{"200":{"description":"The sent message; `redirected_from_contact_id` is set when the message was sent to another contact with the same phone number. If sending fails because of an unexpected error, the endpoint still responds with HTTP 200, `data: false`, and `message: \"Internal error\"`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageResponse"}}}},"400":{"$ref":"#\/components\/responses\/WaSendFailed"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"402":{"$ref":"#\/components\/responses\/PaymentRequired"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/sendTyping":{"post":{"operationId":"sendTyping","summary":"Show the typing indicator","description":"Shows the typing indicator to the contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"`data` is `true` when the indicator was sent. On an internal error the endpoint responds with HTTP 200, `data: false`, and `message: \"Internal error\"`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/react":{"post":{"operationId":"reactToMessage","summary":"React to a message","description":"Sets or removes a reaction on a contact's message. Any emoji supported by WhatsApp can be used. To remove a previously set reaction, pass `\"reaction\": null` or omit the `reaction` field.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","message_id"],"properties":{"contact_id":{"type":"string","description":"The ID of the contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"message_id":{"type":"string","description":"The ID of the message to react to.","examples":["60c9d4b8e0f3b2a1c4d5e6f9"]},"reaction":{"type":["object","null"],"description":"Object with reaction details. Pass `null` or omit it to remove a previously set reaction.","required":["emoji"],"properties":{"emoji":{"type":"string","description":"The emoji to react with, for example \u2764\ufe0f or \ud83d\udc4d.","examples":["\ud83d\udc4d"]}}}}},"example":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","message_id":"60c9d4b8e0f3b2a1c4d5e6f9","reaction":{"emoji":"\ud83d\udc4d"}}}}},"responses":{"200":{"description":"`data` is `true` when the reaction was set or removed","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/WaSendFailed"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/setVariable":{"post":{"operationId":"setContactVariable","summary":"Assign a variable to contact","description":"Adds or updates the value of a variable for the selected contact.","tags":["contacts"],"requestBody":{"description":"Choose one of the available request bodies","required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"variables":{"type":"array","description":"List of variables to set; use instead of the single `variable_id`\/`variable_name` and `variable_value` fields","items":{"$ref":"#\/components\/schemas\/ContactVariableInput"}}}},"examples":{"by_var_name":{"summary":"Set by variable name","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","variables":[{"variable_name":"city","variable_value":"Kyiv"},{"variable_name":"age","variable_value":30}]}},"by_var_id":{"summary":"Set by variable ID","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","variables":[{"variable_id":"60c9d4b8e0f3b2a1c4d5e6fa","variable_value":"Kyiv"}]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/deleteVariable":{"post":{"operationId":"deleteContactVariable","summary":"Delete a variable from the selected contact","description":"Delete the value of a variable for the selected contact.","tags":["contacts"],"requestBody":{"description":"Choose one of the available request bodies","required":true,"content":{"application\/json":{"schema":{"type":"object","description":"Pass exactly one of `variable_ids` or `variable_names`","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"variable_ids":{"type":"array","maxItems":100,"description":"Variable IDs to delete","items":{"type":"string"},"examples":[["60c9d4b8e0f3b2a1c4d5e6fa","60c9d4b8e0f3b2a1c4d5e6fb"]]},"variable_names":{"type":"array","maxItems":100,"description":"Variable names to delete","items":{"type":"string","maxLength":255},"examples":[["city","age"]]}}},"examples":{"by_var_id":{"summary":"Delete by variable ID","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","variable_ids":["60c9d4b8e0f3b2a1c4d5e6fa","60c9d4b8e0f3b2a1c4d5e6fb"]}},"by_var_name":{"summary":"Delete by variable name","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","variable_names":["city","age"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/setTag":{"post":{"operationId":"setContactTags","summary":"Assign a tag to contact","description":"Assigns tags to the selected contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","tags"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"tags":{"type":"array","minItems":1,"maxItems":100,"description":"List of tags to assign to the contact","items":{"type":"string","minLength":1,"maxLength":32},"examples":[["vip","newsletter"]]}}}}}},"responses":{"200":{"description":"`data` is the number of tags newly added to the contact","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/IntegerResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/deleteTag":{"post":{"operationId":"deleteContactTag","summary":"Remove a tag from a contact","description":"Removes the tag for the selected contact.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","tag"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"tag":{"type":"string","minLength":1,"maxLength":32,"description":"Tag you want to remove","examples":["vip"]}}}}}},"responses":{"200":{"description":"`data` is the number of tags removed from the contact (`0` or `1`)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/IntegerResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/disable":{"post":{"operationId":"disableContact","summary":"Disable contact","description":"Disables a contact in your audience list. Campaigns and autoflows will not be sent to this contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/enable":{"post":{"operationId":"enableContact","summary":"Enable contact","description":"Enables a contact in the audience list, and the contact starts receiving campaigns and autoflows","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/delete":{"post":{"operationId":"deleteContact","summary":"Delete contact","description":"Removes a contact from the audience and subscribers list. The contact can be added back only by subscribing to the bot.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/getPauseAutomation":{"get":{"operationId":"getContactPauseAutomation","summary":"Get remaining time for automation pause","description":"Returns the time remaining until autoflows resume for this contact","tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","required":true,"description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"`data` is the date and time until which automation is paused, or `null` when it is not paused","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/NullableDateTimeResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/setPauseAutomation":{"post":{"operationId":"setContactPauseAutomation","summary":"Pause autoflows for a contact","description":"Pauses autoflows for the specified contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"minutes":{"type":"integer","minimum":1,"maximum":120,"description":"Minutes","examples":[60]}}}}}},"responses":{"200":{"description":"`data` is the date and time until which automation is paused","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/DateTimeResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/deletePauseAutomation":{"post":{"operationId":"deleteContactPauseAutomation","summary":"Resume autoflows for a contact","description":"Resumes autoflows for the specified contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/notes":{"get":{"operationId":"getContactNotes","summary":"Get a list of contact's operator notes","description":"Returns a list of existing operator notes by contact","tags":["contacts"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"in":"query","name":"contact_id","required":true,"description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"Operator notes of the contact, newest first (up to 500)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/OperatorNoteListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/createNote":{"post":{"operationId":"createContactNote","summary":"Send an operator note","description":"Sends an operator note about a contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","bot_id","text"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"text":{"type":"string","minLength":1,"maxLength":2000,"description":"Text of note","examples":["Customer asked to call back tomorrow"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/OperatorNoteResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/updateNote":{"post":{"operationId":"updateContactNote","summary":"Update operator note","description":"Updates an existing operator note about a contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","bot_id","text","note_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"text":{"type":"string","minLength":1,"maxLength":2000,"description":"Text of note","examples":["Customer asked to call back on Monday"]},"note_id":{"type":"string","description":"Note ID.","examples":["60c9d4b8e0f3b2a1c4d5e6fc"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/OperatorNoteResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/deleteNote":{"post":{"operationId":"deleteContactNote","summary":"Delete operator note","description":"Deletes an existing operator note about a contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","bot_id","note_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"note_id":{"type":"string","description":"Note ID.","examples":["60c9d4b8e0f3b2a1c4d5e6fc"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/OperatorNoteResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/operators\/assign":{"post":{"operationId":"assignContactOperator","summary":"Assign a responsible operator to the chat.","description":"Sets the specified operator as responsible for the chat. You can find the operator's ID in the https:\/\/login.sendpulse.com\/settings\/#users section.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","operator_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"operator_id":{"type":"integer","minimum":1,"description":"The ID of the operator to assign","examples":[1234567]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/operators\/unAssign":{"post":{"operationId":"unassignContactOperator","summary":"Unassign responsible operators for the chat.","description":"Removes any assigned operator for the chat.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/operators\/assignGroup":{"post":{"operationId":"assignContactOperatorGroup","summary":"Assign an operator group to the chat.","description":"Assigns the specified operator group as responsible for the chat. The system will automatically distribute the chat to an available operator within the group.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","group_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"group_id":{"type":"string","description":"The ID of the operator group to assign.","examples":["60c9d4b8e0f3b2a1c4d5e6fd"]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/setName":{"post":{"operationId":"setContactName","summary":"Set a contact name","description":"Sets the name of a contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","name"],"properties":{"contact_id":{"type":"string","description":"Contact ID","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"name":{"type":"string","maxLength":64,"description":"New name of the contact (up to 64 characters)","examples":["John Doe"]}}}}}},"responses":{"200":{"description":"`data` is `true` when the name was saved","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/openChat":{"post":{"operationId":"openContactChat","summary":"Open chat for a contact","description":"Increase the chat priority by marking it as open","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Chat opened successfully","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/closeChat":{"post":{"operationId":"closeContactChat","summary":"Close chat for a contact","description":"Close the chat and lower the priority.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Chat closed successfully","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/mark-read":{"put":{"operationId":"markContactMessagesRead","summary":"Mark messages as read","description":"Mark all of the contact's messages as read (set unread count to 0)","tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","required":true,"description":"Contact ID. Used to set its unread message count to 0.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageCountResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/mark-unread":{"put":{"operationId":"markContactMessagesUnread","summary":"Mark a chat with the contact as unread","description":"Marks the last message of a specific contact as unread.","tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","required":true,"description":"The ID of the contact whose last message will be marked as unread.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"The number of messages successfully marked as unread.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageCountResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/flows":{"get":{"operationId":"getFlows","summary":"Get a list of flows","description":"Returns a list of created flows for the selected bot and information for each: flow id, bot id, status, name, id and name of the trigger that launches it, and creation date","tags":["flows"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/FlowListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/flows\/run":{"post":{"operationId":"runFlow","summary":"Run a flow by its ID","description":"Launches the selected flow for the selected contact. Additional data can be passed to the \"external_data\" field and used once in the selected flow, where variables will be inserted in the \"Message\" element as a JSON path, for example {{$['tracking_number']}}.","tags":["flows"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","flow_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"flow_id":{"type":"string","description":"Flow ID to be launched. Can be obtained with the method of obtaining the list of flows","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"external_data":{"$ref":"#\/components\/schemas\/ExternalData"},"start_block_id":{"type":["string","null"],"format":"uuid","description":"Block ID to start the flow from. If not specified, the flow starts from the first block.","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]}}},"examples":{"run_flow":{"summary":"Run a flow","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","flow_id":"60c9d4b8e0f3b2a1c4d5e6f8","external_data":{"tracking_number":"1234-0987-5678-9012"}}},"run_flow_from_block":{"summary":"Start a flow from the specified flow element","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","flow_id":"60c9d4b8e0f3b2a1c4d5e6f8","external_data":{"tracking_number":"1234-0987-5678-9012"},"start_block_id":"3f2504e0-4f89-11d3-9a0c-0305e82c3301"}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/flows\/runByTrigger":{"post":{"operationId":"runFlowByTrigger","summary":"Run a flow by trigger keywords","description":"Launches a flow with the trigger keyword for the selected contact","tags":["flows"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","trigger_keyword"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"trigger_keyword":{"type":"string","minLength":1,"maxLength":128,"description":"Keyword (command) that launches the flow","examples":["start"]},"external_data":{"$ref":"#\/components\/schemas\/ExternalData"}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/triggers":{"get":{"operationId":"getTriggers","summary":"Get a list of triggers","description":"Returns the list of created triggers for the selected bot with information about each of them: trigger ID, bot id, id of the flow that starts on it, name, type, set launch time and creation date","tags":["triggers"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TriggerListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/bots":{"get":{"operationId":"getBots","summary":"Get a list of connected bots","description":"Returns lists of bots with information about each: bot ID, channel information, number of received and unread messages, bot status, and creation date","tags":["bots"],"parameters":[{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BotListResponse"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/bots\/statistics":{"get":{"operationId":"getBotStatistics","summary":"Get general statistics info by bot","description":"Returns general statistics info by bot","tags":["bots"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"The bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BotStatisticsResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/chats":{"get":{"operationId":"getChats","summary":"Get a list of chats","description":"Returns a list of chats with subscribers with information about the contact and the last message received from the contact","tags":["chats"],"parameters":[{"in":"query","name":"bot_id","required":false,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ChatPageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/chats\/messages":{"get":{"operationId":"getChatMessages","summary":"Get a list of messages","description":"Returns a list of all messages in correspondence with the specified subscriber","tags":["chats"],"parameters":[{"in":"query","name":"contact_id","required":true,"description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"},{"$ref":"#\/components\/parameters\/search_after"},{"$ref":"#\/components\/parameters\/order"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessagePageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/variables":{"get":{"operationId":"getVariables","summary":"Get a list of variables","description":"Returns a list of variables for the selected bot with information about each: variable ID, bot ID, name, affiliation, type, status, and creation date","tags":["variables"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/VariableListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/campaigns\/recipients":{"get":{"operationId":"getCampaignRecipients","summary":"Get campaign recipients","description":"Get a list of campaign recipients with delivery statistics","tags":["campaigns"],"parameters":[{"in":"query","name":"id","required":true,"description":"Campaign ID","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6fe"},{"$ref":"#\/components\/parameters\/order"},{"$ref":"#\/components\/parameters\/search_after"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Campaign recipients list","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CampaignRecipientsResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/campaigns\/report":{"get":{"operationId":"getCampaignReport","summary":"Get campaign report","description":"Get campaign data with sending statistics","tags":["campaigns"],"parameters":[{"in":"query","name":"id","required":true,"description":"Campaign ID","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6fe"}],"responses":{"200":{"description":"Campaign report","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CampaignReportResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/campaigns\/send":{"post":{"operationId":"sendCampaign","summary":"Send campaign","description":"Sends a campaign to all of a bot's subscribers that were active within the last 24 hours. You can send a campaign with text, an image, or a file. To view an example of the request body, select a message type from the drop-down list","tags":["campaigns"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"title":{"type":"string","description":"Campaign title","examples":["Black Friday sale"]},"bot_id":{"type":"string","description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"send_at":{"type":"string","description":"Specify the date and time in your account timezone (or GMT\/UTC+0 if no timezone is set in the account) in the format Y-m-d H:i if you need to schedule the campaign, if you do not specify this parameter, the campaign will be sent immediately","examples":["Y-m-d H:i"]},"filter":{"$ref":"#\/components\/schemas\/CampaignFilter"},"messages":{"type":"array","description":"Message to send, specifying the type and content of the campaign","items":{"type":"object","description":"Message to send, specifying the type and content of the message","properties":{"type":{"type":"string","enum":["text","image","document"],"description":"Message type; the content goes into the field with the same name","examples":["text"]},"text":{"type":"object","properties":{"body":{"type":"string","description":"The content of the text message. You can add text with emoji of up to 1024 unicode characters.","examples":["Hello!"]}},"required":["body"]},"reply_to":{"type":"object","description":"Reply to a specific message","properties":{"message_id":{"type":"string","description":"WhatsApp message ID to reply to","examples":["wamid.HBgMMzgwNjcxMjM0NTY3FQIAERgSNTk3RjQyRkI2QzE0QjQ4RUY2AA=="]}},"required":["message_id"]},"image":{"type":"object","description":"Image to send: a link to the image and an optional caption","properties":{"link":{"type":"string","description":"Public URL of the image","examples":["https:\/\/www.example.com\/image.png"]},"caption":{"type":["string","null"],"description":"Caption for the image","examples":["Example caption"]}},"required":["link"]},"document":{"type":"object","description":"File to send: a link to the file and an optional caption","properties":{"link":{"type":"string","description":"Public URL of the file","examples":["https:\/\/www.example.com\/file.pdf"]},"caption":{"type":["string","null"],"description":"Caption for the file","examples":["Example caption"]},"filename":{"type":["string","null"],"description":"File name shown to the recipient","examples":["file.pdf"]}},"required":["link"]}},"required":["type"]}}},"required":["title","bot_id","messages"]},"examples":{"Send a campaign with text":{"value":{"title":"Example title","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"Y-m-d H:i","messages":[{"type":"text","text":{"body":"Hello!"}}]}},"Send a campaign with an image":{"value":{"title":"Example title","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"Y-m-d H:i","messages":[{"type":"image","image":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}]}},"Send a campaign with a file":{"value":{"title":"Example title","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"Y-m-d H:i","messages":[{"type":"document","document":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}]}},"Send a campaign with different content types":{"value":{"title":"Example title","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"Y-m-d H:i","messages":[{"type":"text","text":{"body":"Hello!"}},{"type":"image","image":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}},{"type":"document","document":{"link":"https:\/\/www.example.com\/file.pdf","caption":"Example caption"}}]}},"Send a campaign with a filter":{"value":{"title":"Campaign with filter","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"Y-m-d H:i","messages":[{"type":"text","text":{"body":"Hello!"}}],"filter":{"type":"and","expressions":[{"type":"and","expressions":[{"operator":"eq","field":"tags","value":"SOME_TAG_HERE"}]}]}}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CampaignResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/campaigns\/sendTemplate":{"post":{"operationId":"sendTemplateCampaign","summary":"Send a campaign by template","description":"Sends a template message to all of a bot's subscribers. You can send a campaign with text, an image, or a file. To view an example of the request body, select a message template from the drop-down list","tags":["campaigns"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"title":{"type":"string","description":"Campaign title","examples":["Black Friday sale"]},"bot_id":{"type":"string","description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"send_at":{"type":"string","description":"Specify the date and time in your account timezone (or GMT\/UTC+0 if no timezone is set in the account) in the format Y-m-d H:i if you need to schedule the campaign, if you do not specify this parameter, the campaign will be sent immediately","examples":["Y-m-d H:i"]},"template":{"type":"object","description":"Content of the template. To get a template code in your account, go to the \"Templates\" tab of your bot and, opposite the desired template, click \"Copy code.\" In the opened window, copy the value of the \"template\" parameter.","properties":{"name":{"type":"string","examples":["event_started"],"description":"Template name"},"language":{"type":"object","description":"Template language","properties":{"code":{"type":"string","examples":["en"]}},"required":["code"]},"components":{"type":"array","description":"The set of additional parameters differs depending on the included template components and can include variables, an image, or a file.","items":{"$ref":"#\/components\/schemas\/TemplateComponent"}}},"required":["name","language"]},"filter":{"$ref":"#\/components\/schemas\/CampaignFilter"}},"required":["title","bot_id","template"]},"examples":{"Send a campaign by template with text":{"value":{"title":"Thanks for buying","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"2021-01-21 12:00","template":{"name":"thanks_for_buying","language":{"code":"en"},"components":[]}}},"Send a campaign by template with an image":{"value":{"title":"Thanks for buying","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"2021-01-21 12:00","template":{"name":"thanks_for_buying_image","language":{"code":"en"},"components":[{"type":"header","parameters":[{"type":"image","image":{"link":"https:\/\/www.example.com\/image.jpg"}}]}]}}},"Send a template message with payload buttons":{"value":{"title":"Thanks for buying","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"2021-01-21 12:00","template":{"name":"thanks_for_buying_payload","language":{"code":"en"},"components":[{"type":"body","parameters":[{"type":"text","text":"some text"}]},{"type":"button","sub_type":"quick_reply","index":0,"parameters":[{"type":"payload","payload":{"to_chain_id":"60c9d4b8e0f3b2a1c4d5e6f8"}}]}]}}},"Send a campaign with a filter":{"value":{"title":"Campaign with filter","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"Y-m-d H:i","template":{"name":"thanks_for_buying","language":{"code":"en"},"components":[]},"filter":{"type":"and","expressions":[{"type":"and","expressions":[{"operator":"eq","field":"tags","value":"SOME_TAG_HERE"}]}]}}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/CampaignResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/account":{"get":{"operationId":"getAccount","summary":"Get account info","description":"Returns information about your current account pricing plan, the number of messages in your plan, bots, contacts, list of tags, and variables","tags":["account"],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/AccountResponse"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"}}}},"\/templates":{"get":{"operationId":"getTemplates","summary":"Get a template list","description":"Returns a list of templates with information about each template","tags":["templates"],"parameters":[{"in":"query","name":"bot_id","example":"60c9d4b8e0f3b2a1c4d5e6f0","required":true,"schema":{"type":"string"},"description":"The bot ID where the templates are located. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact."},{"in":"query","name":"name","example":"thanks_for_buying","required":false,"schema":{"type":"string","maxLength":512},"description":"Filter templates by name (partial, case-insensitive match)."},{"in":"query","name":"locale","example":"en","required":false,"schema":{"type":"string","enum":["af","sq","ar","az","bn","bg","ca","zh_CN","zh_HK","zh_TW","hr","cs","da","nl","en","en_GB","en_US","et","fil","fi","fr","de","el","gu","ha","he","hi","hu","id","ga","it","ja","kn","kk","ko","lo","lv","lt","mk","ms","ml","mr","nb","fa","pl","pt_BR","pt_PT","pa","ro","ru","sr","sk","sl","es","es_AR","es_ES","es_MX","sw","sv","ta","te","th","tr","uk","ur","uz","vi","zu"],"examples":["en"]},"description":"Filter templates by language code (locale)."},{"in":"query","name":"status","example":"APPROVED","required":false,"schema":{"type":"string","enum":["APPROVED","IN_APPEAL","PENDING","REJECTED","PENDING_DELETION","DELETED","DISABLED","PAUSED"],"examples":["APPROVED"]},"description":"Filter templates by their status."},{"in":"query","name":"category","example":"UTILITY","required":false,"schema":{"type":"string","enum":["AUTHENTICATION","MARKETING","UTILITY"],"examples":["UTILITY"]},"description":"Filter templates by category."}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TemplateListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}},"post":{"operationId":"createTemplate","summary":"Create a template","description":"Creates a new message template for the specified bot and submits it for approval.","tags":["templates"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"bot_id":{"type":"string","description":"The bot ID for which the template is created.","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"category":{"type":"string","enum":["AUTHENTICATION","MARKETING","UTILITY"],"description":"The template category.","examples":["AUTHENTICATION"]},"name":{"type":"string","description":"The template name.","examples":["order_update"]},"language":{"type":"string","description":"The template language code.","examples":["en"]},"components":{"type":"array","description":"The template components (header, body, footer, buttons).","items":{"type":"object","additionalProperties":true}},"parameter_format":{"type":"string","enum":["positional","named"],"default":"positional","description":"The format of variables in the template: positional ({{1}}) or named ({{name}}). Defaults to positional.","examples":["positional"]}},"required":["bot_id","category","name","language","components"]},"examples":{"Positional parameters ({{1}}, {{2}}, ...)":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","category":"UTILITY","name":"order_update","language":"en","components":[{"type":"BODY","text":"Hello {{1}}, your order {{2}} is confirmed.","example":{"body_text":[["Alex","ORD-12345"]]}}],"parameter_format":"positional"}},"Named parameters ({{name}}, {{order_id}}, ...)":{"value":{"bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","category":"UTILITY","name":"order_update","language":"en","components":[{"type":"BODY","text":"Hello {{name}}, your order {{order_id}} is confirmed.","example":{"body_text_named_params":[{"param_name":"name","examples":["Alex"]},{"param_name":"order_id","examples":["ORD-12345"]}]}}],"parameter_format":"named"}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TemplateResponse"}}}},"400":{"$ref":"#\/components\/responses\/WaSendFailed"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/templates\/{id}":{"delete":{"operationId":"deleteTemplate","summary":"Delete a template","description":"Deletes the message template with the specified ID.","tags":["templates"],"parameters":[{"in":"path","name":"id","required":true,"description":"Template ID (the `id` field of a template returned by the API)","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f5"},{"in":"query","name":"bot_id","required":true,"description":"The bot ID where the templates are located. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f0"}],"responses":{"200":{"description":"`data` is `true` when the template was deleted","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/WaSendFailed"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"404":{"$ref":"#\/components\/responses\/NotFound"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/tags":{"get":{"operationId":"getTags","summary":"Get a list of tags","description":"Returns the list of created tags for the selected bot with information about each of them: tag ID, name, contact_count and creation date","tags":["tags"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TagListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}}},"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"Authorization","description":"API key from https:\/\/login.sendpulse.com\/settings\/api, sent in the `Authorization` header as `Bearer sp_apikey_***` (the `Bearer ` prefix is optional)"}},"parameters":{"size":{"in":"query","name":"size","required":false,"description":"The limit of pagination items that will be returned","schema":{"type":"integer","minimum":1,"maximum":1000},"example":20},"skip":{"in":"query","name":"skip","required":false,"description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer","minimum":0},"example":0},"search_after":{"in":"query","name":"search_after","required":false,"description":"The ID of the element after which elements will be returned","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f9"},"order":{"in":"query","name":"order","required":false,"description":"Sort order ASC or DESC","schema":{"type":"string","enum":["asc","desc"]},"example":"desc"}},"responses":{"BadRequest":{"description":"Request rejected: the bot or contact does not exist or is inactive, the request body is not valid JSON, the contact is banned, there is not enough money on the balance (campaigns), or the action is not available on the current pricing plan (`error_code` `3004` - pricing plan inactive, `3005` - available only on a paid plan)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"WaSendFailed":{"description":"WhatsApp rejected the request; `message` contains the WhatsApp error details. Note: such responses contain `success: true` and `data: false`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"PaymentRequired":{"description":"There is not enough money on the balance to send the message. Note: the response contains `success: true` and `data: false`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"WaInternalError":{"description":"Sending failed because of an internal error. Note: the response contains `success: true` and `data: false`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"Unauthorized":{"description":"The access token or API key is missing, invalid, or expired","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"Forbidden":{"description":"Access denied: the token is not valid for this resource, the user has no permission for the action, or the pricing plan limit is exceeded (`error_code` `3002`)","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"NotFound":{"description":"The requested resource (for example, the operator or operator group) was not found","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Error"}}}},"UnprocessableEntity":{"description":"Request validation failed; `errors` maps every invalid field to its error messages","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ValidationError"}}}}},"schemas":{"WaImageMessage":{"type":"object","description":"The image you want to send. Includes the URL to the image and caption","properties":{"link":{"type":"string","description":"Full URL of the image you want to send, including the \"https\" protocol part. You can only send links to SSL-secured sites","examples":["https:\/\/www.example.com\/image.png"]},"caption":{"type":["string","null"],"description":"Caption for the image","examples":["Example caption"]}},"required":["link"]},"WaDocumentMessage":{"type":"object","description":"File to send: a link to the file and an optional caption","properties":{"link":{"type":"string","description":"Full URL of the file you want to send, including the \"https\" protocol part. You can only send links to SSL-secured sites","examples":["https:\/\/www.example.com\/file.pdf"]},"caption":{"type":["string","null"],"description":"Caption for the file","examples":["Example caption"]},"filename":{"type":["string","null"],"description":"File name shown to the recipient","examples":["file.pdf"]}},"required":["link"]},"WaAudioMessage":{"type":"object","description":"The audio you want to send. Includes the URL to the audio","properties":{"link":{"type":"string","description":"Full HTTPS URL of the audio file you want to send. Only SSL-secured links are allowed.","examples":["https:\/\/www.example.com\/audio.mp3"]},"voice":{"type":"boolean","default":false,"description":"Indicates that the audio should be sent as a voice message","examples":[false]}},"required":["link"]},"WaInteractiveMessage":{"type":"object","description":"The interactive object you want to send. Includes the buttons and text","properties":{"type":{"type":"string","enum":["button","carousel"],"examples":["button"]},"body":{"type":"object","properties":{"text":{"type":"string","description":"The content of the text message. You can add text with emoji of up to 1024 unicode characters.","examples":["Example text"]}}},"action":{"type":"object","properties":{"buttons":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["reply"],"examples":["reply"]},"to_chain_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"reply":{"type":"object","properties":{"title":{"type":"string","examples":["Yes"]}}}}}},"cards":{"type":"array","description":"Cards must include either one button. Button types and numbers must match across all cards (for example, if you define a card with 2 URL-buttons, all cards must define exactly 2 URL-buttons).","items":{"type":"object","properties":{"type":{"type":"string","enum":["cta_url","button"],"examples":["cta_url"]},"header":{"type":"object","properties":{"type":{"type":"string","enum":["image"],"examples":["image"]},"image":{"type":"object","properties":{"link":{"type":"string","examples":["https:\/\/www.example.com\/image.png"]}}}}},"body":{"type":"object","properties":{"text":{"type":"string","examples":["Example text"]}}},"action":{"type":"object","additionalProperties":true}}}}}}}},"WaTemplateInput":{"type":"object","description":"Content of the template. To get a template code in your account, go to the \"Templates\" tab of your bot and, opposite the desired template, click \"Copy code.\" In the opened window, copy the value of the \"template\" parameter.","properties":{"name":{"type":"string","examples":["event_started"],"description":"Template name"},"language":{"type":"object","description":"Template language","properties":{"code":{"type":"string","examples":["en"],"description":"Can have the values en, ru .."}},"required":["code"]},"components":{"type":"array","description":"The set of additional parameters differs depending on the included template components and can include variables, an image, or a file.","items":{"$ref":"#\/components\/schemas\/TemplateComponent"}}},"required":["name","language"]},"CampaignFilter":{"type":"object","description":"Filter for campaign sending","properties":{"type":{"type":"string","description":"Filter type (and\/or)","examples":["and"]},"expressions":{"type":"array","description":"Filter expressions","items":{"type":"object","properties":{"type":{"type":"string","description":"Expression type (and\/or)","examples":["and"]},"expressions":{"type":"array","description":"List of expressions","items":{"type":"object","properties":{"operator":{"type":"string","description":"Filter operator (e.g., eq, like, gt, lt, etc.)","examples":["eq"]},"field":{"type":"string","description":"Field to filter by (e.g., tags)","examples":["tags"]},"value":{"type":"string","description":"Value to filter by","examples":["vip"]}}}}}}}}},"Error":{"type":"object","description":"Error response","properties":{"success":{"type":"boolean","examples":[false]},"data":{"type":["object","null"],"description":"Additional error data; usually `null`. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"examples":[null]},"message":{"type":"string","examples":["Operator not found."]},"errors":{"$ref":"#\/components\/schemas\/FieldErrors"},"error_code":{"type":"integer","description":"Application error code; usually equals the HTTP status, see the response description for other values","examples":[400]}}},"ValidationError":{"type":"object","description":"Validation error response","required":["message","errors"],"properties":{"message":{"type":"string","examples":["The given data was invalid."]},"errors":{"$ref":"#\/components\/schemas\/FieldErrors"},"success":{"type":"boolean","examples":[false]},"data":{"type":"null","examples":[null]},"error_code":{"type":"integer","description":"Application error code; usually equals the HTTP status, see the response description for other values","examples":[400]}}},"TemplateComponent":{"type":"object","required":["type"],"properties":{"type":{"type":"string","description":"Accepted values: header \/ body \/ footer depending on where you want to insert the component","examples":["body"]},"sub_type":{"type":"string","description":"Accepted values: url \/ quick_reply \/ catalog. Required when type=button. Not used for the other types. Type of button to create","examples":["quick_reply"]},"index":{"type":"integer","description":"Required when type=button. Not used for the other types. Position index of the button. You can have up to 3 buttons using index values of 0 to 2.","examples":[0]},"parameters":{"type":"array","description":"Custom template variables. Specify the type, name and value of the variable","items":{"$ref":"#\/components\/schemas\/TemplateComponentParameter"}}}},"TemplateComponentParameter":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["text","image","document","video","payload","action","coupon_code"],"description":"Variable type","examples":["text"]},"text":{"type":"string","description":"Variable value; used when type=text","examples":["John"]},"parameter_name":{"type":"string","description":"Variable name for templates with named parameters","examples":["first_name"]},"image":{"type":"object","description":"The image you want to send. Includes the URL to the image and caption","required":["link"],"properties":{"link":{"type":"string","description":"Full URL of the file you want to send, including the \"https\" protocol part. You can only send links to SSL-secured sites","examples":["https:\/\/www.example.com\/image.png"]}}},"document":{"type":"object","description":"The document you want to send; used when type=document","required":["link"],"properties":{"link":{"type":"string","description":"Full URL of the file you want to send, including the \"https\" protocol part. You can only send links to SSL-secured sites","examples":["https:\/\/www.example.com\/file.pdf"]},"filename":{"type":"string","description":"File name shown to the recipient","examples":["file.pdf"]}}},"video":{"type":"object","description":"The video you want to send. Includes the URL to the video file.","required":["link"],"properties":{"link":{"type":"string","description":"Full URL of the file you want to send, including the \"https\" protocol part. You can only send links to SSL-secured sites","examples":["https:\/\/www.example.com\/video.mp4"]}}},"payload":{"type":"object","description":"Required for quick_reply buttons. Developer-defined payload that is returned when the button is clicked in addition to the display text on the button.","properties":{"to_chain_id":{"type":"string","description":"ID of the flow started when the button is pressed","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]}}},"action":{"type":"object","description":"Button action data; used when type=action","additionalProperties":true,"examples":[{"flow_token":"unused"}]},"coupon_code":{"type":"string","description":"Coupon code; used when type=coupon_code","examples":["SALE25"]}}},"FieldErrors":{"type":"object","description":"Error messages grouped by field; the `*` key holds errors that are not bound to a field. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":{"type":"array","items":{"type":"string"}},"examples":[{"contact_id":["Contact does not exist."]}]},"PaginationLinks":{"type":"object","properties":{"next":{"type":"string","format":"uri","description":"URL of the next page","examples":["https:\/\/api.sendpulse.com\/telegram\/chats?page=2"]}}},"PaginationMeta":{"type":"object","required":["total","limit"],"properties":{"total":{"type":"integer","description":"Total number of items","examples":[125]},"limit":{"type":"integer","description":"Page size","examples":[20]}}},"BooleanResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"boolean","examples":[true]}}},"IntegerResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"integer","examples":[1]}}},"DateTimeResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"NullableDateTimeResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":["string","null"],"format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"AccountResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Account"}}},"BotListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Bot"}}}},"BotStatisticsResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/BotStatistics"}}},"CampaignRecipientsResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/CampaignRecipientsPage"}}},"CampaignReportResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/CampaignReport"}}},"CampaignResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Campaign"}}},"ChatPageResponse":{"type":"object","required":["success","data","meta"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Chat"}},"links":{"$ref":"#\/components\/schemas\/PaginationLinks"},"meta":{"$ref":"#\/components\/schemas\/PaginationMeta"}}},"ContactPageResponse":{"type":"object","required":["success","data","meta"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Contact"}},"links":{"$ref":"#\/components\/schemas\/PaginationLinks"},"meta":{"$ref":"#\/components\/schemas\/PaginationMeta"}}},"ContactResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Contact"}}},"FlowListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Flow"}}}},"MessageCountResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/MessageCount"}}},"MessagePageResponse":{"type":"object","required":["success","data","meta"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Message"}},"links":{"$ref":"#\/components\/schemas\/PaginationLinks"},"meta":{"$ref":"#\/components\/schemas\/PaginationMeta"}}},"MessageResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Message"}}},"OperatorNoteListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/OperatorNoteList"}}},"OperatorNoteResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/OperatorNote"}}},"TagListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Tag"}}}},"TriggerListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Trigger"}}}},"VariableListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Variable"}}}},"Template":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f5"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"name":{"type":"string","examples":["thanks_for_buying"]},"language":{"type":"string","examples":["en"]},"namespace":{"type":"string","examples":["c8ae5f90_307a_ca4c_b8f6_d1e2a2573574"]},"content":{"type":["string","null"],"examples":["Thank you for your order!"]},"category":{"type":"string","description":"Template category: `AUTHENTICATION`, `MARKETING`, or `UTILITY`","examples":["UTILITY"]},"sub_category":{"type":["string","null"],"examples":[null]},"previous_category":{"type":["string","null"],"examples":[null]},"correct_category":{"type":["string","null"],"examples":[null]},"components":{"type":"array","description":"Template components (header, body, footer, buttons)","items":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true}},"status":{"type":"string","description":"Template review status","examples":["APPROVED"]},"rejected_reason":{"type":["string","null"],"examples":[null]},"message_send_ttl_seconds":{"type":["integer","null"],"examples":[null]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"TemplateResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Template"}}},"TemplateListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Template"}}}},"VariableValue":{"description":"The value that is set for the variable","type":["string","number","boolean"],"examples":["Kyiv"]},"ContactVariableInput":{"type":"object","description":"Variable to set: pass either `variable_id` or `variable_name`","required":["variable_value"],"properties":{"variable_id":{"type":"string","description":"The ID of the created variable can be obtained via other methods","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"variable_name":{"type":"string","minLength":1,"maxLength":255,"description":"Name of the variable","examples":["city"]},"variable_value":{"$ref":"#\/components\/schemas\/VariableValue"}}},"ExternalData":{"type":"object","description":"Custom variables. You can pass variable values in the request and use them once in the flow you selected. To add variables to the flow, in the Message element, insert the variable names as a JSON path expression {{$['somekey']['nestedkey']}}.","additionalProperties":true,"maxProperties":100,"examples":[{"tracking_number":"1234-0987-5678-9012"}]},"Account":{"type":"object","properties":{"tariff":{"$ref":"#\/components\/schemas\/AccountTariff"},"statistics":{"$ref":"#\/components\/schemas\/AccountStatistics"},"free_conversations":{"type":"integer","description":"Number of free conversations left","examples":[1000]}}},"AccountTariff":{"type":"object","description":"Pricing plan options; `-1` means unlimited","properties":{"code":{"type":"string","examples":["chatbots_pro"]},"branding":{"type":"boolean","examples":[false]},"max_bots":{"type":"integer","examples":[10]},"max_contacts":{"type":"integer","examples":[-1]},"max_messages":{"type":"integer","examples":[-1]},"max_tags":{"type":"integer","examples":[100]},"max_variables":{"type":"integer","examples":[100]},"max_rss":{"type":"integer","examples":[10]},"max_ai_tokens":{"type":"integer","examples":[-1]},"max_crm_operators":{"type":"integer","examples":[-1]},"max_ai_agents":{"type":"integer","examples":[-1]},"max_storage_size":{"type":"integer","examples":[-1]},"is_exceeded":{"type":"boolean","examples":[false]},"is_expired":{"type":"boolean","examples":[false]},"expired_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"AccountStatistics":{"type":"object","properties":{"messages":{"type":"integer","examples":[1500]},"bots":{"type":"integer","examples":[2]},"contacts":{"type":"integer","examples":[350]},"variables":{"type":"integer","examples":[12]},"active_count_by_last_month":{"type":"integer","examples":[120]},"active_count_by_current_tariff_period":{"type":"integer","examples":[80]}}},"Bot":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"channel":{"type":"string","examples":["WHATSAPP"]},"name":{"type":"string","examples":["Shop WhatsApp"]},"status":{"type":"integer","enum":[1,2,3,5,4,8,10,11,12],"description":"\n                    * `1` - new\n\n                    * `2` - reconnect required\n\n                    * `3` - active\n\n                    * `4` - deleted\n\n                    * `5` - inactive\n\n                    * `8` - ready to be deleted\n\n                    * `10` - activation in progress\n\n                    * `11` - action required\n\n                    * `12` - deactivated\n\n                ","examples":[3]},"channel_data":{"type":"object","description":"WhatsApp Business phone number of the bot and its business profile","properties":{"phone":{"type":"integer","examples":[380931234567]},"name":{"type":"string","examples":["Shop"]},"about":{"type":"string","examples":["Best shop in town"]},"photo":{"type":"string","examples":["https:\/\/www.cdn.com\/bot.png"]},"business_profile":{"type":"object","properties":{"address":{"type":"string","examples":["Kyiv, Khreshchatyk 1"]},"description":{"type":"string","examples":["Online shop"]},"email":{"type":"string","examples":["shop@example.com"]},"vertical":{"type":"string","examples":["RETAIL"]},"websites":{"type":"array","items":{"type":"string"},"examples":[["https:\/\/example.com"]]}}},"compliance_info":{"type":["object","null"],"description":"Business compliance information. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true}}},"inbox":{"type":"object","properties":{"total":{"type":"integer","examples":[42]},"unread":{"type":"integer","examples":[3]}}},"variables":{"type":"array","description":"Bot variables with their values","items":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fa"]},"name":{"type":"string","examples":["discount"]},"value_type":{"type":"integer","examples":[2]},"value":{"type":["string","number","boolean"],"examples":[10]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"updated_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}}},"settings":{"type":"object","description":"Bot settings. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"properties":{"two_step_verification_enabled":{"type":"boolean","examples":[false]},"disable_trigger_hints":{"type":"boolean","examples":[false]},"create_contacts_in_crm":{"type":"boolean","examples":[false]},"pause_automation_minutes":{"type":"integer","examples":[60]},"save_incoming_attachments_to_storage":{"type":"boolean","examples":[false]}}},"mm_lite":{"type":["object","null"],"description":"Marketing Messages Lite API status of the bot","properties":{"onboard_status":{"type":"string","examples":["ONBOARDED"]},"api_status":{"type":"string","examples":["ENABLED"]},"data":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":["object","null"],"additionalProperties":true}}},"statistics":{"type":"object","description":"Returned only when `with_stats` is set","properties":{"total_subscribers":{"type":"integer","examples":[400]},"subscribed":{"type":"integer","examples":[350]},"messages_incoming":{"type":"integer","examples":[1200]},"messages_outgoing":{"type":"integer","examples":[3400]}}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"BotStatistics":{"type":"object","properties":{"subscribed_total_count":{"type":"integer","examples":[350]},"subscribed_active_count":{"type":"integer","examples":[300]},"outgoing_messages_total_count":{"type":"integer","examples":[3400]}}},"ContactOperator":{"type":["object","null"],"properties":{"user_id":{"type":"integer","description":"The operator user ID","examples":[1234567]},"username":{"type":"string","description":"The operator full name","examples":["Jane Smith"]},"email":{"type":"string","description":"The operator email","examples":["jane@example.com"]},"avatar":{"type":["string","null"],"description":"The operator avatar URL","examples":["https:\/\/www.cdn.com\/avatar.png"]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"WaSession":{"type":["object","null"],"description":"WhatsApp conversation session","properties":{"id":{"type":"string","examples":["8c3f7a0b2d4e6f1a"]},"is_fake":{"type":"boolean","examples":[false]},"is_expiration_timestamp_autogenerated":{"type":"boolean","examples":[false]},"origin":{"type":["object","null"],"properties":{"type":{"type":"string","examples":["service"]}}},"expiration_timestamp":{"type":["integer","null"],"examples":[1735689600]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Contact":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"status":{"type":"integer","enum":[0,1,2,3,4,5,6,7,8,9],"description":"\n                    * `0` - new\n\n                    * `1` - active\n\n                    * `2` - unsubscribed\n\n                    * `3` - disabled\n\n                    * `4` - blocked by user\n\n                    * `5` - reference\n\n                    * `6` - deleted\n\n                    * `7` - invalid\n\n                    * `8` - referral\n\n                    * `9` - duplicate\n\n                ","examples":[1]},"type":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - subscriber\n\n                    * `2` - bot owner\n\n                ","examples":[1]},"channel_data":{"type":"object","description":"WhatsApp profile of the contact","properties":{"user_id":{"type":["string","null"],"description":"Business-scoped user ID (BSUID) of the contact","examples":["US.13491208655302741918"]},"phone":{"type":["integer","null"],"examples":[380931234567]},"name":{"type":["string","null"],"examples":["John Doe"]},"username":{"type":["string","null"],"examples":["john_doe"]},"photo":{"type":"null","examples":[null]}}},"tags":{"type":"array","uniqueItems":true,"items":{"type":"string"},"examples":[["vip","newsletter"]]},"variables":{"type":"object","description":"Contact variables as `variable_name: variable_value` pairs; the set of keys depends on the bot variables. Date values are formatted as `d.m.Y`, datetime values as `d.m.Y H:i` in the account time zone. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":{"type":["string","number","boolean"]},"examples":[{"city":"Kyiv","age":30}]},"is_chat_opened":{"type":"boolean","examples":[true]},"is_banned":{"type":"boolean","examples":[false]},"last_activity_at":{"type":["string","null"],"format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"last_session":{"$ref":"#\/components\/schemas\/WaSession"},"last_sessions":{"type":["object","null"],"description":"Latest conversation sessions by conversation category","properties":{"authentication":{"$ref":"#\/components\/schemas\/WaSession"},"marketing":{"$ref":"#\/components\/schemas\/WaSession"},"utility":{"$ref":"#\/components\/schemas\/WaSession"},"service":{"$ref":"#\/components\/schemas\/WaSession"},"referral_conversion":{"$ref":"#\/components\/schemas\/WaSession"}}},"last_referral_at":{"type":["string","null"],"format":"date-time","examples":[null]},"last_referral":{"type":["object","null"],"description":"Ad or post the contact last came from. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true},"referral_source":{"type":["string","null"],"enum":["AD","POST","SERVICE_SHORTLINK","MESSENGER_CUSTOMER_CHAT_PLUGIN","SUBSCRIPTION_WIDGET","SUBSCRIPTION_EDU","SUBSCRIPTION_CUSTOM_PAYLOAD","AD_TIKTOK",null],"description":"Source the contact came from","examples":["AD"]},"referral_data":{"type":["object","null"],"description":"Details of the ad the contact came from. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true},"call_permissions":{"type":["object","null"],"description":"Permissions to call the contact. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true},"original_contact_id":{"type":["string","null"],"description":"ID of the contact this contact was created from (for example, after a phone number change)","examples":[null]},"automation_paused_until":{"type":["string","null"],"format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"unsubscribed_at":{"type":["string","null"],"format":"date-time","examples":[null]},"ai_agent_disclosure_sent_at":{"type":["string","null"],"format":"date-time","examples":[null]},"operator":{"$ref":"#\/components\/schemas\/ContactOperator"},"operator_group":{"type":["object","null"],"properties":{"id":{"type":"string","description":"The operator group ID","examples":["60c9d4b8e0f3b2a1c4d5e6fd"]},"name":{"type":"string","description":"The operator group name","examples":["Support"]}}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Variable":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fa"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"name":{"type":"string","examples":["city"]},"description":{"type":["string","null"],"examples":["Contact city"]},"type":{"type":"integer","enum":[1],"description":"\n                    * `1` - contact variable\n\n                ","examples":[1]},"value_type":{"type":"integer","enum":[1,2,3,4,5,6,7,8,9,10],"description":"\n                    * `1` - string\n\n                    * `2` - number\n\n                    * `3` - date\n\n                    * `4` - boolean\n\n                    * `5` - phone\n\n                    * `6` - email\n\n                    * `7` - url\n\n                    * `8` - location\n\n                    * `9` - datetime\n\n                    * `10` - time\n\n                ","examples":[1]},"status":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - active\n\n                    * `2` - trashed\n\n                ","examples":[1]},"mapping":{"type":["object","null"],"description":"Mapping of the variable to a CRM contact attribute","properties":{"crm":{"type":["object","null"],"properties":{"attribute_id":{"type":"integer","examples":[101]},"is_attribute_required":{"type":"boolean","examples":[false]}}}}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Flow":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"name":{"type":["string","null"],"examples":["Welcome flow"]},"status":{"type":"integer","enum":[1,2,4],"description":"\n                    * `1` - active\n\n                    * `2` - inactive\n\n                    * `4` - draft\n\n                ","examples":[1]},"triggers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f2"]},"name":{"type":"string","examples":["start"]},"type":{"type":"integer","description":"\n                    * `1` - starts immediately upon subscription\n\n                    * `2` - starts when unsubscribed\n\n                    * `3` - default reply\n\n                    * `4` - starts when the specified keyword is entered\n\n                    * `5` - starts at the specified time when subscribing\n\n                ","examples":[4]}}}},"errors":{"type":["array","null"],"description":"Flow validation errors; `null` when the flow has no errors","items":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true}},"start_chains":{"type":["array","null"],"description":"IDs of flows started after this flow","items":{"type":"string"},"examples":[["60c9d4b8e0f3b2a1c4d5e6f9"]]},"start_repeat_chains":{"type":["array","null"],"description":"IDs of flows started after this flow is run again","items":{"type":"string"},"examples":[["60c9d4b8e0f3b2a1c4d5e6f9"]]},"is_public":{"type":"boolean","examples":[false]},"is_public_can_copy":{"type":"boolean","examples":[false]},"folder_id":{"type":["string","null"],"examples":["60c9d4b8e0f3b2a1c4d5e6f3"]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Trigger":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f2"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"flow_id":{"type":["string","null"],"examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"name":{"type":"string","examples":["start"]},"type":{"type":"integer","description":"\n                    * `1` - starts immediately upon subscription\n\n                    * `2` - starts when unsubscribed\n\n                    * `3` - default reply\n\n                    * `4` - starts when the specified keyword is entered\n\n                    * `5` - starts at the specified time when subscribing\n\n                ","examples":[4]},"status":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - active\n\n                    * `2` - inactive\n\n                ","examples":[1]},"keywords":{"type":"array","items":{"type":"string"},"examples":[["start","hello"]]},"keywords_search_type":{"type":["integer","null"],"description":"\n                    * `1` - STRICT_MATCH\n\n                    * `2` - CONTAINS\n\n                ","examples":[1]},"execution":{"$ref":"#\/components\/schemas\/TriggerExecution"},"a360_event":{"type":["object","null"],"description":"Event that starts the flow (for A360 triggers)","properties":{"uuid":{"type":"string","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]},"name":{"type":"string","examples":["Order paid"]}}},"pixel":{"type":["object","null"],"description":"Pixel event that starts the flow","properties":{"project_id":{"type":"string","format":"uuid","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]},"event_id":{"type":"string","format":"uuid","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3302"]}}},"crm_subscription":{"type":["object","null"],"description":"CRM subscription event that starts the flow","properties":{"crm_plan_id":{"type":"integer","examples":[15]},"event_type":{"type":"integer","enum":[1,2,3],"description":"\n                    * `1` - payment succeeded\n\n                    * `2` - payment failed\n\n                    * `3` - subscription canceled\n\n                ","examples":[1]}}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"TriggerExecution":{"type":"object","description":"Delay before the flow starts: `value` in units of `type`. Triggers created before the current format store `interval` and `units` instead","properties":{"type":{"type":"string","enum":["seconds","minutes","hours","days","days_time","date","time","days_of_week","$variable"],"examples":["minutes"]},"value":{"type":"integer","examples":[10]},"interval":{"type":"integer","description":"Delay value in the legacy format; used together with `units`","examples":[10]},"units":{"type":"integer","enum":[1,2,3],"description":"\n                        * `1` - minutes\n\n                        * `2` - hours\n\n                        * `3` - days\n\n                    ","examples":[1]}}},"Campaign":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fe"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"title":{"type":"string","examples":["Black Friday sale"]},"send_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"messages":{"type":"array","items":{"$ref":"#\/components\/schemas\/CampaignMessage"}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"CampaignMessage":{"type":"object","description":"Campaign message content in the WhatsApp message format. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"properties":{"type":{"type":"string","examples":["text"]}}},"CampaignReport":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fe"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"status":{"type":"integer","enum":[1,2,3,6,7,8,9,10],"description":"\n                    * `1` - new\n\n                    * `2` - sending\n\n                    * `3` - sent\n\n                    * `6` - canceled\n\n                    * `7` - failed\n\n                    * `8` - deleted\n\n                    * `9` - partially deleted\n\n                    * `10` - deleting\n\n                ","examples":[3]},"title":{"type":"string","examples":["Black Friday sale"]},"send_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"stats":{"type":"object","properties":{"messages":{"type":"object","properties":{"all":{"type":"integer","examples":[100]},"sent":{"type":"integer","examples":[98]},"rejected":{"type":"integer","examples":[2]},"delivered":{"type":"integer","examples":[95]},"opened":{"type":"integer","examples":[60]},"redirected":{"type":"integer","examples":[12]}}},"recipients":{"type":"object","properties":{"all":{"type":"integer","examples":[100]},"sent":{"type":"integer","examples":[98]},"rejected":{"type":"integer","examples":[2]},"partial_rejected":{"type":"integer","examples":[0]},"delivered":{"type":"integer","examples":[95]},"opened":{"type":"integer","examples":[60]},"redirected":{"type":"integer","examples":[12]},"activity":{"type":"integer","examples":[20]}}},"buttons":{"type":"array","items":{"$ref":"#\/components\/schemas\/CampaignButtonStats"}}}},"messages":{"type":"array","items":{"$ref":"#\/components\/schemas\/CampaignMessage"}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"updated_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"CampaignButtonStats":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f4"]},"title":{"type":"string","examples":["Buy now"]},"clicks":{"type":"integer","examples":[12]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"updated_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"CampaignRecipient":{"type":"object","properties":{"_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f5"]},"contact":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"full_name":{"type":["string","null"],"examples":["John Doe"]},"phone":{"type":["integer","null"],"examples":[380931234567]},"photo":{"type":"null","examples":[null]}}},"campaign_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fe"]},"sent":{"type":"boolean","examples":[true]},"activity":{"type":"boolean","examples":[false]},"clicked":{"type":"boolean","examples":[false]},"delivered":{"type":"boolean","examples":[true]},"opened":{"type":"boolean","examples":[true]},"buttons":{"type":"array","items":{"$ref":"#\/components\/schemas\/CampaignButtonStats"}},"partial_rejected":{"type":"boolean","examples":[false]},"rejected":{"type":"boolean","examples":[false]},"errors":{"type":"array","items":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"updated_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"CampaignRecipientsPage":{"type":"object","description":"Page of campaign recipients. Contains `skip`, `page` and `last_page` when `skip` is used, otherwise `search_after`","properties":{"list":{"type":"array","items":{"$ref":"#\/components\/schemas\/CampaignRecipient"}},"sort":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]},"examples":[{"_id":"desc"}]},"total":{"type":"integer","examples":[100]},"size":{"type":"integer","examples":[20]},"skip":{"type":"integer","examples":[20]},"page":{"type":"integer","examples":[2]},"last_page":{"type":"integer","examples":[5]},"search_after":{"type":"array","items":{"type":"string"},"examples":[["60c9d4b8e0f3b2a1c4d5e6f5"]]}}},"Chat":{"type":"object","properties":{"contact":{"$ref":"#\/components\/schemas\/Contact"},"inbox_last_message":{"oneOf":[{"$ref":"#\/components\/schemas\/Message"},{"type":"null"}]},"inbox_unread":{"type":"integer","examples":[2]}}},"MessageSender":{"type":["object","null"],"description":"User who sent or edited the message","properties":{"id":{"type":"integer","examples":[1234567]},"email":{"type":"string","examples":["jane@example.com"]},"firstname":{"type":["string","null"],"examples":["Jane"]},"lastname":{"type":["string","null"],"examples":["Smith"]},"avatar":{"type":["string","null"],"examples":["https:\/\/www.cdn.com\/avatar.png"]}}},"MessageReaction":{"type":["object","null"],"description":"Reaction set on the message","properties":{"message_id":{"type":"string","description":"WhatsApp ID of the message the reaction belongs to","examples":["wamid.HBgMMzgwOTAwMDAwMDAwFgUyAgESGAEwMDAw"]},"emoji":{"type":["string","null"],"examples":["\ud83d\udc4d"]}}},"MessageAttachment":{"type":"object","properties":{"filepath":{"type":"string","examples":["attachments\/2024\/01\/photo.png"]},"size":{"type":"integer","examples":[204800]},"original_name":{"type":"string","examples":["photo.png"]}}},"Message":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f9"]},"contact_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"data":{"type":"object","description":"WhatsApp message payload. Its fields depend on the message type (for example `text`, `image`, `interactive`, `template`); `message_id` is the WhatsApp message ID. For payment messages the object contains payment details. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"properties":{"message_id":{"type":"string","examples":["wamid.HBgMMzgwOTAwMDAwMDAwFgUyAgESGAEwMDAw"]}},"examples":[{"message_id":"wamid.HBgMMzgwOTAwMDAwMDAwFgUyAgESGAEwMDAw","type":"text","text":{"body":"hello"}}]},"type":{"type":"string","enum":["text","template","image","video","document","audio","voice","sticker","userInput","button","interactive","location","contacts","service_payment","order","system","unknown","unsupported","reaction","operator","operator_note","ephemeral","request_welcome","manual_start_flow","operator_group_assigned","typing","call","a360_start_flow","pixel_start_flow","edit","revoke"],"description":"Message type","examples":["text"]},"direction":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - in\n\n                    * `2` - out\n\n                ","examples":[2]},"status":{"type":"integer","enum":[1,2,3,4,5,6,7,8,9],"description":"\n                    * `1` - new\n\n                    * `2` - sent\n\n                    * `3` - delivered\n\n                    * `4` - opened\n\n                    * `5` - redirected\n\n                    * `6` - rejected\n\n                    * `7` - delete failed\n\n                    * `8` - deleted\n\n                    * `9` - played\n\n                ","examples":[3]},"channel":{"type":["string","null"],"enum":["ma","ma_chat","api","rss","echo","jivo","open_ai","deepseek_ai","anthropic_ai","gemini_ai","payment","notification_bot","soa",null],"description":"Source that produced the message","examples":["api"]},"is_paid":{"type":"boolean","description":"Whether the message is paid","examples":[false]},"price_cbp":{"type":["object","null"],"description":"Conversation Based Price","properties":{"price":{"type":"number","examples":[0.0441]},"currency":{"type":"string","examples":["USD"]},"origin_type":{"type":"string","examples":["marketing"]},"is_free_conversation":{"type":"boolean","examples":[false]},"country_code":{"type":["string","null"],"examples":["UA"]}}},"campaign":{"type":["object","null"],"description":"Campaign the message was sent by","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fe"]},"size":{"type":"integer","examples":[2]},"message_num":{"type":"integer","examples":[1]}}},"chain":{"type":["object","null"],"description":"Flow and block the message was sent by","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"block_id":{"type":"string","format":"uuid","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]}}},"sent_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_at":{"type":["string","null"],"format":"date-time","examples":[null]},"reaction":{"$ref":"#\/components\/schemas\/MessageReaction"},"reject_reason":{"type":["string","null"],"examples":[null]},"attachments":{"type":["array","null"],"description":"Message attachments","items":{"$ref":"#\/components\/schemas\/MessageAttachment"}},"redirected_from_contact_id":{"type":"string","description":"Returned by the send-by-phone endpoints when the message was sent to another contact with the same phone number","examples":["60c9d4b8e0f3b2a1c4d5e6f1"]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"MessageCount":{"type":"object","properties":{"count":{"type":"integer","description":"Number of messages whose read state was changed","examples":[3]}}},"OperatorNote":{"type":"object","description":"Operator note left in the contact chat","properties":{"_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fc"]},"user_id":{"type":"integer","examples":[1234567]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"contact_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"text":{"type":"string","description":"Note text","examples":["Customer asked to call back tomorrow"]},"channel_data":{"type":"object","properties":{"message":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true,"properties":{"type":{"type":"string","examples":["operator_note"]}}}}},"sent_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_at":{"type":["string","null"],"format":"date-time","examples":[null]},"direction":{"type":"integer","examples":[2]},"type":{"type":"string","examples":["operator_note"]},"channel":{"type":["string","null"],"examples":["ma_chat"]},"status":{"type":"integer","examples":[3]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"updated_at":{"type":["string","null"],"format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"OperatorNoteList":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#\/components\/schemas\/OperatorNote"}}}},"Tag":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f6"]},"name":{"type":"string","examples":["vip"]},"count":{"type":"integer","description":"Number of contacts with the tag","examples":[42]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}}}}}