{"openapi":"3.1.2","info":{"title":"Bridge service API","description":"Using the API for Bridge 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            \nThe API works with the following Bridge channels: Telegram Personal, SMS, Viber Personal, CRM Email Inbox, Viber Campaigns Reply Bot, LinkedIn-Snovio integration, and Line messenger.\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\/bridge","description":"SendPulse production API server"}],"security":[{"apiKey":[]}],"tags":[{"name":"account","description":"Account information: pricing plan limits and usage statistics"},{"name":"bots","description":"Bridge bots: list, create, and update bots of Bridge channels"},{"name":"contacts","description":"Bot contacts (subscribers): list contacts, send messages, 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"}],"paths":{"\/contacts":{"get":{"operationId":"getContacts","summary":"Get a list of contacts","description":"Returns lists of contacts with information about each","tags":["contacts"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f0"},{"$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\/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\/send":{"post":{"operationId":"sendMessage","summary":"Send a message to a contact","description":"Sends a text message, image, or a file to a contact with the specified contact ID.  To view an example of the request body, select a message type from the drop-down list","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","message"],"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":["66b0a840d4d9d1155e433221"]},"message":{"$ref":"#\/components\/schemas\/CommonMessage"}}},"examples":{"send_text":{"summary":"Send a text message","value":{"contact_id":"66b0a840d4d9d1155e433221","message":{"type":"text","text":{"text":"Hello World!"}}}},"send_text_with_reply_to":{"summary":"Send a text message with reply_to","value":{"contact_id":"66b0a840d4d9d1155e433221","message":{"type":"text","text":{"text":"Hello World!"},"reply_to":{"message_id":"66f1c8a2d0b34e7f9a15c0d4"}}}},"send_text_with_buttons":{"summary":"Send a text message with buttons","value":{"contact_id":"66b0a840d4d9d1155e433221","message":{"type":"text","text":{"text":"Hello World!","buttons":[[{"text":"Example url button","type":"web_url","url":"https:\/\/example.com\/"}],[{"text":"Example postback button","type":"postback","to_chain_id":"5decdd1780c52b05583c7ca5"}]]}}}},"send_image":{"summary":"Send a message with an image","value":{"contact_id":"66b0a840d4d9d1155e433221","message":{"type":"image","image":{"file":{"path":"https:\/\/example.com\/image.png"},"caption":"Hello World!"}}}},"send_file":{"summary":"Send a message with a file","value":{"contact_id":"66b0a840d4d9d1155e433221","message":{"type":"document","document":{"file":{"path":"https:\/\/example.com\/file.pdf"}}}}}}}}},"responses":{"200":{"description":"The sent message as stored in SendPulse; `data` is an empty array when nothing was sent","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageDocumentResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/send-by-phone":{"post":{"operationId":"sendMessageByPhone","summary":"Send a message to a contact by phone number","description":"Sends a text message, image, or a file to a contact with the specified contact phone number.  To view an example of the request body, select a message type from the drop-down list","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["bot_id","phone","message"],"properties":{"bot_id":{"type":"string","description":"Bot ID","examples":["67939d81b1920d2640050cc4"]},"phone":{"type":"string","description":"Contact phone number in international format, digits only","examples":["380939876543"]},"message":{"$ref":"#\/components\/schemas\/CommonMessage"}}},"examples":{"send_text":{"summary":"Send a text message","value":{"bot_id":"67939d81b1920d2640050cc4","phone":"380939876543","message":{"type":"text","text":{"text":"Hello World!"}}}},"send_image":{"summary":"Send a message with an image","value":{"bot_id":"67939d81b1920d2640050cc4","phone":"380939876543","message":{"type":"image","image":{"file":{"path":"https:\/\/example.com\/image.png"},"caption":"Hello World!"}}}}}}}},"responses":{"200":{"description":"The sent message as stored in SendPulse; `data` is an empty array when nothing was sent","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageDocumentResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/send-by-username":{"post":{"operationId":"sendMessageByUsername","summary":"Send a message to a contact by username","description":"Sends a text message, image, or a file to a contact with the specified contact username.  To view an example of the request body, select a message type from the drop-down list","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["bot_id","username","message"],"properties":{"bot_id":{"type":"string","description":"Bot ID","examples":["67939d81b1920d2640050cc4"]},"username":{"type":"string","minLength":3,"maxLength":255,"description":"Contact username in the Bridge channel","examples":["john_doe"]},"message":{"$ref":"#\/components\/schemas\/CommonMessage"}}},"example":{"bot_id":"67939d81b1920d2640050cc4","username":"john_doe","message":{"type":"text","text":{"text":"Hello World!"}}}}}},"responses":{"200":{"description":"The sent message as stored in SendPulse; `data` is an empty array when nothing was sent","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageDocumentResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"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\/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"}}}},"\/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\/openedChatsCount":{"get":{"operationId":"getOpenedChatsCount","summary":"Get the number of opened chats","description":"Returns the number of opened chats in all Bridge bots of the account","tags":["bots"],"responses":{"200":{"description":"Number of opened chats","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ChatCountResponse"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"}}}},"\/bots\/create":{"post":{"operationId":"createBot","summary":"Create the bot","description":"Creates a bot of a Bridge channel. The response contains the bot `token` used by the integration to authenticate its requests","tags":["bots"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["internal_id","name","service"],"properties":{"internal_id":{"type":"string","minLength":3,"maxLength":256,"description":"Internal ID of the bot","examples":["380939876543"]},"name":{"type":"string","minLength":3,"maxLength":128,"description":"Bot name","examples":["My Personal TG bot"]},"service":{"type":"integer","enum":[1001,1002,1003,1004,1005,1006,1007],"description":"Service ID: 1000 \u2014 Sandbox Bridge (test bot, see \/bots\/create-test), 1001 \u2014 Telegram Personal, 1002 \u2014 SMS, 1003 \u2014 Viber Personal, 1004 \u2014 CRM Email Inbox, 1005 \u2014 Viber Campaigns Reply Bot, 1006 \u2014 LinkedIn-Snovio integration, 1007 \u2014 Line messenger","examples":[1001]},"avatar":{"type":["string","null"],"pattern":"^https?:\/\/.*\\.(png|jpg)$","description":"Avatar URL","examples":["https:\/\/example.com\/image.png"]}}},"example":{"internal_id":"380939876543","name":"My Personal TG bot","service":1001,"avatar":"https:\/\/example.com\/image.png"}}}},"responses":{"200":{"description":"The bot","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BotResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/bots\/create-test":{"post":{"operationId":"createTestBot","summary":"Create test bot","description":"Creates a Sandbox Bridge test bot that sends outgoing messages to `api_url`","tags":["bots"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TestBotInput"},"example":{"internal_id":"380939876543","name":"My test bot","api_url":"https:\/\/example.com\/","avatar":"https:\/\/example.com\/image.png"}}}},"responses":{"200":{"description":"The bot","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BotResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/bots\/update-test":{"put":{"operationId":"updateTestBot","summary":"Update test bot","description":"Updates a Sandbox Bridge test bot","tags":["bots"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TestBotUpdateInput"},"example":{"bot_id":"66b0a840d4d9d1155e433221","internal_id":"380939876543","name":"My test bot","api_url":"https:\/\/example.com\/","avatar":"https:\/\/example.com\/image.png"}}}},"responses":{"200":{"description":"The bot","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BotResponse"}}}},"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":"60c9d4b8e0f3b2a1c4d5e6f0"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Chats. The list with its `links` and `meta` is nested one level deeper: `data` contains its own `success`, `data`, `links` and `meta`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ChatsResponse"}}}},"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":"Page of chat messages as stored in SendPulse. Contains `skip`, `page` and `last_page` when `skip` is used, otherwise `search_after`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageDocumentPageResponse"}}}},"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. 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":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["title","bot_id","messages"],"properties":{"title":{"type":"string","minLength":1,"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":"Date and time to send the campaign, in the account time zone, format `Y-m-d H:i`; must not be in the past. When omitted, the campaign is sent immediately","examples":["2030-12-12 10:00"]},"messages":{"type":"array","minItems":1,"description":"Message to send, specifying the type and content of the campaign","items":{"$ref":"#\/components\/schemas\/CommonMessage"}},"filter":{"$ref":"#\/components\/schemas\/CampaignFilter"}}},"examples":{"send_text":{"summary":"Send a text message","value":{"title":"Campaign title","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"2030-12-12 10:00","messages":[{"type":"text","text":{"text":"Example text"}}]}},"send_image":{"summary":"Send a message with an image","value":{"title":"Campaign title","bot_id":"60c9d4b8e0f3b2a1c4d5e6f0","send_at":"2030-12-12 10:00","filter":{"type":"and","expressions":[{"type":"and","expressions":[{"operator":"eq","field":"tags","value":"SOME_TAG_HERE"}]}]},"messages":[{"type":"image","image":{"file":{"path":"https:\/\/www.cdn.com\/photo.png"}}}]}}}}}},"responses":{"201":{"description":"The created campaign as stored in SendPulse","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"}}}},"\/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":"http","scheme":"bearer","description":"API key in the format `sp_apikey_***` from https:\/\/login.sendpulse.com\/settings\/api; enter the key only, it is sent as `Authorization: Bearer sp_apikey_***`"}},"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, 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"}}}},"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`, also returned when the maximum number of bots for the pricing plan is reached)","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":{"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]}}},"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]}}},"BotResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Bot"}}},"ChatCountResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/ChatCount"}}},"ChatsResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/ChatPage"}}},"MessageDocumentResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/MessageDocument"}}},"MessageDocumentPageResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/MessageDocumentPage"}}},"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":{"$ref":"#\/components\/schemas\/BotList"}}},"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"}}},"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"}}},"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\/MessageDocument"}}},"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"}}}},"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"}]},"CommonButton":{"type":"object","description":"Message button","required":["type","text"],"properties":{"type":{"type":"string","enum":["web_url","postback"],"description":"Button type: `web_url` opens `url`, `postback` starts the flow `to_chain_id`","examples":["web_url"]},"text":{"type":"string","examples":["Example button"]},"url":{"type":"string","description":"URL opened by a `web_url` button","examples":["https:\/\/example.com\/"]},"to_chain_id":{"type":"string","description":"ID of the flow started when a `postback` button is pressed","examples":["5decdd1780c52b05583c7ca5"]}}},"CommonButtonRows":{"type":"array","description":"Button rows: an array of rows, each row is an array of buttons","items":{"type":"array","items":{"$ref":"#\/components\/schemas\/CommonButton"}}},"CommonMessageFile":{"type":"object","description":"File to send","required":["path"],"properties":{"path":{"type":"string","description":"Public URL of the file","examples":["https:\/\/example.com\/image.png"]},"filename":{"type":["string","null"],"description":"File name shown to the contact","examples":["image.png"]}}},"CommonFileMessage":{"type":"object","description":"Media or file message","required":["file"],"properties":{"file":{"$ref":"#\/components\/schemas\/CommonMessageFile"},"caption":{"type":["string","null"],"description":"Text shown with the file","examples":["Hello World!"]},"buttons":{"$ref":"#\/components\/schemas\/CommonButtonRows"}}},"CommonVideoMessage":{"type":"object","description":"Media or file message","required":["file"],"properties":{"file":{"$ref":"#\/components\/schemas\/CommonMessageFile"},"caption":{"type":["string","null"],"description":"Text shown with the file","examples":["Hello World!"]}}},"CommonAudioMessage":{"type":"object","description":"Media or file message","required":["file"],"properties":{"file":{"$ref":"#\/components\/schemas\/CommonMessageFile"}}},"CommonMessage":{"type":"object","description":"Message content: the field named after `type` holds the content (`text`, `image`, `video`, `audio`, `document`, `email`)","required":["type"],"properties":{"type":{"type":"string","enum":["text","image","video","audio","document"],"description":"Message type, can have the values \"text,\" \"image,\" or \"document\"","examples":["text"]},"text":{"type":"object","description":"Text message","required":["text"],"properties":{"text":{"type":"string","examples":["Hello World!"]},"buttons":{"$ref":"#\/components\/schemas\/CommonButtonRows"}}},"image":{"$ref":"#\/components\/schemas\/CommonFileMessage"},"video":{"$ref":"#\/components\/schemas\/CommonVideoMessage"},"audio":{"$ref":"#\/components\/schemas\/CommonAudioMessage"},"document":{"$ref":"#\/components\/schemas\/CommonFileMessage"},"reply_to":{"type":["object","null"],"description":"Reply to a specific message","required":["message_id"],"properties":{"message_id":{"type":"string","description":"SendPulse ID of the received message to reply to","examples":["66f1c8a2d0b34e7f9a15c0d4"]}}}}},"CampaignFilterCondition":{"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":["SOME_TAG_HERE"]}}},"CampaignFilterGroup":{"type":"object","properties":{"type":{"type":"string","description":"Expression type (and\/or)","examples":["and"]},"expressions":{"type":"array","description":"List of expressions","items":{"$ref":"#\/components\/schemas\/CampaignFilterCondition"}}}},"CampaignFilter":{"type":["object","null"],"description":"Filter that selects campaign recipients","properties":{"type":{"type":"string","description":"Filter type (and\/or)","examples":["and"]},"expressions":{"type":"array","description":"Filter expressions","items":{"$ref":"#\/components\/schemas\/CampaignFilterGroup"}}}},"Account":{"type":"object","properties":{"tariff":{"$ref":"#\/components\/schemas\/AccountTariff"},"statistics":{"$ref":"#\/components\/schemas\/AccountStatistics"}}},"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":["66b0a840d4d9d1155e433221"]},"user_id":{"type":"integer","examples":[1234567]},"name":{"type":"string","examples":["My Personal TG bot"]},"service":{"type":"integer","enum":[1000,1001,1002,1003,1004,1005,1006,1007],"description":"Bridge channel\n\n                    * `1000` - Sandbox Bridge (test bot)\n\n                    * `1001` - Telegram Personal\n\n                    * `1002` - SMS\n\n                    * `1003` - Viber Personal\n\n                    * `1004` - CRM Email Inbox\n\n                    * `1005` - Viber Campaigns Reply Bot\n\n                    * `1006` - LinkedIn-Snovio integration\n\n                    * `1007` - Line messenger\n\n                ","examples":[1001]},"channel":{"type":"string","examples":["BRIDGE_TELEGRAM_PERSONAL_PROFILE"]},"internal_id":{"type":"string","description":"ID of the bot in the Bridge channel","examples":["380939876543"]},"app_id":{"type":["string","null"],"examples":[null]},"token":{"type":"string","description":"Bot token; the integration uses it to authenticate its requests to SendPulse","examples":["a1b2c3d4e5f6"]},"api_url":{"type":"string","description":"URL of the integration API that receives outgoing messages","examples":["https:\/\/example.com\/"]},"avatar":{"type":["string","null"],"examples":["https:\/\/example.com\/image.png"]},"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]},"owner_id":{"type":"null","examples":[null]},"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"]}}}},"contact_variables":{"type":"array","description":"Active contact variables of the bot","items":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true}},"unavailable_elements":{"type":"array","description":"Message elements the channel does not support (for example `buttons`, `quick_replies`)","items":{"type":"string","enum":["buttons","quick_replies","generic_template","image","document","typing"]},"examples":[["buttons","quick_replies"]]},"integrations":{"type":"object","description":"Bot integrations; API keys and tokens are masked. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true},"webhooks":{"type":["object","null"],"description":"Webhook settings of the bot","properties":{"status":{"type":"integer","examples":[1]},"url":{"type":"string","examples":["https:\/\/example.com\/webhook"]},"events":{"type":"array","items":{"type":"string"},"examples":[["incoming_message"]]}}},"settings":{"type":"object","description":"Bot settings. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"properties":{"service_links":{"type":"boolean","examples":[true]},"open_chat_notification":{"type":"boolean","examples":[true]},"disable_trigger_hints":{"type":"boolean","examples":[false]},"create_contacts_in_crm":{"type":"boolean","examples":[false]},"save_incoming_attachments_to_storage":{"type":"boolean","examples":[false]}}},"version":{"type":"string","examples":["1.1.1"]},"delete_at":{"type":["string","null"],"format":"date-time","description":"Date and time when the bot is scheduled for deletion","examples":[null]},"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"]}}},"BotList":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#\/components\/schemas\/Bot"}}}},"TestBotInput":{"type":"object","required":["internal_id","name","api_url"],"properties":{"internal_id":{"type":"string","minLength":3,"maxLength":256,"description":"Internal ID of the bot","examples":["380939876543"]},"name":{"type":"string","minLength":3,"maxLength":128,"description":"Bot name","examples":["My test bot"]},"api_url":{"type":"string","format":"uri","description":"Base URL of the API","examples":["https:\/\/example.com\/"]},"avatar":{"type":["string","null"],"pattern":"^https?:\/\/.*\\.(png|jpg)$","description":"Avatar URL","examples":["https:\/\/example.com\/image.png"]}}},"TestBotUpdateInput":{"type":"object","required":["bot_id","internal_id","name","api_url"],"properties":{"bot_id":{"type":"string","description":"Bot ID","examples":["66b0a840d4d9d1155e433221"]},"internal_id":{"type":"string","minLength":3,"maxLength":256,"description":"Internal ID of the bot","examples":["380939876543"]},"name":{"type":"string","minLength":3,"maxLength":128,"description":"Bot name","examples":["My test bot"]},"api_url":{"type":"string","format":"uri","description":"Base URL of the API","examples":["https:\/\/example.com\/"]},"avatar":{"type":["string","null"],"pattern":"^https?:\/\/.*\\.(png|jpg)$","description":"Avatar URL","examples":["https:\/\/example.com\/image.png"]}}},"ChatCount":{"type":"object","properties":{"count":{"type":"integer","examples":[5]}}},"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"]}}},"Contact":{"type":"object","properties":{"id":{"type":"string","examples":["66b0a840d4d9d1155e433221"]},"bot_id":{"type":"string","examples":["67939d81b1920d2640050cc4"]},"service":{"type":"integer","description":"Bridge channel of the contact (see `service` of the bot)","examples":[1001]},"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":"Contact profile in the Bridge channel","properties":{"id":{"type":"string","examples":["380939876543"]},"first_name":{"type":["string","null"],"examples":["John"]},"last_name":{"type":["string","null"],"examples":["Doe"]},"full_name":{"type":["string","null"],"examples":["John Doe"]},"username":{"type":["string","null"],"examples":["john_doe"]},"phone":{"type":["integer","null"],"examples":[380939876543]},"email":{"type":["string","null"],"examples":["john@example.com"]},"picture":{"type":["string","null"],"examples":["https:\/\/www.cdn.com\/contact.png"]}}},"meta_data":{"type":["object","null"],"description":"Additional channel-specific data of the contact. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true},"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"]},"unsubscribed_at":{"type":["string","null"],"format":"date-time","examples":[null]},"automation_paused_until":{"type":["string","null"],"format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"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"]}}},"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":[null]},"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]}}}},"is_public":{"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]},"media_ids":{"type":"array","description":"IDs of channel posts the trigger reacts to","items":{"type":["string","integer"]},"examples":[["17900000000000000"]]},"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","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]},"event_id":{"type":"string","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","description":"The created campaign as stored in SendPulse","properties":{"_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fe"]},"user_id":{"type":"integer","examples":[1234567]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"title":{"type":"string","examples":["Black Friday sale"]},"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":[1]},"type":{"type":"integer","examples":[1]},"channel":{"type":"string","examples":["api"]},"messages":{"type":"array","items":{"$ref":"#\/components\/schemas\/CommonMessage"}},"filter":{"$ref":"#\/components\/schemas\/CampaignFilter"},"stats":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true},"send_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"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"]}}},"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\/CommonMessage"}},"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"]},"name":{"type":["string","null"],"examples":["John Doe"]},"photo":{"type":"null","examples":[null]},"user_name":{"type":"string","description":"ID of the contact in the Bridge channel","examples":["380939876543"]}}},"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"]}}},"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":["66f1c8a2d0b34e7f9a15c0d4"]},"contact_id":{"type":"string","examples":["66b0a840d4d9d1155e433221"]},"bot_id":{"type":"string","examples":["67939d81b1920d2640050cc4"]},"data":{"type":["object","null"],"description":"Incoming message payload as received from the Bridge channel; `message_id` is the message ID in the channel. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"properties":{"message_id":{"type":["string","null"],"examples":["12345"]}}},"type":{"$ref":"#\/components\/schemas\/MessageTypeValue"},"direction":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - in\n\n                    * `2` - out\n\n                ","examples":[1]},"status":{"$ref":"#\/components\/schemas\/MessageStatusValue"},"channel":{"$ref":"#\/components\/schemas\/MessageChannelValue"},"service":{"type":"integer","examples":[1001]},"reply_to_message_id":{"type":["string","null"],"description":"ID of the message this message replies to","examples":[null]},"campaign":{"$ref":"#\/components\/schemas\/MessageCampaignRef"},"chain":{"$ref":"#\/components\/schemas\/MessageChainRef"},"sent_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_by":{"$ref":"#\/components\/schemas\/MessageSender"},"reject_reason":{"type":["string","null"],"examples":[null]},"attachments":{"type":["array","null"],"description":"Message attachments","items":{"$ref":"#\/components\/schemas\/MessageAttachment"}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"MessageTypeValue":{"type":"string","enum":["text","image","video","audio","document","typing","user_input","email","service_payment","operator","operator_note","operator_group_assigned","pixel_start_flow"],"description":"Message type","examples":["text"]},"MessageStatusValue":{"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]},"MessageChannelValue":{"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"]},"MessageCampaignRef":{"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]}}},"MessageChainRef":{"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"]}}},"MessageDocument":{"type":"object","description":"Message as stored in SendPulse","properties":{"_id":{"type":"string","examples":["66f1c8a2d0b34e7f9a15c0d4"]},"user_id":{"type":"integer","examples":[1234567]},"contact_id":{"type":"string","examples":["66b0a840d4d9d1155e433221"]},"bot_id":{"type":"string","examples":["67939d81b1920d2640050cc4"]},"type":{"$ref":"#\/components\/schemas\/MessageTypeValue"},"direction":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - in\n\n                    * `2` - out\n\n                ","examples":[2]},"status":{"$ref":"#\/components\/schemas\/MessageStatusValue"},"channel":{"$ref":"#\/components\/schemas\/MessageChannelValue"},"service":{"type":"integer","examples":[1001]},"text":{"type":["string","null"],"examples":["Hello World!"]},"channel_data":{"type":"object","description":"Channel data of the message: `outbound` holds the sent content, `inbound` the received content, `id` the message ID in the channel","properties":{"id":{"type":["string","null"],"examples":["12345"]},"reply_to_message_id":{"type":["string","null"],"examples":[null]},"tread_id":{"type":["string","null"],"examples":[null]},"tread_title":{"type":["string","null"],"examples":[null]},"outbound":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":["object","null"],"additionalProperties":true},"inbound":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":["object","null"],"additionalProperties":true}}},"reply_to_message_id":{"type":["string","null"],"description":"ID of the message this message replies to","examples":[null]},"campaign":{"$ref":"#\/components\/schemas\/MessageCampaignRef"},"chain":{"$ref":"#\/components\/schemas\/MessageChainRef"},"sent_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_by":{"$ref":"#\/components\/schemas\/MessageSender"},"reject_reason":{"type":["string","null"],"examples":[null]},"attachments":{"type":["array","null"],"description":"Message attachments","items":{"$ref":"#\/components\/schemas\/MessageAttachment"}},"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"]}}},"MessageDocumentPage":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#\/components\/schemas\/MessageDocument"}},"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":[["66f1c8a2d0b34e7f9a15c0d4"]]}}},"ChatPage":{"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"}}},"MessageCount":{"type":"object","properties":{"count":{"type":"integer","description":"Number of messages whose read state was changed","examples":[3]}}},"OperatorNoteList":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#\/components\/schemas\/MessageDocument"}}}},"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"]}}}}}}