Add a registration or device token
Adds a user's registration or device token to Sendbird Server. Registering tokens to Sendbird server allows sending notification requests to push notification services on behalf of your server. You can pass gcm
, huawei
, or apns
for FCM registration token, HMS device token, or APNs device token, respectively, in the token_type
parameter for push notification service you are using. A user can have up to 20 tokens per service and the token that was registered earliest will be deleted before a new one is added when the user already has 20 tokens registered.
If you need to register the token via your own server, you can do so with FCM registration token and an APNs device token which are generated and registered by Android and iOS client apps through the corresponding SDKs and allow identification of each client app instance on each device.
Note: For more information on the registration token and device token, visit the Google's FCM page, Huawei's Push kit and Apple's APNs page.
HTTP request
Parameters
The following table lists the parameters that this action supports.
Required
Parameter name | Type | Description |
---|---|---|
user_id | string | Specifies the unique ID of a user. |
token_type | string | Specifies the type of a token. Acceptable values are gcm, huawei, and apns for FCM, HMS, and APNS respectively. |
Request body
The following table lists the properties of an HTTP request that this action supports.
Required
Property name | Type | Description |
---|---|---|
gcm_reg_token | string | Specifies a registration token for Firebase Cloud Messaging which was formerly known as Google Cloud Messaging. |
huawei_device_token | string | Specifies a device token for Huawei Mobile Services. |
apns_device_token | string | Specifies a device token for Apple Push Notification Service. |
Response
If successful, this action returns the registered token for push notification service in the response body.
List of response properties
Property name | Type | Description |
---|---|---|
token | string | The registration or device token of the user. |
type | string | The type of registration or device token. Valid values are: GCM, HUAWEI, or APNS for FCM, HMS, and APNS respectively. |
user | nested object | The user resource which encapsulates information about the specified user. |
In the case of an error, an error object is returned. A detailed list of error codes is available here.