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
The project's settings
Every incoming or outcoming message comes with the following json POST requests:
{
'id': the identifier of the message in the system,
'client': {
'id': the identifier of the client in the system,
'recepient': the identifier of the client in the messenger,
'client_type': the messenger’s type,
'name': the client’s name,
'avatar': the client’s avatar,
'created_at': the date when the client was created,
'tag': the subscription key,
'group': the bot to which the client is tied to,
},
'message': the message text,
'attachments': the array of links to files,
'message_id': the id of the block from which the message was sent from,
'project_id': the project’s id,
'is_input': 1 if the message is from a client, 0 if it’s from the bot,
'delivered': 1 if the message is sent successfully, 0 if there was an error,,
'error_message': the message explaining the error
}
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.
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_
post
https://chatter.salebot.ai
/api/<api_key>/callback
The bot’s launch
post
https://chatter.salebot.ai
/api/<api_key>/whatsapp_callback
Launching the bot through the number on WhatsApp
post
https://chatter.salebot.ai
/api/<api_key>/tg_callback
Bot launch through Telegram id
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:
"buttons": {"hint": "This text will be shown in Whatsapp",
"buttons": [
{"type": "reply",
"text": "What services we can provide",
"line": 0, "index_in_line": 0},
{"type": "reply",
"text": "Payment info",
"line": 0,
"index_in_line": 1},
{"type": "reply",
"text": "Our contact info",
"line": 1, "index_in_line": 0},
{"type": "reply",
"text": "Leave an application",
"line": 1, "index_in_line": 1}
]
}
post
https://chatter.salebot.ai
/api/<api_key>/message
Sending the message to the client
post
https://chatter.salebot.ai
/api/<api_key>/whatsapp_message
Sending messages in WhatsApp
post
https://chatter.salebot.ai
/api/<api_key>/broadcast
Sending messages in bulk
get
https://chatter.salebot.ai
/api/<api_key>/get_history?client_id=
Getting the message history
get
https://chatter.salebot.ai
/api/<api_key>/clear_history?client_id=
Clearing the message history
get
https://chatter.salebot.ai
/api/<api_key>/assign_to_user
Assigning a client to an employee
get
https://chatter.salebot.ai
/api/<api_key>/load_clients
Loading clients into the system
post
https://chatter.salebot.ai
/api/<api_key>/add_to_list
Adding clients to the list
post
https://chatter.salebot.ai
/api/<api_key>/remove_from_list
Removing clients from the list
post
https://chatter.salebot.ai
/api/<api_key>/get_clients
Getting the clients list
post
https://chatter.salebot.ai
/api/<api_key>/subscribers
Getting the subscribers list in any messenger
post
https://chatter.salebot.ai
/api/<api_key>/save_variables
Attributing variables
get
https://chatter.salebot.ai
/api/<api_key>/get_variables?client_id=
Obtaining variables
post
https://chatter.salebot.ai
/api/<api_key>/find_client_id_by_platform_id
Getting client_id by the platform_id value
get
https://chatter.salebot.ai
/api/<api_key>/online_chat_client_id?recipient=
How to get client id on Online chat
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.
get
https://chatter.salebot.ai
/api/<api_key>/whatsapp_client_id?phone=
How to get client id with the WhatsApp number
get
https://chatter.salebot.ai
/api/<api_key>/find_client_id_by_phone?phone=
Getting client id with the phone number
get
https://chatter.salebot.ai
/api/<api_key>/find_client_id_by_email?email=
Getting client id through email
get
https://chatter.salebot.ai
/api/<api_key>/find_client_id_by_var?var=&val=
Getting client id by the variable value
post
https://chatter.salebot.ai
/api/<api_key>/set_order_state
Moving the transaction into the SalebotCRM state
get
https://chatter.salebot.ai
/api/<api_key>/check_insta_subscription
Checking if the person follows the Instagram account
get
https://chatter.salebot.ai
/api/<api_key>/check_whatsapp
Checking if the phone number carries WhatsApp
get
https://chatter.salebot.ai
/api/<api_key>/connected_channels
Getting the list of messengers connected to the project (including group_id)
get
https://chatter.salebot.ai
/api/<api_key>/get_messages
Getting the list of blocks from the bot’s schema
If you need additional methods, please contact customer support
Last modified 1yr ago