AI Chatbot Platform API v3
AI Chatbot
Version 3

Create an AI chatbot

Copy link

Creates a new AI chatbot within an application. Currently, you can create up to 10 AI chatbots. For further information, contact sales.


HTTP request

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

Request body

Copy link

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

Properties
RequiredTypeDescription

bot_userid

string

Specifies the unique ID of a bot. The length is limited to 80 characters.

bot_nickname

string

Specifies the bot's nickname. The length is limited to 80 characters.

bot_profile_url

string

Specifies the URL of a bot's profile image. The length is limited to 2,048 characters.

bot_type

string

Specifies the bot's type to categorize bots. The length is limited to 128 characters.

bot_callback_url

string

Specifies the server URL of where a bot is located to receive all events, requests, and data forwarded from an application. For security reasons, it is highly recommended that you use an SSL server. The length is limited to 1,024 characters.

If ai object is specified, this property is not required.

is_privacy_mode

boolean

Determines whether to forward all or specific messages to the bot in channels where the bot is a member. If set to true, only messages starting with a "/" or mentioning the bot_userid are forwarded to the bot. If set to false, all messages are forwarded. This property can help protect the privacy of users' chat logs by configuring the bot to only receive messages addressed to the bot.

OptionalTypeDescription

enable_mark_as_read

boolean

Determines whether to mark a bot's message as read upon sending it. (Default: true)

show_member

boolean

Determines whether to include information about the members of each channel in a callback response. (Default: false)

channel_invitation_preference

int

Determines whether a bot automatically joins a channel when invited or joins a channel after manually accepting an invitation using the API. If set to 0, a bot automatically joins the channel. If set to 1, a bot first has to respond to an invitation. (Default: 0)

ai

nested object

Specifies attributes of an AI bot. If specified, the bot functions as an AI bot, which can generate responses automatically and independently of the client's server-side operations.

If this property is specified, the bot_callback_url property is no longer required but can be optionally specified.

ai.backend

string

Specifies the system that powers the AI bot. Acceptable value is chatgpt. Currently, only ChatGPT-powered bots are supported.

ai.model

string

Specifies the model of the GPT. Acceptable values are:
- gpt-3.5-turbo
- gpt-4-0125-preview
- gpt-4-turbo-2024-04-09
- gpt-4o-2024-05-13

ai.system_message

array of strings

Specifies a message used to help set the behavior of a ChatGPT bot. (Default: You are a helpful assistant.)

ai.temperature

number

Specifies the temperature of a ChatGPT bot which controls the randomness or creativity in the generated responses. A higher temperature value will result in more diverse and unpredictable responses, while a lower temperature value will produce more conservative and predictable responses. Acceptable values range from 0.00 to 2.00. (Default:1.00)

ai.max_tokens

integer

Specifies the maximum number of tokens to generate in the response by ChatGPT bots. One token generates roughly four characters for normal English text. Acceptable values range from 1 to 2048 tokens. (Default:256)

ai.top_p

number

Specifies a value that determines the diversity of response generated by ChatGPT bots via nucleus sampling. Higher values can lead to a variety of responses, but less reliable answers.(Default:1.00)

ai.presence_penalty

number

Specifies a value between -2.0 and 2.0 that determines how to penalize new tokens based on whether they've appeared in the text before. The higher the value, more likely it is for ChatGPT bots to talk about new topics.(Default:0.00)

*For further information, see OpenAI's documentation on frequency and presence penalties.

ai.frequency_penalty

number

Specifies a value between -2.0 and 2.0 that determines how to penalize new tokens based on their existing frequency in the text. The higher the value, less likely it is for ChatGPT bots to repeat the same words or phrases. (Default:0.00)

*For further information, see OpenAI's documentation on frequency and presence penalties.

{
    "bot_type": "AI assistant",
    "bot_userid": "AI Jane",
    "bot_nickname": "AI Jane",
    "is_privacy_mode": false,
    "ai": {
        "backend": "chatgpt",
         "model": "gpt-4o-2024-05-13",
        "system_message": "You are a helpful assistant.",
        "temperature": 1.00,
        "max_tokens": 256,
        "top_p": 1.00,
        "presence_penalty": 0.00,
        "frequency_penalty": 0.00
    }
}

Response

Copy link

If successful, this action returns a bot resource in the response body.

{
    "bot_callback_url": "",
    "is_privacy_mode": false,
    "enable_mark_as_read": true,
    "show_member": false,
    "channel_invitation_preference": 0,
    "created_at": 1686141160,
    "bot": {
        "bot_userid": "AI Jane",
        "bot_nickname": "AI Jane",
        "bot_profile_url": "",
        "bot_require_auth_for_profile_image": false,
        "bot_metadata": {},
        "bot_token": "10f514b570affa358002ae1a3edcbb27cb5cd1f9",
        "bot_type": "AI assistant"
    },
    "ai": {
        "backend": "chatgpt",
         "model": "gpt-4o-2024-05-13",
        "system_message": "You are a helpful assistant.",
        "temperature": 1.0,
        "max_tokens": 256,
        "top_p": 1.0,
        "presence_penalty": 0.0,
        "frequency_penalty": 0.0
    }
}

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