xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
561 stars 124 forks source link

receive webhook #129

Closed malik-telegram closed 1 year ago

malik-telegram commented 1 year ago

How can I receive incoming messages to webhook link?

malik-telegram commented 1 year ago

IMG_20230517_203247.jpg

Is this the correct ?

malik-telegram commented 1 year ago

@xtrime-ru 🌹

xtrime-ru commented 1 year ago

Well, this probably will work. But you must not use blocking IO in async app. Please use https://github.com/amphp/http-client to send async requests. Also better to wrap http request in async() function. So you dont block main thread, because you dont need result of this request.

Also you dont need TelegramApiServer for this. You can do same this bare madelineProto and regular eventHandler. There is even new type of eventHandler which made exactly for webhooks. Its not yet described in docs: \danog\MadelineProto\InternalDoc::setWebhook.