{"openapi":"3.0.0","info":{"title":"Viber service API","description":"Using the API for Viber 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":"0.0.1"},"servers":[{"url":"https:\/\/api.sendpulse.com\/viber\/chatbots","description":""}],"tags":[{"name":"account","description":""},{"name":"bots","description":""},{"name":"contacts","description":"(subscribers)"},{"name":"variables","description":""},{"name":"flows","description":""},{"name":"triggers","description":"(keywords)"},{"name":"chats","description":""},{"name":"campaigns","description":"(broadcasts)"}],"paths":{"\/contacts\/get":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["contacts"],"parameters":[{"in":"query","name":"id","required":true,"schema":{"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."}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Contact"}},"type":"object"}}}}}}},"\/contacts\/getByTag":{"get":{"summary":"Get a list of contacts by tag","description":"Returns a list of contacts by tag for the specified bot","security":[{"Authorization by API key":[]}],"tags":["contacts"],"parameters":[{"in":"query","name":"tag","required":true,"schema":{"type":"string"},"description":"Created contact\u2019s tag to search by"},{"in":"query","name":"bot_id","required":true,"schema":{"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."},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Contact"}}},"type":"object"}}}}}}},"\/contacts\/getByVariable":{"get":{"summary":"Get contacts by variable","description":"Returns contacts by variable identifier or variable name for the specified bot","security":[{"Authorization by API key":[]}],"tags":["contacts"],"parameters":[{"in":"query","name":"variable_id","schema":{"type":"string"},"description":"Contact\u2019s variable ID to search by; required parameter if you do not pass variable_name and bot_id."},{"in":"query","name":"variable_name","schema":{"type":"string"},"description":"Contact\u2019s variable name to search by; required parameter and passed with the bot_id parameter, if you do not pass variable_id."},{"in":"query","name":"bot_id","schema":{"type":"string"},"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."},{"in":"query","name":"variable_value","required":true,"schema":{"type":"string"},"description":"Contact's variable value"},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Contact"}}},"type":"object"}}}}}}},"\/contacts\/send":{"post":{"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","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"messages":{"type":"array","description":"Message to send, specifying the type and content of the campaign","items":{"type":"object","description":"Message to send, specifying the type and content of the campaign"}}},"required":["contact_id","message"]},"examples":{"Send a text message":{"value":{"contact_id":"xxxxxxxxxxxxxxxxxxxxxxxx","messages":[{"type":"text","text":{"text":"string","buttons":[[{"text":"Example url button","type":"web_url","url":"https:\/\/example.com\/"}],[{"text":"Example postback button","type":"postback","to_chain_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}]]}}]}},"Send a message with an image":{"value":{"contact_id":"xxxxxxxxxxxxxxxxxxxxxxxx","messages":[{"type":"image","image":{"file":{"is_path_absolute":true,"path":"https:\/\/example.com\/image.png"}}}]}},"Send a message with a carousel":{"value":{"contact_id":"xxxxxxxxxxxxxxxxxxxxxxxx","messages":[{"type":"generic_template","generic_template":[{"title":"Example title","subtitle":"Example subtitle","image":{"is_path_absolute":true,"path":"https:\/\/example.com\/image.png"},"buttons":[[{"type":"web_url","text":"Example button","url":"https:\/\/example.com\/"},{"text":"Example postback button","type":"postback","to_chain_id":"xxxxxxxxxxxxxxxxxxxxxxxx"}]]}]}]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Message ID"},"bot_id":{"type":"string"},"contact_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"message_id":{"type":"string","description":"Viber message ID"}}}}}}}}}}}}}},"\/contacts\/setVariable":{"post":{"summary":"Assign a variable to contact","description":"Adds or updates the value of a variable for the selected contact.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"Choose one of the available request bodies","required":true,"content":{"application\/json":{"schema":{"type":"object","required":["contact_id","variables"],"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."},"variables":{"type":"array","description":"api.paths.contacts.setVariable.parameters.variables","items":{"oneOf":[{"type":"object","required":["variable_name","variable_value"],"properties":{"variable_name":{"type":"string","description":"Name of the variable"},"variable_value":{"description":"The value that is set for the variable","anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}},{"type":"object","required":["variable_id","variable_value"],"properties":{"variable_id":{"type":"string","description":"The ID of the created variable can be obtained via other methods"},"variable_value":{"description":"The value that is set for the variable","anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}}]}}}},"examples":{"Set by variable name":{"value":{"contact_id":"string","variables":[{"variable_name":"string","variable_value":"string"},{"variable_name":"string","variable_value":"string"}]}},"Set by variable ID":{"value":{"contact_id":"string","variables":[{"variable_id":"string","variable_value":"string"},{"variable_id":"string","variable_value":"string"}]}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/deleteVariable":{"post":{"summary":"Delete a variable from the selected contact","description":"Delete the value of a variable for the selected contact.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"Choose one of the available request bodies","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"variable_id":{"type":"string","description":"The ID of the created variable can be obtained via other methods"},"variable_name":{"type":"string","description":"Name of the variable"}},"required":{"0":"contact_id","oneOf":["variable_id","variable_name"]}},"examples":{"Delete by variable ID":{"value":{"contact_id":"string","variable_id":"string"}},"Delete by variable name":{"value":{"contact_id":"string","variable_name":"string"}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/setTag":{"post":{"summary":"Assign a tag to contact","description":"Assigns tags to the selected contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"tags":{"type":"array","description":"List of tags to assign to the contact","items":{"type":"string"}}},"required":["contact_id","tags"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/deleteTag":{"post":{"summary":"Remove a tag from a contact","description":"Removes the tag for the selected contact.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"tag":{"type":"string","description":"Tag you want to remove"}},"required":["contact_id","tag"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/disable":{"post":{"summary":"Disable contact","description":"Disables a contact in your audience list. Campaigns and autoflows will not be sent to this contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."}},"required":["contact_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/enable":{"post":{"summary":"Enable contact","description":"Enables a contact in the audience list, and the contact starts receiving campaigns and autoflows","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."}},"required":["contact_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/delete":{"post":{"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.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."}},"required":["contact_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/getPauseAutomation":{"get":{"summary":"Get remaining time for automation pause","description":"Returns the time remaining until autoflows resume for this contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","required":true,"schema":{"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."}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/setPauseAutomation":{"post":{"summary":"Pause autoflows for a contact","description":"Pauses autoflows for the specified contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"minutes":{"type":"integer","example":60,"description":"Minutes"}},"required":["contact_id","minutes"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/deletePauseAutomation":{"post":{"summary":"Resume autoflows for a contact","description":"Resumes autoflows for the specified contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."}},"required":["contact_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/notes":{"get":{"summary":"Get a list of contact's operator notes","description":"Returns a list of existing operator notes by contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"parameters":[{"in":"query","name":"bot_id","required":true,"schema":{"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."},{"in":"query","name":"contact_id","required":true,"schema":{"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."}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Message"}}},"type":"object"}}}}}},"\/contacts\/createNote":{"post":{"summary":"Send an operator note","description":"Sends an operator note about a contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"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."},"text":{"type":"string","description":"Text of note"}},"required":["contact_id","bot_id","text"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Message"}}}}}}},"\/contacts\/updateNote":{"post":{"summary":"Update operator note","description":"Updates an existing operator note about a contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"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."},"text":{"type":"string","description":"Text of note"},"note_id":{"type":"string","description":"Note ID."}},"required":["contact_id","bot_id","text","note_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Message"}}}}}}},"\/contacts\/deleteNote":{"post":{"summary":"Delete operator note","description":"Deletes an existing operator note about a contact","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"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."},"note_id":{"type":"string","description":"Note ID."}},"required":["contact_id","bot_id","note_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Message"}}}}}}},"\/contacts\/operators\/assign":{"post":{"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.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"operator_id":{"type":"integer","description":"The ID of the operator to assign"}},"required":["contact_id","operator_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"boolean","nullable":true}}}}}}}}},"\/contacts\/operators\/unAssign":{"post":{"summary":"Unassign responsible operators for the chat.","description":"Removes any assigned operator for the chat.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."}},"required":["contact_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"boolean"}}}}}}}}},"\/contacts\/mark-read":{"put":{"summary":"Mark messages as read","description":"Mark all of the contact's messages as read (set unread count to 0)","security":[{"Authorization by API key":[]}],"tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","schema":{"type":"string"},"description":"Contact ID. Used to set its unread message count to 0."}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"count":{"type":"integer","description":"Contact messages count marked as read"}},"type":"object"}}}}}}},"\/contacts\/mark-unread":{"put":{"summary":"Mark a chat with the contact as unread","description":"Marks the last message of a specific contact as unread.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"parameters":[{"in":"query","name":"contact_id","schema":{"type":"string"},"description":"The ID of the contact whose last message will be marked as unread."}],"responses":{"200":{"description":"The number of messages successfully marked as unread.","content":{"application\/json":{"schema":{"properties":{"count":{"type":"integer","example":1,"description":"api.paths.contacts.mark-unread.responses.properties.count"}},"type":"object"}}}}}}},"\/contacts\/openChat":{"post":{"summary":"Open chat for a contact","description":"Increase the chat priority by marking it as open","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."}},"required":["contact_id"]}}}},"responses":{"200":{"description":"Chat opened successfully","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/contacts\/closeChat":{"post":{"summary":"Close chat for a contact","description":"Close the chat and lower the priority.","security":[{"Authorization by API key":[]}],"tags":["contacts"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."}},"required":["contact_id"]}}}},"responses":{"200":{"description":"Chat closed successfully","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/flows":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["flows"],"parameters":[{"in":"query","name":"bot_id","required":true,"schema":{"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."},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Flow"}},"type":"object"}}}}}}},"\/flows\/run":{"post":{"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 chain, where variables will be inserted in the \"Message\" element as a JSON path, for example {{$['tracking_number']}}.","security":[{"Authorization by API key":[]}],"tags":["flows"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"flow_id":{"type":"string","description":"Flow ID to be launched. Can be obtained with the method of obtaining the list of flows"},"external_data":{"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']}}.","example":{"tracking_number":"1234-0987-5678-9012"}}},"required":["contact_id","flow_id"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/flows\/runByTrigger":{"post":{"summary":"Run a flow by trigger keywords","description":"Launches a flow with the trigger keyword for the selected contact","security":[{"Authorization by API key":[]}],"tags":["flows"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"contact_id":{"type":"string","description":"Contact ID. Can be obtained with a contact search by tag or variable. You can also find it in your account in the address bar of a chat window with the desired contact."},"trigger_keyword":{"type":"string","description":"Keyword (command) that launches the flow"},"external_data":{"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']}}.","example":{"tracking_number":"1234-0987-5678-9012"}}},"required":["contact_id","trigger_keyword"]}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SuccessResponse"}}}}}}},"\/triggers":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["triggers"],"parameters":[{"in":"query","name":"bot_id","required":true,"schema":{"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."},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Trigger"}}},"type":"object"}}}}}}},"\/bots":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["bots"],"parameters":[{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Bot"}}},"type":"object"}}}}}}},"\/bots\/statistics":{"get":{"summary":"Get general statistics info by bot","description":"Returns general statistics info by bot","security":[{"Authorization by API key":[]}],"parameters":[{"in":"query","name":"bot_id","required":true,"schema":{"type":"string"},"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."}],"tags":["bots"],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"subscribedTotalCount":{"type":"integer"},"subscribedActiveCount":{"type":"integer"},"outgoingMessagesTotalCount":{"type":"integer"}}}}}}}}}}},"\/chats":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["chats"],"parameters":[{"in":"query","name":"bot_id","required":true,"schema":{"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."},{"in":"query","name":"size","schema":{"type":"integer"}},{"in":"query","name":"skip","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Chat"}}},"type":"object"}}}}}}},"\/chats\/messages":{"get":{"summary":"Get a list of messages","description":"Returns a list of all messages in correspondence with the specified subscriber","security":[{"Authorization by API key":[]}],"tags":["chats"],"parameters":[{"in":"query","name":"contact_id","required":true,"schema":{"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."},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}},{"in":"query","name":"search_after","description":"The ID of the element after which elements will be returned","schema":{"type":"string"}},{"in":"query","name":"order","description":"Sort order ASC or DESC","schema":{"type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Message"}}},"type":"object"}}}}}}},"\/variables":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["variables"],"parameters":[{"in":"query","name":"bot_id","required":true,"schema":{"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."},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Variable"}}},"type":"object"}}}}}}},"\/campaigns\/recipients":{"get":{"summary":"Get campaign recipients","description":"Get a list of campaign recipients with delivery statistics","security":[{"Authorization by API key":[]}],"tags":["campaigns"],"parameters":[{"in":"query","name":"id","required":true,"schema":{"type":"string"},"description":"Campaign ID"},{"in":"query","name":"order","description":"Sort order ASC or DESC","schema":{"type":"string","enum":["asc","desc"]}},{"in":"query","name":"search_after","description":"The ID of the element after which elements will be returned","schema":{"type":"string"}},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Campaign recipients list","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"list":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"contact":{"type":"object"},"campaign_id":{"type":"string"},"sent":{"type":"boolean"},"activity":{"type":"boolean"},"clicked":{"type":"boolean"},"delivered":{"type":"boolean"},"opened":{"type":"boolean"},"buttons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"clicks":{"type":"integer"},"created_at":{"type":"string"},"updated_at":{"type":"string"}}}},"partial_rejected":{"type":"boolean"},"rejected":{"type":"boolean"},"errors":{"type":"array","items":{"type":"object"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}}}},"sort":{"type":"object"},"total":{"type":"integer"},"size":{"type":"integer"},"search_after":{"type":"array","items":{"type":"string"}}}}},"type":"object"}}}}}}},"\/campaigns\/report":{"get":{"summary":"Get campaign report","description":"Get campaign data with sending statistics","security":[{"Authorization by API key":[]}],"tags":["campaigns"],"parameters":[{"in":"query","name":"id","required":true,"schema":{"type":"string"},"description":"Campaign ID"}],"responses":{"200":{"description":"Campaign report","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"id":{"type":"string"},"bot_id":{"type":"string"},"status":{"type":"integer"},"title":{"type":"string"},"send_at":{"type":"string"},"stats":{"type":"object","properties":{"messages":{"type":"object","properties":{"all":{"type":"integer"},"sent":{"type":"integer"},"rejected":{"type":"integer"},"delivered":{"type":"integer"},"opened":{"type":"integer"},"redirected":{"type":"integer"}}},"recipients":{"type":"object","properties":{"all":{"type":"integer"},"sent":{"type":"integer"},"rejected":{"type":"integer"},"partial_rejected":{"type":"integer"},"delivered":{"type":"integer"},"opened":{"type":"integer"},"redirected":{"type":"integer"},"activity":{"type":"integer"}}},"buttons":{"type":"array","items":{"type":"object"}}}},"messages":{"type":"array","items":{"type":"object"}},"created_at":{"type":"string"},"updated_at":{"type":"string"}}}},"type":"object"}}}}}}},"\/campaigns\/send":{"post":{"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","security":[{"Authorization by API key":[]}],"tags":["campaigns"],"requestBody":{"description":"","required":true,"content":{"application\/json":{"schema":{"properties":{"title":{"type":"string","description":"Campaign title"},"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."},"send_at":{"type":"string","description":"Specify the date and time in the format Y-m-d H:i if you need to schedule the campaign, if you do not specify this parameter, the campaign will be sent immediately","example":"Y-m-d H:i"},"filter":{"type":"object","description":"Filter for campaign sending","properties":{"type":{"type":"string","description":"Filter type (and\/or)"},"expressions":{"type":"array","description":"Filter expressions","items":{"type":"object","properties":{"type":{"type":"string","description":"Expression type (and\/or)"},"expressions":{"type":"array","description":"List of expressions","items":{"type":"object","properties":{"operator":{"type":"string","description":"Filter operator (e.g., eq, like, gt, lt, etc.)"},"field":{"type":"string","description":"Field to filter by (e.g., tags)"},"value":{"type":"string","description":"Value to filter by"}}}}}}}}},"messages":{"type":"array","description":"Message to send, specifying the type and content of the campaign","items":{"type":"object","description":"api.paths.contacts.sendText.parameters.message"}}},"required":["title","bot_id","messages"]},"examples":{"Send a campaign with text":{"value":{"title":"string","bot_id":"string","send_at":"Y-m-d H:i","messages":[{"type":"text","text":{"text":"string"}}]}},"Send a campaign with an image":{"value":{"title":"string","bot_id":"string","send_at":"Y-m-d H:i","messages":[{"type":"image","image":{"file":{"is_path_absolute":true,"path":"https:\/\/example.com\/image.png"}}}]}},"Send a campaign with a filter":{"value":{"title":"Campaign with filter","bot_id":"string","send_at":"Y-m-d H:i","messages":[{"type":"text","text":{"text":"string"}}],"filter":{"type":"and","expressions":[{"type":"and","expressions":[{"operator":"eq","field":"tags","value":"SOME_TAG_HERE"}]}]}}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Campaign"}},"type":"object"}}}}}}},"\/tags":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["tags"],"parameters":[{"in":"query","name":"bot_id","required":true,"schema":{"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."},{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Tag"}}},"type":"object"}}}}}}},"\/account":{"get":{"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","security":[{"Authorization by API key":[]}],"tags":["account"],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Account"}},"type":"object"}}}}}}}},"components":{"securitySchemes":{"Authorization by API key":{"type":"http","scheme":"bearer","description":"Paste your API key in the format sp_apikey_*** from the https:\/\/login.sendpulse.com\/settings\/api section"}},"schemas":{"SuccessResponse":{"properties":{"success":{"type":"boolean"},"data":{"anyOf":[{"type":"array","items":{"type":"object"}},{"type":"object"},{"type":"boolean"}]}},"type":"object"},"Account":{"properties":{"tariff":{"type":"object","description":"`-1` - unlimited","properties":{"code":{"type":"string"},"max_bots":{"type":"integer"},"max_contacts":{"type":"integer","example":-1},"max_messages":{"type":"integer"},"max_tags":{"type":"integer"},"max_variables":{"type":"integer"},"branding":{"type":"boolean"},"is_exceeded":{"type":"boolean"},"is_expired":{"type":"boolean"},"expired_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"statistics":{"type":"object","description":"","properties":{"messages":{"type":"integer"},"bots":{"type":"integer"},"contacts":{"type":"integer"},"variables":{"type":"integer"}}}}},"Bot":{"properties":{"id":{"type":"string"},"channel_data":{"type":"object","properties":{"vb_account_info":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"uri":{"type":"string"},"icon":{"type":"string"},"background":{"type":"string","nullable":true},"category":{"type":"string"},"subcategory":{"type":"string"},"location":{"type":"object","properties":{"lon":{"type":"float","nullable":true},"lat":{"type":"float","nullable":true}}},"country":{"type":"string"},"webhook":{"type":"string","nullable":true},"event_types":{"type":"array","items":{"type":"string"},"nullable":true}}}}},"inbox":{"type":"object","properties":{"total":{"type":"integer"},"unread":{"type":"integer"}}},"status":{"type":"integer","enum":[3,4],"description":"\n                    * `3` - active\n\n                    * `4` - inactive\n\n                "},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Contact":{"properties":{"id":{"type":"string"},"bot_id":{"type":"string"},"status":{"type":"integer","enum":[1,2,3,4],"description":"\n                    * `1` - active\n\n                    * `2` - unsubscribed\n\n                    * `3` - disabled\n\n                    * `4` - blocked by user\n\n                "},"channel_data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true},"avatar":{"type":"string","nullable":true},"country":{"type":"string"},"language":{"type":"string"}}},"tags":{"type":"array","uniqueItems":true,"items":{"type":"string"}},"variables":{"type":"object","description":"variable_name: variable_value"},"is_chat_opened":{"type":"boolean"},"last_activity_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"},"automation_paused_until":{"type":"string","nullable":true,"example":"2020-12-12T00:00:00+03:00"},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Variable":{"properties":{"id":{"type":"string"},"bot_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"type":{"type":"integer","enum":{"CONTACT":1},"description":"\n                    * `1` - contact variable\n\n                    * `2` - bot variable\n\n                "},"value_type":{"type":"integer","example":1,"enum":{"STRING":1,"NUMBER":2,"DATE":3,"BOOLEAN":4,"PHONE":5,"EMAIL":6,"URL":7,"LOCATION":8,"DATETIME":9,"TIME":10},"description":"\n                this type of variable can have the following values:\n\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                "},"status":{"type":"integer","enum":{"ACTIVE":1,"TRASHED":2},"description":"\n                    * `1` - active\n\n                    * `2` - trashed\n\n                "},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Flow":{"properties":{"id":{"type":"string"},"bot_id":{"type":"string"},"name":{"type":"string"},"status":{"type":"integer","enum":[{"ACTIVE":1,"INACTIVE":2,"DRAFT":4}],"description":"\n                    * `1` - active\n\n                    * `2` - inactive\n\n                "},"triggers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"integer","enum":[1,2,3,4,5],"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                "}}}},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Trigger":{"properties":{"id":{"type":"string"},"bot_id":{"type":"string"},"flow_id":{"type":"string","nullable":true},"name":{"type":"string"},"type":{"type":"integer","enum":[1,2,3,4,5],"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                "},"status":{"type":"integer","enum":{"ACTIVE":1,"INACTIVE":2},"description":"\n                    * `1` - active\n\n                    * `2` - inactive\n\n                "},"keywords":{"type":"array","items":{"type":"string"}},"execution":{"type":"object","properties":{"interval":{"type":"integer"},"units":{"type":"integer","enum":{"MINUTES":1,"HOURS":2,"DAYS":3},"description":"\n                        * `1` - minutes\n\n                        * `2` - hours\n\n                        * `3` - days\n\n                    "}}},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Campaign":{"properties":{"id":{"type":"string"},"bot_id":{"type":"string"},"title":{"type":"string"},"send_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"},"messages":{"type":"array","items":{"type":"object"}},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Chat":{"properties":{"contact":{"$ref":"#\/components\/schemas\/Contact"},"inbox_last_message":{"$ref":"#\/components\/schemas\/Message"},"inbox_unread":{"type":"integer"}}},"Message":{"properties":{"id":{"type":"string"},"contact_id":{"type":"string"},"bot_id":{"type":"string"},"campaign_id":{"type":"string","nullable":true},"data":{"type":"object","description":"Message data object","example":{"text":"hello"}},"direction":{"type":"integer","enum":{"IN":1,"OUT":2},"description":"\n                    * `1` - in\n\n                    * `2` - out\n\n                "},"status":{"type":"integer","enum":[1,2,3,4,5,6],"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                "},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Tag":{"properties":{"id":{"type":"string"},"name":{"type":"string"},"contact_count":{"type":"integer"},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}}}},"security":[{"Authorization by API key":[]}]}