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

    Add an FCM push configuration

    Copy link

    Registers an FCM (Firebase Cloud Messaging) push configuration for client apps. To send push notifications to Android devices, you should first register the FCM push configuration. You can also register the configurations on the Sendbird Dashboard under Settings > Chat > Push notifications.


    Register a service account key

    Copy link

    You can register a service account key for FCM HTTP v1 API on Sendbird Dashboard. For instructions, see this FCM migration guide.


    HTTP request

    Copy link
    POST https://api-{application_id}.sendbird.com/v3/applications/push/fcm
    

    Request body

    Copy link

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

    Properties
    RequiredTypeDescription

    api_key

    string

    Specifies the FCM server key.

    OptionalTypeDescription

    push_sound

    string

    Specifies the name of a sound file to be played when a push notification is delivered to client apps. The file should be located in the /res/raw folder.

    service_account_key

    file

    In the form of a multipart/form-data content type, specifies the name of a .JSON file. Sendbird server scans the content of the file and registers the file as its corresponding type. If you upload a wrong file, you will receive an error.


    Response

    Copy link

    If successful, this action returns the information about the registered FCM push configuration in the response body.

    Sample provider configurations
    First providerSecond provider

    - Uses HTTP v1 API.
    - Only service account key registered.
    - No API key used.

    - Uses legacy API.
    - Both service account key (HTTP v1) and API key (Legacy) registered.
    - Deprecated starting June 20, 2024.

    {
        "push_configurations": [
            {
                "id": "065c7f1c0e98b9eac8792e7da9211ce30e3923f1",
                "push_type": "FCM",
                "created_at": 1596607063,
                "api_key": "",
                "use_v1_api": true,
                "project_id: "sample-app-project",
                "private_key_id": "b17fc85aea21f21e2e3a93f18dd038a9d55f8d84",
                "push_sound": "bird_clock_alarm.swf"
            },
            {
                "id": "fbdd6d0071217ac71b5d8acab65d615cfab3f7b1",
                "push_type": "FCM",
                "created_at": 1596607063,
                "api_key": "BBBBEEuCTTE:APA91bE8HPMm-xQa5RT4RaPXi-UdmGNfjDUAaFRryNbth7k4uLZGK9TufYqZXLBf82I3DHyH-L5QlNef1t60WxocozV3uWIRQkESW69XgKyrRQEBH8vKlE9C5rkDtUJDFavEgFmiICvw",
                "use_v1_api": false,
                "project_id: "sample-cloud-messaging",
                "private_key_id": "928bfaf1c427ef0eac8792e7da5285ce30e39cc72",
                "push_sound": "ring.swf"
            }
        ]
    }
    

    List of response properties

    Copy link
    Property nameTypeDescription

    push_configurations[]

    array of objects

    A list of FCM, HMS, or APNs push configurations.

    push_configurations.(provider).id

    string

    A unique provider ID of the push configuration. This is automatically generated by Sendbird.

    push_configurations.(provider).push_type

    string

    The type of the push configuration.

    push_configurations.(provider).api_key

    string

    The registered FCM server key.

    push_configurations.(provider).push_sound

    string

    The name of a sound file to be played when a push notification is delivered to client apps.

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