Skip to main content

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

NameTypeRequiredDescription
NoMutedboolAvoid receiving (silent and invisible background) notifications. Useful to save battery.
TokenTypeintyesDevice token type, see PUSH updates for the possible values.
TokenstringyesDevice token, see PUSH updates for the possible values.
AppSandboxboolIf (boolTrue) is transmitted, a sandbox-certificate will be used during transmission.
Secret[]byteyesFor FCM and APNS VoIP, optional encryption key used to encrypt push notifications
OtherUIDs[]int64yesList of user identifiers of other users currently using the client

Returns

bool

Possible errors

CodeTypeDescription
400TOKEN_EMPTYThe specified token is empty.
400TOKEN_INVALIDThe provided token is invalid.
400TOKEN_TYPE_INVALIDThe specified token type is invalid.
400WEBPUSH_AUTH_INVALIDThe specified web push authentication secret is invalid.
400WEBPUSH_KEY_INVALIDThe specified web push elliptic curve Diffie-Hellman public key is invalid.
400WEBPUSH_TOKEN_INVALIDThe specified web push token is invalid.

References