TLSharp icon indicating copy to clipboard operation
TLSharp copied to clipboard

registerDevice for web push notification

Open mehdimsv opened this issue 4 years ago • 0 comments

Hi I want to subscribe for getting push notifications, according to telegram official blog I have to use account.registerDevice which in TLsharp currently not implemented. I used SendRequestAsync to invoke the method, but I get Web_push_key_invalid error. I don't know what to pass to the Token parameter of the request. this is my code snippet: var json = "{\"endpoint\":\"https://www.xxx.com/api/telegram/webpush/1\"," + "\"keys\":{" + "\"p256dh\":\"" + Helper.Base64UrlEncode(publikKey) + "\"," + "\"auth\":\"" + Helper.Base64UrlEncode(auth) + "\"" + "}}"; var tlRequestRegisterDevice = new TLRequestRegisterDevice() {TokenType = 10, Token = json}; var notify = await client.SendRequestAsync<TLMethod>(tlRequestRegisterDevice);

the problem is I don't know what are the parameters publicKey and secret. is publicKey the one of the key in api development panel? how about the secret wich passes as "auth" to the request? where can I get this?

mehdimsv avatar Jan 22 '21 15:01 mehdimsv