Send a message to get response from the bot

POST /messages

Sends a message to the bot and returns the response

Body

This is the message body object

  • bot_id string Required

    The id of the Bot to which this question will be asked

  • content string Required

    The content of the message

  • Conversation Id provides the bot with additional context of last few messages to answer the question. A new Conversation Id is created when it is not provided.

Responses

  • A message response to be returned

    Hide response attributes Show response attributes object
  • Invalid Request body or missing required parameters

    Hide response attributes Show response attributes object
    • code string

      An error code specific to the error.

    • message string

      A human-readable message providing more details about the error.

  • Insufficient Credits

    Hide response attributes Show response attributes object
    • code string

      An error code specific to the error.

    • message string

      A human-readable message providing more details about the error.

POST /messages
curl \
 -X POST https://api.hansei.app/public/v1/messages \
 -H "X-API-KEY: $API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"value":{"bot_id":"bot_4uPeOYWyQ01C8Epg","content":"How do I download my salary slips?"}}'
Request example
{
  "value": {
    "bot_id": "bot_4uPeOYWyQ01C8Epg",
    "content": "How do I download my salary slips?"
  }
}
Request examples
{
  "bot_id": "string",
  "content": "string",
  "conversation_id": "string"
}
Response examples (200)
{
  "value": {
    "id": "msg_wh28S3JlAosqRigy",
    "answer": "To download your salary slips, please visit...",
    "conversation_id": "conv_eMB2wHLKzvaxLMDJ",
    "created_at": 1697386660315
  }
}
Response examples (200)
{
  "id": "msg_wh28S3JlAosqRigy",
  "answer": "Hello, how can I help you?",
  "conversation_id": "conv_uFTwrKcx59i24ZOw",
  "created_at": 1697386660315
}
Response examples (400)
{
  "code": "string",
  "message": "string"
}
Response examples (400)
{
  "code": "string",
  "message": "string"
}
Response examples (402)
{
  "code": "string",
  "message": "string"
}
Response examples (402)
{
  "code": "string",
  "message": "string"
}