Chat / Platform API
Current version: v3
    Chat Platform API v3
    Chat Platform API
    Chat
    Platform API
    Home
    /
    Chat
    /
    Platform API

    Accept an invitation

    Accepts an invitation from a group channel for a user to join. A single user may join up to 2,000 group channels, and any invitation to a user who is at capacity will be automatically canceled. See this page to learn more about channel types.

    Note: This action is only available when the auto_accept property of an application is set to false. You can change the value of the property using the update default channel invitation preference action, or the update channel invitation preference action.


    HTTP request

    PUT https://api-{application_id}.sendbird.com/v3/group_channels/{channel_url}/accept
    

    Parameters

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    channel_url

    string

    Specifies the URL of the group channel.


    Request body

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

    Properties
    RequiredTypeDescription

    user_id

    string

    Specifies the unique ID of the user.

    OptionalTypeDescription

    access_code

    string

    This property should be specified if the group channel to join requires an access code from the invited users because the is_access_code_required property of the channel resource is true.


    Response

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

    {
        "name": "Saturday soccer members",
        "channel_url": "private_chat_room_424",
        "cover_url": "https://sendbird.com/main/img/cover/cover_08.jpg",
        "custom_type": "sports",
        "unread_message_count": 0,
        "data": "",
        "is_distinct": true,
        "is_public": false,
        "is_super": false,
        "is_ephemeral": false,
        "is_access_code_required": false,
        "hidden_state": "hidden_allow_auto_unhide", // This shows the channel hidden status of the inviter.
        "member_count": 3,
        "joined_member_count": 1,
        "members": [
            {
                "user_id": "Jay",
                "nickname": "Rooster",
                "profile_url": "https://sendbird.com/main/img/profiles/profile_17_512px.png",
                "is_active": true,
                "is_online": false,
                "friend_discovery_key": ["543-098-4567", "010-4567-6543"],
                "last_seen_at": 1530232836311,
                "state": "joined",
                "role": "",         // Either 'operator' or null. The value of null indicates that this user is a normal channel member.
                "metadata": {
                    "location": "New York",
                    "marriage": "Y"
                }
            },
            {
                "user_id": "James",
                "nickname": "Knight",
                "profile_url": "https://sendbird.com/main/img/profiles/profile_08_512px.png",
                "is_active": true,
                "is_online": false,
                "friend_discovery_key": ["789-012-7834", "010-1245-3658"],
                "last_seen_at": 1530237133254,
                "state": "invited",     // 'invited_by_friend'
                "role": "",             // Either 'operator' or null. The value of null indicates that this user is a normal channel member.
                "metadata": {
                    "location": "Tokyo",
                    "marriage": "N"
                }
            },
            {
                "user_id": "Young",
                "nickname": "Sportsman",
                "profile_url": "https://sendbird.com/main/img/profiles/profile_23_512px.png",
                "is_active": true,
                "is_online": true,
                "friend_discovery_key": ["357-642-1369", "010-4030-1357"],
                "last_seen_at": 0,
                "state": "invited",     // 'invited_by_non_friend'
                "role": "",             // Either 'operator' or null. The value of null indicates that this user is a normal channel member.
                "metadata": {
                    "location": "Chicago",
                    "marriage": "N"
                }
            }
        ],
        "operators": [
            {
                "user_id": "Jeff",
                "nickname": "OldBoy",
                "profile_url": "https://sendbird.com/main/img/profiles/profile_22_512px.png",
                "metadata": {
                    "location": "Seoul",
                    "marriage": "Y"
                }
            }
        ],
        "max_length_message": 500,
        "last_message": null,
        "created_at": 1543468122,
        "freeze": false,
        "channel": {
            ...  # This key has been deprecated and only exists for backward compatibility.
        }
    }
    

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