Follow the three steps below to create your first bot and get chatting right away
Create a bot by sending a POST request to the /bots endpoint with the following payload
{
"title": "My Bot",
"summary": "This is a demo bot",
"description": "This is a demo bot that has been created by RapidApi",
"default_response": "Sorry I don't understand."
}
You will receive a response like the following which contains the unique slug string to identify your botโฆ
{
"success": true,
"data": {
"id": 1,
"slug": "my-bot",
"title": "My Bot",
"summary": "This is a demo bot",
"description": "This is a demo bot that has been created by RapidApi",
"default_response": "Sorry I don't understand.",
"image": "https://api.dicebear.com/6.x/personas/svg?seed=B4ulEGv5vmbNlh3J8lJA&size=128",
"locked": false,
"created_at": "2023-04-13T19:49:39.000000Z",
"updated_at": "2023-04-13T19:49:39.000000Z"
},
"message": "Bot saved successfully"
}
Create a client by sending an empty POST request to the /clients endpoint
{}
Or if you want to specify your own identifier for your client you can send a post body
{
"slug": "123-456-789-0"
}
You will receive a response like the following which contains the unique slug string to indentify your clientโฆ
{
"success": true,
"data": {
"id": 1,
"slug": "123-456-789-0",
"is_banned": false,
"image": "https://api.dicebear.com/6.x/personas/svg?seed=B4ulEGv5vmbNlh3J8lJA&size=128",
"created_at": "2023-04-19T14:18:00.664Z",
"updated_at": "2023-04-19T14:18:00.664Z"
},
"message": "Client saved successfully"
}
Now your client can talk to your botโฆ by sending a POST request to the /chat endpoint.
The payload will include the bot and clients slugs and the message
{
"bot": "my-bot",
"client": "123-456-789-0",
"message": "hello"
}
You will receive a response like the following which contains the unique slug string to indentify your clientโฆ
{
"success": true,
"data": {
"conversation": {
"id": 1,
"input": "Hello",
"output": "Goodbye",
"topic": ""
},
"bot": {
"id": 1,
"slug": "my-bot",
"name": "My Bot",
"image": "https://api.dicebear.com/6.x/personas/svg?seed=dilly&size=128"
},
"client": {
"id": 1,
"slug": "123-456-789-0",
"image": "https://api.dicebear.com/6.x/personas/svg?seed=226b72&size=128",
"is_banned": false
},
"features": {},
"metadata": {
"version": "9.0.5",
"date": "2023-04-14T14:50:05.788707Z",
"duration": 1059
}
},
"message": "Chat successful"
}