Fetch bot history
Use the /api/bot/chats/user
endpoint to fetch a bot's chat history.
Endpoint Details
- Route:
/api/bot/chats/user
- Method: POST
Request payload
- api_key: Your API key for authentication.
- bot_id: ID of the bot.
- username: User's name receiving the message.
- user_id: Unique identifier for the user.
- is_api: False
Example payload
Object
{
"api_key": "da9e35478221a0ccbe28a5598bf24e78",
"bot_id": "bc38325df27a79f0e53f46c1a151cfd7",
"username": "John Doe",
"user_id": "5ere3e3f32vf342r2f",
"is_api": false
}
Response
history
field which contains list of messages each of which is a json object with the following fields:
{
"history": [
{
"message_id" : "ID of the message",
"message" : "Text formatted message"
"is_bot" : "True if the message is sent by bot else false"
"created_at" : "timestamp"
"username" : "username to whom the message belongs to"
"is_voice" : "true if the message was sent or received in audio format"
"voice_path" : "path to the audio file"
"image_path" : "path to the image file"
},
...
]
}
Example usage
curl -X POST "https://api.botworx.io/api/bot/chats/user" \
-d '{"api_key":"da9e35478221a0ccbe28a5598bf24e78","bot_id":"bc38325df27a79f0e53f46c1a151cfd7","username":"John Doe","user_id":"5ere3e3f32vf342r2f","is_api":false}'