AI Chatbot Platform API v3
AI Chatbot
Version 3

Generate AI chatbot replies

Copy link

With the AI chatbot replies API, you can generate AI chatbot responses to user messages.


HTTP request

Copy link
POST https://api-{application_id}.sendbird.com/v3/bots/{bot_user_id}/ai_chatbot_replies

Headers

Copy link
Content-Type: application/json; charset=utf8
{gate_secret_header_key}: ...
OR
Api-Token: {PLATFORM API AUTH}

  • Content-Type: every request must include a Content-Type header.
  • Api-Token: Your API requests must be authenticated by Sendbird server using any of the API tokens from your Sendbird application. To do this, you can use the master API token in your dashboard under Settings > Application > General > API tokens, which is generated when an application is created.

Request body

Copy link

The following table lists the properties of an HTTP request that this action supports.

Properties
RequiredTypeDescription

messages

string

Specifies the series of messages sent to the chatbot. You must specify the content and role of each message. Role can be one of the following: user or assistant. The message contents should be listed in chronological order.

OptionalTypeDescription

use_streaming_response

boolean

If true, the words of your bot responses will be displayed as they are being generated. If false, the response will appear all at once only after it’s been fully generated. (Default: true)

{
  "messages": [
    {
      "role": "user",
      "content": "Hi"
    },
    {
      "role": "assistant",
      "content": "Hi, how can I help you?"
    },
    {
      "role": "user",
      "content": "Tell me about Sendbird."
    }
  ],
  "use_streaming_response": false
}

Response

Copy link

The following is a sample response for a successful request.

{
    "reply_messages": [
        "Sendbird is a company that provides a comprehensive chat and messaging platform designed for mobile and web applications. It offers a range of features including real-time messaging, voice and video calls, and various chat functionalities such as group chats, private messaging, and more. The platform is designed to be highly scalable and customizable, making it suitable for a wide range of applications from social media to customer support.\n\nIf you have any specific questions or need more detailed information about Sendbird, feel free to ask!"
    ]
}

In the case of an error, an error object is returned. A detailed list of error codes is available here.