The editing software's API
Which requests the editing software supports and how to carry them out
The requests are carried out with the method POST on URL i.e. https://chatter.salebot.pro/api/{api_key}/{action}
Where it’s located: api_key is the key to accessing API which is obtained in the project’s settings:
You can get the access key by using the variable #{api_key}. It holds the relevant generated key. Don’t forget to generate one before using it.
When copying the url of the query from this page a space is put in that needs to be deleted when calling
An example of copying the link the wrong way: https://chatter.salebot.pro /api/callback
The space after .pro is easy to not notice but if it’s left in place the query won’t work
When sending the request with the GET method, don’t use prohibited words. Look into the right formation of GET requests
How to get messages on Webhook URL that is specified in the project’s settings
Every incoming or outcoming message comes with the following json POST requests:
If the request came back with an error it won’t be resent. If the server came back with an error then the notifications will come through despite this.
How to use a universal webhook
These methods now can be launched with both the POST and the GET request.
Previously, the parameters (with which the clients’ methods were launched, i.e. client_id) were very strictly written in our methods and it would implement some restrictions when using them with the third-party services.
Now you can point out in which parameter of the request Salebot will look for the identifier of the user: for this, a parameter with the prefix value_ is used, like value_user_id and value_group_id.
Also the method for sending the callback callback can be launched by transmitting an email (client_email) and a client’s phone number (client_phone).
Methods callback and whatsapp_callback aren’t tied to the parameter’s names. You can specify which parameter will hold the client’s phone number, email and id.
It’s useful when you’re setting up the webhook’s reception through another site.
To specify which variable holds client_id you need to transfer value_client_id and mention the name of the parameter with this value in it
To specify which variable holds phone you need to transfer value_phone and mention the name of the parameter with this value in it
To specify which variable holds email you need to transfer value_email and mention the name of the parameter with this value in it
To specify which variable holds user_id you need to transfer value_user_id and mention the name of the parameter with this value in it
To specify which variable holds group_id you need to transfer value_group_id and mention the name of the parameter with this value in it
Example:
Type in the address value_client_id = my_client
https://chatter.salebot.pro/api/d3f31dabef80ddeb73d43938b4ef8bb0/callback?value_client_id=my_client
{"my_client":49177759, "message":"Hello world"}
The query will be the equivalent to the query below:
https://chatter.salebot.pro/api/d3f31dabef80ddeb73d43938b4ef8bb0/callback
{"client_id":49177759, "message":"Hello world"}
As you can see, the name of the parameter that holds the name is differentiated by the prefix value_
How to launch the bot
The bot’s launch
POST
https://chatter.salebot.ai/api/<api_key>/callback
The method can be used for launching the workflow for the client or for approving the action on a third-party service. This message won’t be visible for the client. Additionally transferred parameters are saved in the variables. The method for sending the callback can now be turned on by sharing an email (client_email) or the client’s phone number (client_phone)
Path Parameters
api_key
string
access token
Request Body
client_phone
string
phone number using which the client is found
client_email
string
email using which the client is found
client_id
string
client’s id in the editor
message
string
the message text
Launching the bot through the number on WhatsApp
POST
https://chatter.salebot.ai/api/<api_key>/whatsapp_callback
This method launches the bot in WhatsApp after the client registers through the site or after they leave a request with their phone number Additionally transferred parameters are saved to the variables
Path Parameters
api_key
string
access token
Request Body
name
string
the client’s name
message
string
the message text
phone
string
the client's phone number
bot_id
string
the bot's id
Bot launch through Telegram id
POST
https://chatter.salebot.ai/api/<api_key>/tg_callback
The method can be used for launching the workflow or confirming actions on a third-party site. This message won't be visible to the client. Additionally transferred parameters are saved to the variables
Path Parameters
api_key
string
access token
Request Body
message
string
the message text
user_id
string
the user's id in Telegram
group_id
string
the bot's name (must end in bot)
How to work with messages
Params for sending messages
attachment_type can take these values: image, video, link, file, audio When sending attachments the parameter message isn’t mandatory
buttons identifies the buttons that will be attached to the message. The buttons’ format is comparable to the button’s advanced settings. Two variants of the buttons’ transmition are possible: one with the tooltip in messengers without buttons and one without it
Here’s an example of the buttons parameter:
Sending the message to the client
POST
https://chatter.salebot.ai/api/<api_key>/message
This method can be used for sending messages with notifications. The parameter message is mandatory if you’re not sending a file. If you are, then the text isn’t needed
Path Parameters
api_key
string
the access key
Request Body
message_id
string
the sending block's number
message
string
the message text
client_id
string
the client's id in the editor
attachment_type
string
the file display type
attachment_url
string
the file's URL
buttons
object
buttons
Sending messages in WhatsApp
POST
https://chatter.salebot.ai/api/<api_key>/whatsapp_message
Allows sending a message from the name of the connected bot to the mentioned number whatsapp_bot_id has to be taken from the “Messengers and chats” section. Each connected WhatsApp page gets a unique identification
Path Parameters
api_key
string
the access key
Request Body
message_id
string
the sending block's number
whatsapp_bot_id
number
the WhatsApp bot that sends the message
attachment_url
string
the file's url
attachment_type
string
the file display type
message
string
the message text
phone
string
the recipient's phone number
Sending messages in bulk
POST
https://chatter.salebot.ai/api/<api_key>/broadcast
The method allows message distribution. If the param clients isn’t mentioned, the broadcast will be sent out to all users. It’s necessary to either send a file or a text
Path Parameters
api_key
string
the access key
Request Body
message_id
string
the sending block's number
list
string
the list of recipients' numbers
shift
string
the amount of seconds between messages. 0.2 by default
message
string
the message text
clients
array
the recipients' ids
attachment_type
string
the file display type
attachment_url
string
the file's URL
buttons
string
buttons
Getting the message history
GET
https://chatter.salebot.ai/api/<api_key>/get_history?client_id=
Getting the message history. You can get the client_id param HERE
Path Parameters
api_key
string
the access key
Query Parameters
client_id
string
the client's id
Clearing the message history
GET
https://chatter.salebot.ai/api/<api_key>/clear_history?client_id=
Path Parameters
api_key
string
the access key
Query Parameters
client_id
string
the client's id
How to distribute the clients
Assigning a client to an employee
GET
https://chatter.salebot.ai/api/<api_key>/assign_to_user
The method allows assigning a client to an employee. The email parameter is optional. If the email isn’t provided, it will be distributed through the system’s algorithm
Path Parameters
api_key
string
the access key
Query Parameters
client_id
String
the client's id
String
the worker's email (optional)
Loading clients into the system
GET
https://chatter.salebot.ai/api/<api_key>/load_clients
The method allows loading clients into the system. When uploading WhatsApp clients you can transfer the number freely with the @s.whatsapp.net at the end or without it.
You can get the group id (group_id) here through /api/<api_key>/connected_channels
(if client_type=13 (telephony) then group_id=””)
You can see the type of messenger the client came from (client_type)
Ex.: [{"platform_id":"79875555555","group_id":34810,"client_type":6}]
Path Parameters
api_key
string
the access key
Request Body
platform_id
String
the phone number
group_id
String
the group id
client_type
String
the type of messenger the client came from
Adding clients to the list
POST
https://chatter.salebot.ai/api/<api_key>/add_to_list
Path Parameters
api_key
string
the access key
Request Body
list_id
integer
the list's number
clients
array
the clients' numbers' array
Removing clients from the list
POST
https://chatter.salebot.ai/api/<api_key>/remove_from_list
Path Parameters
api_key
string
the access key
Request Body
list_id
integer
the list's number
clients
array
the clients' numbers' array
Getting the clients list
POST
https://chatter.salebot.ai/api/<api_key>/get_clients
Path Parameters
api_key
string
the access key
Query Parameters
offset
string
offset from the first element
limit
integer
the amount of elements in the answer. 500 by default, max. 500
list
string
the list's number
Getting the subscribers list in any messenger
POST
https://chatter.salebot.ai/api/<api_key>/subscribers
Getting the information on the clients in the chosen messenger
Path Parameters
api_key
string
the access key
Query Parameters
page
integer
tag
string
the tag that was mentioned on t subscription page
group
integer
the id of the group the subscriber is tied to
date_from
integer
timestamp of the date after they subscribed
date_to
integer
timestamp of the date they subscribed until
client_type
integer
the id of the messenger to which you need to sub list. if you change nothing all clients come up
How to work with variables
Attributing variables
POST
https://chatter.salebot.ai/api/<api_key>/save_variables
Allows saving variables in the application and in the client. The request of attributing variables by default adds to transaction variables. If you need to change the variables in the profile you need to add the prefix client. Ex. for mobile: client.phone
The param clients allows attributing variables in bulk
Ex.: {"client_id":49177759, "variables": {"client.phone":"1234567890"}}
Path Parameters
api_key
string
the access key
Request Body
clients
array
clients id array for assigning variables
client_id
string
client's id
variables
object
variable hash (key value)
Obtaining variables
GET
https://chatter.salebot.ai/api/<api_key>/get_variables?client_id=
Path Parameters
api_key
string
access token
Query Parameters
client_id
string
client id
How to get client_id
Getting client_id by the platform_id value
POST
https://chatter.salebot.ai/api/<api_key>/find_client_id_by_platform_id
The method returns the client id for executing requests to the API
Example of parameters: {"platform_ids": ["571830542", "256865200"]}
Path Parameters
string
access key
Request Body
platform_ids
string
ids array in the messenger
How to get client id on Online chat
GET
https://chatter.salebot.ai/api/<api_key>/online_chat_client_id?recipient=
This method allows to integrate the site and chatbot, i.e. if a person went on the page with the special offer, you can send out instantly a message about the offer in the chat
Path Parameters
api_key
string
access token
Query Parameters
tag
string
customer tag
name
string
the client's name
recipient
string
the dialogue id on the site
Where do you get the recipient? On the site that carries online chat “Salebot.pro” you need to get the feature SaleBotPro.recipient_id with the help of JS.
How to get client id with the WhatsApp number
GET
https://chatter.salebot.ai/api/<api_key>/whatsapp_client_id?phone=
The method gives back the client id for executing requests to the API if you know the client’s phone number in WhatsApp. If there is no such client with this number, you’ll get a 404.
Path Parameters
api_key
string
access token
Query Parameters
phone
string
the phone number
Getting client id with the phone number
GET
https://chatter.salebot.ai/api/<api_key>/find_client_id_by_phone?phone=
The method gives back the client id for executing requests to the API. The search happens through WhatsApp clients, as well as through variables.
Path Parameters
api_key
string
access token
Query Parameters
phone
string
the phone number
Getting client id through email
GET
https://chatter.salebot.ai/api/<api_key>/find_client_id_by_email?email=
The method gives back the client id for executing requests to the API. The search happens through variables.
Path Parameters
api_key
string
access token
Query Parameters
string
email for search
Getting client id by the variable value
GET
https://chatter.salebot.ai/api/<api_key>/find_client_id_by_var?var=&val=
The method gives back the client id for executing requests to the API
Path Parameters
api_key
string
access token
Query Parameters
var
string
the name of the variable the search will go on through
val
string
the variable value
What other possibilities there are
Moving the transaction into the SalebotCRM state
POST
https://chatter.salebot.ai/api/<api_key>/set_order_state
The transaction number can be obtained in the SalebotCRM workflow’s editing window.
Path Parameters
api_key
string
the access key
Request Body
client_id
string
client's id
state_id
string
the state number to transfer the client’s transaction into
Checking if the person follows the Instagram account
GET
https://chatter.salebot.ai/api/<api_key>/check_insta_subscription
Can be called with both the POST method and the GET method
Path Parameters
api_key
string
the access key
Request Body
user_name
string
the username of the client you want to check
login
string
the login of the bot that’s being checked
Checking if the phone number carries WhatsApp
GET
https://chatter.salebot.ai/api/<api_key>/check_whatsapp
To use the method you HAVE to have connected WhatsApp and Salebot
Can be called with both the POST method and the GET method The phone number can be transferred in any format
Path Parameters
api_key
string
access token
Request Body
phone
string
the phone number
Getting the list of messengers connected to the project (including group_id)
GET
https://chatter.salebot.ai/api/<api_key>/connected_channels
The function returns the parameter group_id to each messenger and it is the one that needs to be transferred when loading the clients
The field status also returns for WhatsApp, and it holds a value of: NOT_STARTED = 0 STARTED = 1 ASLEEP = 2 STOPPED = 3
Path Parameters
api_key
string
access token
Getting the list of blocks from the bot’s schema
GET
https://chatter.salebot.ai/api/<api_key>/get_messages
Path Parameters
api_key
string
access token
If you need additional methods, please contact customer support
Last updated