{"openapi":"3.1.2","info":{"title":"LiveChat service API","description":"Using the API for LiveChat chatbots, you can integrate your system with SendPulse\u2019s chatbots service and get detailed information about your account, bots, subscribers, variables, flows, and chats. You can also create campaigns, launch flows, assign and remove variables and tags.\n\n            \nOn the right, there is a button for authorizing requests made on this page. Click \u201cAuthorize,\u201d then insert the ID and Secret from your account.\n\n            \nTo perform a request directly from the page, click the \"Try it out\" button within each method block. Then fill in input fields if any (for URL parameters, the description is right below the URL request; for body parameters, the description is under the \u201cScheme\u201d button to the right of the example), and click \u201cRun.\u201d You'll find the server response and description of received parameters below.\n        ","version":"1.0.0"},"servers":[{"url":"https:\/\/api.sendpulse.com\/live-chat","description":"SendPulse production API server"}],"security":[{"apiKey":[]}],"tags":[{"name":"account","description":"Account information: pricing plan limits and usage statistics"},{"name":"bots","description":"LiveChat bots (website chat widgets) and their statistics"},{"name":"contacts","description":"Bot contacts (subscribers): search 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":"tags","description":"Contact tags of a bot"}],"paths":{"\/contacts\/get":{"get":{"operationId":"getContact","summary":"Get contact info via a contact ID","description":"Returns information on the selected contact: bot and contact ID, information from messenger, list of tags and variables, activity data and date added","tags":["contacts"],"parameters":[{"in":"query","name":"id","required":true,"description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContactResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/getByTag":{"get":{"operationId":"getContactsByTag","summary":"Get a list of contacts by tag","description":"Returns a list of contacts by tag for the specified bot","tags":["contacts"],"parameters":[{"in":"query","name":"tag","required":true,"description":"Created contact\u2019s tag to search by","schema":{"type":"string","minLength":1,"maxLength":32},"example":"vip"},{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContactPageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/getByVariable":{"get":{"operationId":"getContactsByVariable","summary":"Get contacts by variable","description":"Returns contacts by variable identifier or variable name for the specified bot","tags":["contacts"],"parameters":[{"in":"query","name":"variable_id","required":false,"description":"Contact\u2019s variable ID to search by; required parameter if you do not pass variable_name and bot_id.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"in":"query","name":"variable_name","required":false,"description":"Contact\u2019s variable name to search by; required parameter and passed with the bot_id parameter, if you do not pass variable_id.","schema":{"type":"string","minLength":1,"maxLength":255},"example":"city"},{"in":"query","name":"bot_id","required":false,"description":"Bot ID; required parameter and passed with the variable_name parameter, if you do not pass variable_id. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"in":"query","name":"variable_value","required":true,"description":"Contact's variable value","schema":{"type":"string"},"example":"Kyiv"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ContactPageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/send":{"post":{"operationId":"sendMessages","summary":"Send a message to a contact","description":"Sends a text message, image, or a file to the 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","messages"],"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"]},"messages":{"type":"array","minItems":1,"maxItems":20,"description":"Messages to send, in the order they are delivered (1-20)","items":{"$ref":"#\/components\/schemas\/LcOutgoingMessage"}}}},"examples":{"send_text":{"summary":"Send a text message","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","messages":[{"type":"text","text":{"text":"Example text","buttons":[[{"text":"Example url button","type":"web_url","url":"https:\/\/example.com\/"}],[{"text":"Example postback button","type":"postback","to_chain_id":"60c9d4b8e0f3b2a1c4d5e6f8"}]]}}]}},"send_image":{"summary":"Send a message with an image","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","messages":[{"type":"image","image":{"file":{"path":"https:\/\/example.com\/image.png"}},"reply_to":{"message_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}}]}},"send_file":{"summary":"Send a message with a file","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","messages":[{"type":"document","document":{"file":{"path":"https:\/\/example.com\/file.pdf"}}}]}}}}}},"responses":{"200":{"description":"The sent messages. If sending fails after validation, the endpoint still responds with HTTP 200, `data: false`, and the error text in `message`","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageListResponse"}}}},"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\/setName":{"post":{"operationId":"setContactName","summary":"Set a contact name","description":"Sets the full name of a contact","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","name"],"properties":{"contact_id":{"type":"string","description":"Contact ID","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"name":{"type":"string","maxLength":64,"description":"New full name of the contact (up to 64 characters)","examples":["John Doe"]}}}}}},"responses":{"200":{"description":"`data` is `true` when the name was saved","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/openChat":{"post":{"operationId":"openContactChat","summary":"Open chat for a contact","description":"Increase the chat priority by marking it as open","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Chat opened successfully","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/closeChat":{"post":{"operationId":"closeContactChat","summary":"Close chat for a contact","description":"Close the chat and lower the priority.","tags":["contacts"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]}}}}}},"responses":{"200":{"description":"Chat closed successfully","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/mark-read":{"put":{"operationId":"markContactMessagesRead","summary":"Mark messages as read","description":"Mark all of the contact's messages as read (set unread count to 0)","tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","required":true,"description":"Contact ID. Used to set its unread message count to 0.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageCountResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/contacts\/mark-unread":{"put":{"operationId":"markContactMessagesUnread","summary":"Mark a chat with the contact as unread","description":"Marks the last message of a specific contact as unread.","tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","required":true,"description":"The ID of the contact whose last message will be marked as unread.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"The number of messages successfully marked as unread.","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessageCountResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/flows":{"get":{"operationId":"getFlows","summary":"Get a list of flows","description":"Returns a list of created flows for the selected bot and information for each: flow id, bot id, status, name, id and name of the trigger that launches it, and creation date","tags":["flows"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/FlowListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/flows\/run":{"post":{"operationId":"runFlow","summary":"Run a flow by its ID","description":"Launches the selected flow for the selected contact. Additional data can be passed to the \"external_data\" field and used once in the selected flow, where variables will be inserted in the \"Message\" element as a JSON path, for example {{$['tracking_number']}}.","tags":["flows"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","flow_id"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"flow_id":{"type":"string","description":"Flow ID to be launched. Can be obtained with the method of obtaining the list of flows","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"external_data":{"$ref":"#\/components\/schemas\/ExternalData"},"start_block_id":{"type":["string","null"],"format":"uuid","description":"Block ID to start the flow from. If not specified, the flow starts from the first block.","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]}}},"examples":{"run_flow":{"summary":"Run a flow","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","flow_id":"60c9d4b8e0f3b2a1c4d5e6f8","external_data":{"tracking_number":"1234-0987-5678-9012"}}},"run_flow_from_block":{"summary":"Start a flow from the specified flow element","value":{"contact_id":"60c9d4b8e0f3b2a1c4d5e6f7","flow_id":"60c9d4b8e0f3b2a1c4d5e6f8","external_data":{"tracking_number":"1234-0987-5678-9012"},"start_block_id":"3f2504e0-4f89-11d3-9a0c-0305e82c3301"}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/flows\/runByTrigger":{"post":{"operationId":"runFlowByTrigger","summary":"Run a flow by trigger keywords","description":"Launches a flow with the trigger keyword for the selected contact","tags":["flows"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","trigger_keyword"],"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"trigger_keyword":{"type":"string","minLength":1,"maxLength":128,"description":"Keyword (command) that launches the flow","examples":["start"]},"external_data":{"$ref":"#\/components\/schemas\/ExternalData"}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BooleanResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/triggers":{"get":{"operationId":"getTriggers","summary":"Get a list of triggers","description":"Returns the list of created triggers for the selected bot with information about each of them: trigger ID, bot id, id of the flow that starts on it, name, type, set launch time and creation date","tags":["triggers"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/TriggerListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/bots":{"get":{"operationId":"getBots","summary":"Get a list of connected bots","description":"Returns lists of bots with information about each: bot ID, channel information, number of received and unread messages, bot status, and creation date","tags":["bots"],"parameters":[{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BotListResponse"}}}},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/bots\/statistics":{"get":{"operationId":"getBotStatistics","summary":"Get general statistics info by bot","description":"Returns general statistics info by bot","tags":["bots"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"The bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/BotStatisticsResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/chats":{"get":{"operationId":"getChats","summary":"Get a list of chats","description":"Returns a list of chats with subscribers with information about the contact and the last message received from the contact","tags":["chats"],"parameters":[{"in":"query","name":"bot_id","required":false,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/ChatPageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/chats\/messages":{"get":{"operationId":"getChatMessages","summary":"Get a list of messages","description":"Returns a list of all messages in correspondence with the specified subscriber","tags":["chats"],"parameters":[{"in":"query","name":"contact_id","required":true,"description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"},{"$ref":"#\/components\/parameters\/search_after"},{"$ref":"#\/components\/parameters\/order"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/MessagePageResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/variables":{"get":{"operationId":"getVariables","summary":"Get a list of variables","description":"Returns a list of variables for the selected bot with information about each: variable ID, bot ID, name, affiliation, type, status, and creation date","tags":["variables"],"parameters":[{"in":"query","name":"bot_id","required":true,"description":"Bot ID. Can be obtained with a method of getting a list of bots. You can also find it in your account in the address bar of a chat window with the desired contact.","schema":{"type":"string"},"example":"60c9d4b8e0f3b2a1c4d5e6f7"},{"$ref":"#\/components\/parameters\/size"},{"$ref":"#\/components\/parameters\/skip"}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/VariableListResponse"}}}},"400":{"$ref":"#\/components\/responses\/BadRequest"},"401":{"$ref":"#\/components\/responses\/Unauthorized"},"403":{"$ref":"#\/components\/responses\/Forbidden"},"422":{"$ref":"#\/components\/responses\/UnprocessableEntity"}}}},"\/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`)","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]}}},"BooleanResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"boolean","examples":[true]}}},"IntegerResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"integer","examples":[1]}}},"DateTimeResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"NullableDateTimeResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":["string","null"],"format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"AccountResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Account"}}},"BotListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Bot"}}}},"BotStatisticsResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/BotStatistics"}}},"ChatPageResponse":{"type":"object","required":["success","data","meta"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Chat"}},"links":{"$ref":"#\/components\/schemas\/PaginationLinks"},"meta":{"$ref":"#\/components\/schemas\/PaginationMeta"}}},"ContactPageResponse":{"type":"object","required":["success","data","meta"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Contact"}},"links":{"$ref":"#\/components\/schemas\/PaginationLinks"},"meta":{"$ref":"#\/components\/schemas\/PaginationMeta"}}},"ContactResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/Contact"}}},"FlowListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Flow"}}}},"MessageCountResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/MessageCount"}}},"MessagePageResponse":{"type":"object","required":["success","data","meta"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Message"}},"links":{"$ref":"#\/components\/schemas\/PaginationLinks"},"meta":{"$ref":"#\/components\/schemas\/PaginationMeta"}}},"OperatorNoteListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/OperatorNoteList"}}},"OperatorNoteResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"$ref":"#\/components\/schemas\/OperatorNote"}}},"TagListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Tag"}}}},"TriggerListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Trigger"}}}},"VariableListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Variable"}}}},"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"}]},"LcButton":{"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":["60c9d4b8e0f3b2a1c4d5e6f8"]}}},"LcButtonRows":{"type":"array","description":"Button rows: an array of rows, each row is an array of buttons","items":{"type":"array","items":{"$ref":"#\/components\/schemas\/LcButton"}}},"LcFileMessage":{"type":"object","required":["file"],"properties":{"file":{"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"]}}},"caption":{"type":["string","null"],"description":"Text shown with the file","examples":["Our price list"]},"buttons":{"$ref":"#\/components\/schemas\/LcButtonRows"}}},"LcOutgoingMessage":{"type":"object","description":"Message to send. Put the content into the field named after the message type","required":["type"],"properties":{"type":{"type":"string","enum":["text","image","document","typing"],"description":"Message type; the content goes into the field with the same name (`text`, `image`, `document`)","examples":["text"]},"text":{"type":"object","description":"Text message","required":["text"],"properties":{"text":{"type":"string","examples":["Example text"]},"buttons":{"$ref":"#\/components\/schemas\/LcButtonRows"}}},"image":{"$ref":"#\/components\/schemas\/LcFileMessage","description":"Image message"},"document":{"$ref":"#\/components\/schemas\/LcFileMessage","description":"File message"},"reply_to":{"type":"object","description":"Reply to a specific message","properties":{"message_id":{"type":"string","description":"SendPulse ID of the received message to reply to"}},"required":["message_id"]}}},"MessageListResponse":{"type":"object","required":["success","data"],"properties":{"success":{"type":"boolean","examples":[true]},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Message"}},"message":{"type":"string","examples":["Instagram API error"]}}},"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":["60c9d4b8e0f3b2a1c4d5e6f0"]},"channel":{"type":"string","examples":["LIVE_CHAT"]},"name":{"type":"string","examples":["Website chat"]},"avatar":{"type":["string","null"],"description":"Bot avatar URL","examples":["https:\/\/www.cdn.com\/avatar.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]},"inbox":{"type":"object","properties":{"total":{"type":"integer","examples":[42]},"unread":{"type":"integer","examples":[3]}}},"variables":{"type":"array","description":"Bot variables with their values","items":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fa"]},"name":{"type":"string","examples":["discount"]},"value_type":{"type":"integer","examples":[2]},"value":{"type":["string","number","boolean"],"examples":[10]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]},"updated_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}}},"settings":{"type":"object","description":"Bot settings. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"properties":{"service_links":{"type":"boolean","examples":[true]},"open_chat_notification":{"type":"boolean","examples":[true]},"disable_trigger_hints":{"type":"boolean","examples":[false]},"standard_text_settings":{"type":"object","properties":{"trigger_autocorrection_request_indicator":{"type":"string","examples":["Did you mean"]}}},"create_contacts_in_crm":{"type":"boolean","examples":[false]},"pause_automation_minutes":{"type":"integer","examples":[60]},"save_incoming_attachments_to_storage":{"type":"boolean","examples":[false]},"create_contacts_in_crm_settings":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":["object","null"],"additionalProperties":true}}},"widget":{"type":"object","description":"Chat widget settings","properties":{"sp_site":{"type":["integer","null"],"examples":[12345]},"website_url":{"type":"string","examples":["https:\/\/example.com"]},"website_scheme":{"type":"string","examples":["https"]},"website_domain":{"type":"string","examples":["example.com"]},"title":{"type":"string","examples":["Chat with us"]},"greeting":{"type":["string","null"],"examples":["Hi! How can we help?"]},"position":{"type":"string","examples":["right"]},"color":{"type":"string","examples":["#0086ff"]},"show_greet_on_load":{"type":"boolean","examples":[false]},"terms":{"type":["object","null"],"description":"Terms link shown in the widget","properties":{"title":{"type":"string","examples":["Privacy policy"]},"link":{"type":"string","examples":["https:\/\/example.com\/privacy"]}}},"commands_menu":{"type":["object","null"],"description":"Commands menu of the widget","properties":{"status":{"type":"integer","enum":[1,2],"examples":[1]},"commands":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]},"type":{"type":"string","examples":["postback"]},"text":{"type":"string","examples":["Start"]},"to_chain_id":{"type":["string","null"],"examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"url":{"type":"string","examples":["https:\/\/example.com\/"]}}}}}}}},"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]},"statistics":{"type":"object","description":"Returned only when `with_stats` is set","properties":{"total_subscribers":{"type":"integer","examples":[400]},"subscribed":{"type":"integer","examples":[350]},"messages_incoming":{"type":"integer","examples":[1200]},"messages_outgoing":{"type":"integer","examples":[3400]}}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"BotStatistics":{"type":"object","properties":{"subscribed_total_count":{"type":"integer","examples":[350]},"subscribed_active_count":{"type":"integer","examples":[300]},"outgoing_messages_total_count":{"type":"integer","examples":[3400]}}},"ContactOperator":{"type":["object","null"],"properties":{"user_id":{"type":"integer","description":"The operator user ID","examples":[1234567]},"username":{"type":"string","description":"The operator full name","examples":["Jane Smith"]},"email":{"type":"string","description":"The operator email","examples":["jane@example.com"]},"avatar":{"type":["string","null"],"description":"The operator avatar URL","examples":["https:\/\/www.cdn.com\/avatar.png"]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Contact":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"status":{"type":"integer","enum":[0,1,2,3,4,5,6,7,8,9],"description":"\n                    * `0` - new\n\n                    * `1` - active\n\n                    * `2` - unsubscribed\n\n                    * `3` - disabled\n\n                    * `4` - blocked by user\n\n                    * `5` - reference\n\n                    * `6` - deleted\n\n                    * `7` - invalid\n\n                    * `8` - referral\n\n                    * `9` - duplicate\n\n                ","examples":[1]},"type":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - subscriber\n\n                    * `2` - bot owner\n\n                ","examples":[1]},"online":{"type":"boolean","description":"Whether the contact is currently online on the website","examples":[true]},"channel_data":{"type":"object","description":"Website visitor data of the contact","properties":{"id":{"type":"string","description":"LiveChat visitor ID","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]},"full_name":{"type":["string","null"],"examples":["John Doe"]},"url":{"type":["string","null"],"description":"Page URL the visitor started the chat from","examples":["https:\/\/example.com\/pricing"]},"lang":{"type":["string","null"],"description":"Browser language of the visitor","examples":["en"]}}},"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":["SUBSCRIPTION_WIDGET"]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Variable":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fa"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"name":{"type":"string","examples":["city"]},"description":{"type":["string","null"],"examples":["Contact city"]},"type":{"type":"integer","enum":[1],"description":"\n                    * `1` - contact variable\n\n                ","examples":[1]},"value_type":{"type":"integer","enum":[1,2,3,4,5,6,7,8,9,10],"description":"\n                    * `1` - string\n\n                    * `2` - number\n\n                    * `3` - date\n\n                    * `4` - boolean\n\n                    * `5` - phone\n\n                    * `6` - email\n\n                    * `7` - url\n\n                    * `8` - location\n\n                    * `9` - datetime\n\n                    * `10` - time\n\n                ","examples":[1]},"status":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - active\n\n                    * `2` - trashed\n\n                ","examples":[1]},"mapping":{"type":["object","null"],"description":"Mapping of the variable to a CRM contact attribute","properties":{"crm":{"type":["object","null"],"properties":{"attribute_id":{"type":"integer","examples":[101]},"is_attribute_required":{"type":"boolean","examples":[false]}}}}},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Flow":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"name":{"type":["string","null"],"examples":["Welcome flow"]},"status":{"type":"integer","enum":[1,2,4],"description":"\n                    * `1` - active\n\n                    * `2` - inactive\n\n                    * `4` - draft\n\n                ","examples":[1]},"triggers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f2"]},"name":{"type":"string","examples":["start"]},"type":{"type":"integer","description":"\n                    * `1` - starts immediately upon subscription\n\n                    * `2` - starts when unsubscribed\n\n                    * `3` - default reply\n\n                    * `4` - starts when the specified keyword is entered\n\n                    * `5` - starts at the specified time when subscribing\n\n                ","examples":[4]}}}},"errors":{"type":["array","null"],"description":"Flow validation errors; `null` when the flow has no errors","items":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true}},"is_public":{"type":"boolean","examples":[false]},"is_public_can_copy":{"type":"boolean","examples":[false]},"folder_id":{"type":["string","null"],"examples":["60c9d4b8e0f3b2a1c4d5e6f3"]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}},"Trigger":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f2"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"flow_id":{"type":["string","null"],"examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"name":{"type":"string","examples":["start"]},"type":{"type":"integer","description":"\n                    * `1` - starts immediately upon subscription\n\n                    * `2` - starts when unsubscribed\n\n                    * `3` - default reply\n\n                    * `4` - starts when the specified keyword is entered\n\n                    * `5` - starts at the specified time when subscribing\n\n                ","examples":[4]},"status":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - active\n\n                    * `2` - inactive\n\n                ","examples":[1]},"keywords":{"type":"array","items":{"type":"string"},"examples":[["start","hello"]]},"keywords_search_type":{"type":["integer","null"],"description":"\n                    * `1` - STRICT_MATCH\n\n                    * `2` - CONTAINS\n\n                ","examples":[1]},"execution":{"$ref":"#\/components\/schemas\/TriggerExecution"},"a360_event":{"type":["object","null"],"description":"Event that starts the flow (for A360 triggers)","properties":{"uuid":{"type":"string","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]},"name":{"type":"string","examples":["Order paid"]}}},"pixel":{"type":["object","null"],"description":"Pixel event that starts the flow","properties":{"project_id":{"type":"string","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]}}},"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":["60c9d4b8e0f3b2a1c4d5e6f9"]},"contact_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"data":{"type":"object","description":"LiveChat message payload. Its fields depend on the message type (for example `text`, `image`, `buttons`); `subscriber_id` is the LiveChat visitor ID. For payment messages the object contains payment details. When empty, it is returned as an empty array `[]` instead of an object `{}`","additionalProperties":true,"properties":{"subscriber_id":{"type":"string","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]}},"examples":[{"subscriber_id":"3f2504e0-4f89-11d3-9a0c-0305e82c3301","text":"hello"}]},"type":{"type":"string","enum":["text","image","document","typing","user_input","carousel","manual_start_flow","service_payment","operator","operator_note","operator_group_assigned","a360_start_flow","pixel_start_flow"],"description":"Message type","examples":["text"]},"direction":{"type":"integer","enum":[1,2],"description":"\n                    * `1` - in\n\n                    * `2` - out\n\n                ","examples":[2]},"status":{"type":"integer","enum":[1,2,3,4,5,6,7,8,9],"description":"\n                    * `1` - new\n\n                    * `2` - sent\n\n                    * `3` - delivered\n\n                    * `4` - opened\n\n                    * `5` - redirected\n\n                    * `6` - rejected\n\n                    * `7` - delete failed\n\n                    * `8` - deleted\n\n                    * `9` - played\n\n                ","examples":[3]},"channel":{"type":["string","null"],"enum":["ma","ma_chat","api","rss","echo","jivo","open_ai","deepseek_ai","anthropic_ai","gemini_ai","payment","notification_bot","soa",null],"description":"Source that produced the message","examples":["api"]},"campaign":{"type":["object","null"],"description":"Campaign the message was sent by","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fe"]},"size":{"type":"integer","examples":[2]},"message_num":{"type":"integer","examples":[1]}}},"chain":{"type":["object","null"],"description":"Flow and block the message was sent by","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f8"]},"block_id":{"type":"string","format":"uuid","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]}}},"campaign_id":{"type":["string","null"],"description":"ID of the campaign; returned for payment and operator messages","examples":[null]},"sent_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_by":{"$ref":"#\/components\/schemas\/MessageSender"},"reject_reason":{"type":["string","null"],"examples":[null]},"attachment_url":{"type":["string","null"],"description":"URL of the attachment sent with the message","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"]}}},"MessageCount":{"type":"object","properties":{"count":{"type":"integer","description":"Number of messages whose read state was changed","examples":[3]}}},"OperatorNote":{"type":"object","description":"Operator note left in the contact chat","properties":{"_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6fc"]},"user_id":{"type":"integer","examples":[1234567]},"bot_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f0"]},"contact_id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f7"]},"text":{"type":"string","description":"Note text","examples":["Customer asked to call back tomorrow"]},"channel_data":{"type":"object","properties":{"subscriber_id":{"type":"string","examples":["3f2504e0-4f89-11d3-9a0c-0305e82c3301"]},"message":{"description":"Arbitrary key-value data. When empty, it is returned as an empty array `[]` instead of an object `{}`","type":"object","additionalProperties":true,"properties":{"text":{"type":"string","examples":["Customer asked to call back tomorrow"]}}}}},"sent_by":{"$ref":"#\/components\/schemas\/MessageSender"},"edited_by":{"$ref":"#\/components\/schemas\/MessageSender"},"direction":{"type":"integer","examples":[2]},"type":{"type":"string","examples":["operator_note"]},"channel":{"type":["string","null"],"examples":["ma_chat"]},"status":{"type":"integer","examples":[3]},"campaign":{"type":"null","examples":[null]},"chain":{"type":"null","examples":[null]},"reject_reason":{"type":["string","null"],"examples":[null]},"attachment_url":{"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"]}}},"OperatorNoteList":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#\/components\/schemas\/OperatorNote"}}}},"Tag":{"type":"object","properties":{"id":{"type":"string","examples":["60c9d4b8e0f3b2a1c4d5e6f6"]},"name":{"type":"string","examples":["vip"]},"count":{"type":"integer","description":"Number of contacts with the tag","examples":[42]},"created_at":{"type":"string","format":"date-time","examples":["2020-12-12T00:00:00+03:00"]}}}}}}