About the API
This API can be used to communicate with your bot through your own applications, such as mobile apps. It is not meant to be used to create bots, only to interact with the ones you already created.
The first thing you're going to need is your bot's
API token
. This can be found in
My Bots
.
Headers
Every request made to the API
must
include the following headers:
Content-Type: application/json
api-token: [YOUR BOT'S API TOKEN]
Endpoints
Method |
Endpoint |
Description |
Actions |
POST |
/v1/chats/create |
Receives a bot username, creates a chat for this bot and returns the chat id. |
View requests |
Request
{
chat_data: {
bot_username: [BOT USERNAME]
}
}
Success response
{
success: true,
chat_id:[CHAT_ID]
}
Error response
{
success: false,
error_message: [ERROR MESSAGE]
}
|
POST |
/v1/messages/create |
Receives a message from the user and returns the bot’s reply.
The chat_id must match the one received by the previous endpoint.
|
View requests |
Request
{
message_data: {
bot_username: [BOT USERNAME],
chat_id: [CHAT_ID],
message: [MESSAGE CONTENT]
}
}
Success response
{
success: true,
bot_reply: [REPLY CONTENT]
}
Error response
{
success: false,
error_message: [ERROR MESSAGE]
}
|