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

    Send a bot message

    Copy link

    Sends a bot message to a group channel.

    Note: Bots can only send text messages.


    HTTP request

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

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    bot_userid

    string

    Specifies the unique ID of a bot.


    Request body

    Copy link

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

    Properties
    RequiredTypeDescription

    message

    string

    Specifies the content of the message sent by the bot.

    channel_url

    string

    Specifies the URL of the channel that the message is sent to.

    OptionalTypeDescription

    custom_type

    string

    Specifies a custom message type which is used for message grouping. The length is limited to 128 characters.

    data

    string

    Specifies additional message information such as custom font size, font type, or JSON formatted string.

    send_push

    boolean

    Determines whether to send a push notification for a message to the members of the channel. (Default: true)

    mentioned

    array of strings

    Specifies an array of IDs of users who receive a notification for the message.

    mark_as_read

    boolean

    Determines whether to mark the message as read for the bot. If set to false, the bot's unread_count and read_receipt remain unchanged after the message is sent. (Default: true)

    dedup_id

    string

    Specifies the unique ID of a message to prevent transferring duplicate message data to a channel.

    created_at

    long

    Specifies the time that the message was sent in Unix milliseconds format.

    {
        "message": "Hi John, here are some nearby restaurants that may interest you.",
        "channel_url": "sendbird_group_channel_24901438_c1bc35f5f0d237207bc1cba27351c878fc2f345b",
        "custom_type": "auto_answer_introduction"
    }
    

    Response

    Copy link

    If successful, this action returns a nested message object sent by the bot in the response body.

    {
        "message": {
            "type": "MESG",
            "message_id": 1844308962,
            "message": "Hi John, here are some nearby restaurants that may interest you.",
            "data": "",
            "custom_type": "auto_answer_introduction",
            "file": {},
            "created_at": 1684312426066,
            "user": {
                "user_id": "toolbox_bot",
                "profile_url": "",
                "require_auth_for_profile_image": false,
                "nickname": "toolbox_bot",
                "metadata": {},
                "role": "",
                "is_active": true
            },
            "channel_url": "sendbird_group_channel_24901438_c1bc35f5f0d237207bc1cba27351c878fc2f345b",
            "updated_at": 0,
            "message_survival_seconds": -1,
            "mentioned_users": [],
            "mention_type": "users",
            "silent": false,
            "message_retention_hour": -1,
            "channel_type": "group",
            "translations": {},
            "is_removed": false,
            "is_op_msg": false,
            "message_events": {
                "send_push_notification": "receivers",
                "update_unread_count": true,
                "update_mention_count": true,
                "update_last_message": true
            }
        }
    }
    

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