account.registerDevice
Register device to receive PUSH notifications
func (c *Client) AccountRegisterDevice(ctx context.Context, request *AccountRegisterDeviceRequest) (bool, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.AccountRegisterDevice(ctx, &tg.AccountRegisterDeviceRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
NoMuted | bool | — | Avoid receiving (silent and invisible background) notifications. Useful to save battery. |
TokenType | int | yes | Device token type, see PUSH updates for the possible values. |
Token | string | yes | Device token, see PUSH updates for the possible values. |
AppSandbox | bool | — | If (boolTrue) is transmitted, a sandbox-certificate will be used during transmission. |
Secret | []byte | yes | For FCM and APNS VoIP, optional encryption key used to encrypt push notifications |
OtherUIDs | []int64 | yes | List of user identifiers of other users currently using the client |
Returns
bool
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | TOKEN_EMPTY | The specified token is empty. |
| 400 | TOKEN_INVALID | The provided token is invalid. |
| 400 | TOKEN_TYPE_INVALID | The specified token type is invalid. |
| 400 | WEBPUSH_AUTH_INVALID | The specified web push authentication secret is invalid. |
| 400 | WEBPUSH_KEY_INVALID | The specified web push elliptic curve Diffie-Hellman public key is invalid. |
| 400 | WEBPUSH_TOKEN_INVALID | The specified web push token is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
account.registerDevice#ec86017a