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

    Create a bot

    Copy link

    Creates a new bot within an application. Creating a bot is similar to creating a normal user, except a callback URL should be specified for a bot to receive events.

    Note: The bot must first join a group channel to interact with users. In group channels, you can also invite a bot through the invite as members action.


    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)

    {
        "bot_type": "marketer",
        "bot_userid": "helper_bot_for_dinner",
        "bot_nickname": "Dinner Helper",
        "bot_profile_url": "https://mealadvisor.com/bots/img/sendbird_03_512px.png",
        "bot_callback_url": "https://mealadvisor.com/bots/sendbird/dinner/",
        "is_privacy_mode": false
    }
    

    Response

    Copy link

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

    {
        "bot": {
            "bot_token": "712afa86d980feea00657f040535fe4f7373e329",
            "bot_profile_url": "https://mealadvisor.com/bots/img/sendbird_06_512px.png",
            "bot_userid": "helper_bot_for_dinner",
            "bot_nickname": "Dinner Helper",
            "bot_type": "marketer",
            "bot_metadata": {}
        },
        "bot_callback_url": "https://mealadvisor.com/bots/sendbird/dinner/",
        "enable_mark_as_read": true,
        "is_privacy_mode": false,
        "show_member": false,
        "channel_invitation_preference": 0
    }
    

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