sochix / TLSharp

Telegram client library implemented in C#
1k stars 380 forks source link

registerDevice for web push notification #1012

Open mehdimsv opened 3 years ago

mehdimsv commented 3 years ago

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?