Link Search Menu Expand Document

Method: account.registerDevice

Back to methods index

Register device to receive PUSH notifications


no_mutedBoolAvoid receiving (silent and invisible background) notifications. Useful to save battery.Optional
token_typeintDevice token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox’s simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates
tokenstringDevice tokenYes
app_sandboxBoolIf (boolTrue) is transmitted, a sandbox-certificate will be used during transmission.Yes
secretbytesFor FCM and APNS VoIP, optional encryption key used to encrypt push notificationsYes
other_uidsArray of longList of user identifiers of other users currently using the clientYes

Return type: Bool

Can bots use this method: NO

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('', 'madeline.php');
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');

// PHP 8+ syntax, use an array on PHP 7.
$Bool = $MadelineProto->account->registerDevice(no_muted: Bool, token_type: int, token: 'string', app_sandbox: Bool, secret: 'bytes', other_uids: [long, long], );