justdmitry / NetTelegramBotApi

C# client library for building Telegram bot
MIT License
74 stars 28 forks source link

Setting up Webhook on console application example #31

Closed ghost closed 7 years ago

ghost commented 8 years ago

hi i want to work with webhook i tried in console app and use of self signed certifacation bot i realy dont undrstand how to set it up please help me this is very important for me help please ...

thanks

justdmitry commented 8 years ago

Hi,

To setup webhooks send SetWebhook request.

To receive data, you should listen for incoming HTTP message by library/class of your choice - this tightly depends on architecture of app, thats why this is not included in library.

After you got something from Telegram server - call public Update DeserializeUpdate(string json), it will return incoming Update info to you.

ghost commented 8 years ago

thanks my problem is setting up webhook i dont know what i must to do step by step. i need to run bot in console app and by self signed certification

i have an bot in getupdate mode and need to move it on webhook mode

please help if you can help

justdmitry commented 8 years ago

To setup webhook mode you need send SetWebhook once (on app startup?) , with callback url and certificate public key as-a-file. Telegram have description on it's bot api page for further details regarding certificates and keys.

I implemented SetWebhook request class according to API docs, but never tried it in-the-wild.

justdmitry commented 7 years ago

Take a look at Startup.cs in my NetTelegramBot.Framework repo.