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

    Update an APNs push configuration

    Updates a specific APNs (Apple Push Notification service) push configuration for the client app. You can also register the configurations on the Sendbird Dashboard under Settings > Chat > Notifications.

    Note: If your HTTP request body contains a .p12 certificate file or a .p8 file as an authentication token, you should send a Multipart request .


    Update a .p12 certificate

    Just like uploading a file, send a Multipart request to update a .p12 certificate file.


    HTTP request

    PUT https://api-{application_id}.sendbird.com/v3/applications/push/apns/{provider_id}
    

    Parameters

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    provider_id

    string

    Specifies the provider ID of the push configuration.


    Request body

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

    Optional
    Property nameTypeDescription

    apns_cert

    file

    In a form of the multipart/form-data content type, specifies the name of a .p12 file. Sendbird server scans the content of the file, finds out the certificate type, and then registers the file as the corresponding type. If you upload a wrong file, you will receive an error. You should specify either this property or the apns_type below to inform the server of which certificate type to update.

    apns_cert_env_type

    string

    Specifies the certificate type of the .p12 file. Acceptable values are development and production. You should specify either this property or the apns_cert above to inform the server of which certificate type to update.

    apns_cert_password

    string

    Specifies the password of the certificate file which has been set during the .p12 file export.

    has_unread_count_badge

    boolean

    Determines whether to badge the client app's icon with the number of a user's unread messages. (Default: true)

    content_available

    boolean

    Determines for the client app whether to perform a silent background update on a user's device. For more information, see the Apple Developer Documentation's Pushing Updates to Your App Silently. (Default: false)

    mutable_content

    boolean

    Determines for the client app whether to modify the payload of a push notification before it is displayed on a user's device. For more information, see the Apple Developer Documentation's Modifying Content in Newly Delivered Notifications. (Default: false)

    push_sound

    string

    Specifies the name of a sound file to be played when a push notification is delivered to the client app. The file can be in the app's main bundle or in the Library/Sounds folder of the app's data container.

    apns_type

    string

    (Deprecated) Specifies the certificate type of the .p12 file. Acceptable values are development and production. You should specify either this property or the apns_cert above to inform the server of which certificate type to update.

    HTTPPythoncURL
    Content-Type: multipart/form-data; boundary={your_unique_boundary_string}
    Content-Length: {length of content}
    
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="has_unread_count_badge"
    
    [boolean]
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="apns_cert"; filename="push_notification_certificate.p12"
    Content-Type: application/x-pkcs12
    
    [binary contents of the certificate]
    --{your_unique_boundary_string}--
    

    Note: If you can't upload your .p12 file to Sendbird server using the Chat API or the Sendbird Dashboard, it might be some buggy behavior caused by the Keychain Access on your Mac.

    If you use a single CSR file which you previously uploaded to the Apple Developer Member Center, you might receive the same CSR file even when requesting separate files for Development and Production stages.

    To solve this problem, you must generate another CSR file and upload it to your Apple Developer Member Center. Then, export a .p12 file again, and upload the new file to Sendbird server.


    Response

    If successful, this action returns the information about the updated APNs push configuration in the response body.

    {
        "push_configurations": "ee3c11de94547d85045318f4d8b2d19424a142e1"
    }
    

    List of response properties

    Property nameTypeDescription

    push_configurations

    string

    A unique provider ID of the updated push configuration.


    Update a .p8 authentication token

    Just like uploading a file, send a Multipart request to update a .p8 file.


    HTTP request

    PUT https://api-{application_id}.sendbird.com/v3/applications/push/apns/{provider_id}
    

    Parameters

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    provider_id

    string

    Specifies the provider ID of the push configuration.


    Request body

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

    Properties
    RequiredTypeDescription

    apns_key_id

    string

    Specifies the Key ID provided to your key.

    apns_team_id

    string

    Specifies the Team ID of your team in Apple Developer account.

    apns_bundle_id

    string

    Specifies the Bundle ID for your application.

    apns_environment

    string

    Specifies which APNs server to use. Acceptable values are production and development.

    apns_auth_type

    string

    Specifies which credentials you will use when communicating with APNs. Acceptable values are certificate for a .p12 file and token for a .p8 file.

    OptionalTypeDescription

    has_unread_count_badge

    boolean

    Determines whether to badge the client app's icon with the number of a user's unread messages. (Default: true)

    content_available

    boolean

    Determines whether the client app to perform a silent background update on a user's device. For more information, see the Apple Developer Documentation's Pushing Updates to Your App Silently. (Default: false)

    mutable_content

    boolean

    Determines for the client app whether to modify the payload of a push notification before it is displayed on a user's device. For more information, see the Apple Developer Documentation's Modifying Content in Newly Delivered Notifications. (Default: false)

    push_sound

    string

    Specifies the name of a sound file to be played when a push notification is delivered to the client app. The file can be in the app's main bundle or in the Library/Sounds folder of the app's data container.

    HTTPPythoncURL
    Content-Type: multipart/form-data; boundary={your_unique_boundary_string}
    Content-Length: {length of content}
    
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="has_unread_count_badge"
    
    [boolean]
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="apns_auth_type"
    
    token
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="apns_key_id"
    
    [key id for the p8 key]
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="apns_team_id"
    
    [team id from apple developer console]
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="apns_bundle_id"
    
    [bundle id of your application]
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="apns_environment"
    
    [PRODUCTION or DEVELOPMENT]
    --{your_unique_boundary_string}
    Content-Disposition: form-data; name="apns_cert"; filename="push_notification_certificate.p8"
    Content-Type: application/pkcs8
    
    [binary contents of the certificate]
    --{your_unique_boundary_string}--
    

    Response

    If successful, this action returns the information about the updated APNs push configuration in the response body.

    {
        "push_configurations": "fh34d1de94547d85045318f4d8b2d19424a142e1"
    }
    

    List of response properties

    Property nameTypeDescription

    push_configurations

    string

    A unique provider ID of the updated push configuration.

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