/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    Overview

    Copy link

    AI-powered chatbots have greatly impacted the way businesses engage with their customers. They enable seamless and efficient communication by automating responses and providing personalized, and human-like interactions. Sendbird empowers businesses to incorporate AI chatbots into their apps, enhancing user experiences and streamlining customer support. On Sendbird Dashboard, you can easily create and manage your AI chatbot. See the list of available engines here.

    Note: To ensure compliance with legal requirements and protect user privacy, review our terms and privacy notice.


    Managing AI chatbots

    Copy link

    With Sendbird Chat API and Sendbird Dashboard, you can easily integrate AI chatbots into your application.

    Chat Platform API

    Copy link

    Using Sendbird's existing bot API you can do the following:

    • Create and update an AI chatbot.
    • Retrieve a list of AI chatbots.
    • Retrieve information on an AI chatbot.
    • Delete an AI chatbot.

    Sendbird Dashboard

    Copy link

    To do the following, go to Chat > AI chatbots on your dashboard.

    • Create and edit an AI chatbot.
    • View a list of AI chatbot.
    • View information on an AI chatbot.
    • Manage file or URL sources that AI chatbots can refer to when generating answers.

    Note: Managing file or URL sources can only be done on Sendbird Dashboard.


    Resource representation

    Copy link

    The following table shows the list of properties in a bot resource.

    Property nameTypeDescription

    bot

    nested object

    The information on the bot.

    bot.bot_userid

    string

    The unique ID of the bot.

    bot.bot_nickname

    string

    The bot's nickname.

    bot.bot_profile_url

    string

    The URL of the bot's profile image.

    bot.bot_type

    string

    The bot's type that indicates its category.

    bot.bot_token

    string

    An opaque string that identifies the bot. This token should be added to all requests sent to bot_callback_url to verify that they come from Sendbird server.

    bot.bot_metadata

    object

    One or more key-value pair items which store additional bot information like a user metadata. For more information, see user metadata and channel metadata.

    bot_callback_url

    string

    The server URL where the bot is located to receive all events, requests, and data forwarded from an application.

    is_privacy_mode

    boolean

    Indicates whether to only forward messages that meet specific conditions or forward all messages to the bot. If set to true, only messages that start with a "/" or mention the bot_userid are forwarded to the bot. If set to false, all messages are forwarded. This property, which is usually used for privacy concerns, applies to group channels joined by the bot.

    enable_mark_as_read

    boolean

    Indicates whether to mark the bot's message as read upon sending it.

    show_member

    boolean

    Indicates whether to include information about the members of each channel in a callback response.

    channel_invitation_preference

    int

    Indicates whether the bot automatically joins the channel when invited or joins the channel after manually accepting an invitation using the API. The value of 0 indicates an automatic entrance, while the value of 1 indicates an entrance upon accepting an invitation. (Default: 0)

    created_at

    timestamp

    The timestamp at which the bot was created in Unix seconds format.

    ai

    nested object

    Indicates whether the bot is an AI bot, and holds information of an AI bot. This object only appears if the bot is an AI bot which can generate responses automatically and independently of your server-side operations.

    ai.backend

    string

    Indicates the system that powers the AI bot. Currently, only ChatGPT-powered bots are supported.

    ai.system_message

    array of strings

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

    ai.temperature

    number

    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. Valid values range from 0.00 to 2.00. (Default:1.00)

    ai.max_tokens

    integer

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

    ai.top_p

    number

    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

    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

    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 callback URL requirements

    Copy link

    The following are the requirements for your bot callback URL:

    • Your URL is required to handle POST requests with application/json; charset=utf8 type.
    • Your URL is required to return a 200 OK HTTP code if you successfully receive a callback. Otherwise, Sendbird server calls your URL several times until it gets a 200 OK.
    • For security reasons, we recommend that you use an SSL server.

    Note: If the ai property is specified, the bot_callback_url property is no longer required but can be optionally specified.

    Bot callback JSON body

    Copy link
    Property nameTypeDescription

    category

    string

    The type of the bot notification. The only valid value is bot_message_notification.

    app_id

    string

    The unique App ID of the application where the message was sent.

    ts

    long

    The time that the message was sent in Unix milliseconds format. You can use this property to sort messages sent to the bot.

    sender

    nested object

    The user who sent the message.

    bot

    nested object

    The bot that received the message.

    members[]

    array of objects

    An array of users who are members of the channel.

    mentioned[]

    array of strings

    An array of unique IDs of the users mentioned in the message.

    message

    nested object

    The sent message that triggered the callback.

    channel

    nested object

    The group channel where the event occurred.

    {
        "category": "bot_message_notification",
        "ts": 1484623059030,
        "sender": {
            "user_id": "Danielle",
            "nickname": "Zelda",
            "profile_url": "https://sendbird.com/main/img/profiles/profile_42_512px.png",
            "metadata": {
                "font_preference": "times new roman",
                "font_color": "black"
            }
        },
        "bot": {
            "bot_userid": "dinner_helper_bot",
            "bot_nickname": "Dinner helper",
            "bot_type": "marketer",
            "bot_profile_url": "https://mealadvisor.com/bots/img/sendbird_03_512px.png",
            "bot_token": "753afa86d980feea00657f040535fe4f73755e05",
            "bot_metadata": {
                "area": "South Korea",
            }
        },
        "members": [
            {
                "user_id": "Leslie",
                "nickname": "Crystal",
                "profile_url": "https://sendbird.com/main/img/profiles/profile_14_512px.png",
                "is_active": true,
                "is_online": true,
                "state": "joined",
                "is_push_enabled": true,
                "unread_message_count": 0,
                "total_unread_message_count": 12,
                "channel_unread_message_count": 4,
                "metadata": {
                    "font_preference": "times new roman",
                    "font_color": "black"
                }
            },
            ... # More members of the channel
        ],
        "mentioned": ["Leslie", "Jenna", "Grace", "Jay"],
        "message": {
            "message_id": 273653769,
            "type": "MESG",
            "custom_type": "vote",
            "files": [],
            "text": "Where should we have dinner?",
            "translations": {},
            "data": "",
            "created_at": 1543228763476
        },
        "channel": {
            "name": "Let's ask to Free Meal Advisor!",
            "channel_url": "sendbird_group_channel_24901438_067b75db946bda8b7843617b1f189fbdfd86b768",
            "cover_url": "https://sendbird.com/main/img/cover/cover_05.jpg",
            "channel_type": "group_messaging",
            "custom_type": "chat_with_bot"
        },
        "app_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
    

    Actions

    Copy link

    The following table shows a list of actions supported for AI chatbots. Sendbird AI chatbots are based on API endpoints are relative to the base URL allocated to your Sendbird application. In this page, the /bots endpoint refers to https://api-{application_id}.sendbird.com/v3/bots.

    Note: If you want to know the ID and base URL of your application, sign in to the Sendbird Dashboard, go to the Settings > Application > General, and then check the Application ID and API request URL.

    • It's recommended that the parameter values in API URLs be urlencoded, such as {botuser_id} and {channel_url}.
    ActionHTTP request

    Create an AI chatbot

    POST /bots
    Creates a new AI chatbot within an application.

    List AI chatbots

    GET /bots
    Retrieves a list of all AI chatbots within an application.

    Get an AI chatbot

    GET /bots/{bot_userid}
    Retrieves information on an AI chatbot.

    Update an AI chatbot

    PUT /bots/{bot_userid}
    Updates information on an AI chatbot.

    Delete an AI chatbot

    DELETE /bots/{bot_userid}
    Deletes an AI chatbot from an application.