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

    Update push notification preferences for a channel

    Copy link

    You can update a user's notifications preferences for a specific channel. A push notification is a message that is immediately delivered to a user's device when the device is either idle or running the client app in the background.

    Note: Push notifications are only available for group channels.


    HTTP request

    Copy link
    PUT https://api-{application_id}.sendbird.com/v3/users/{user_id}/push_preference/{channel_url}
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    NameTypeDescription

    user_id

    string

    Specifies the unique ID of a user.

    channel_url

    string

    Specifies the URL of a group channel.


    Request body

    Copy link

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

    Properties
    RequiredTypeDescription

    push_trigger_option

    string

    The type of notifications trigger applies to group channels when a user is disconnected from Sendbird server. Acceptable values are the following:
    - default (default): Indicates that a user's notifications trigger setting applies to the specified channel.
    - all: Indicates that a user receives notifications for all new messages.
    - mention_only: Indicates that a user only receives notifications for mentioned messages.
    - off: Indicates that a user doesn't receive any notifications.

    enable

    boolean

    (Deprecated) Determines whether notification messages for the user are delivered to the group channel. (default: true)

    OptionalTypeDescription

    push_sound

    string

    Specifies the name of a sound file to be played when a notification is delivered to the specified channel.

    {
        "push_trigger_option": "mention_only",
        "push_sound": "whistle.swf"
    }
    

    Responses

    Copy link

    If successful, this action returns push preferences for a channel in the response body.

    {
        "push_trigger_option": "mention_only",
        "push_sound": "whistle.swf"
    }
    

    In the case of an error, an error object like below is returned. See the error codes section for more details.

    {
        "message": "\"User\" not found.",
        "code": 400201,
        "error": true
    }