Telegraf: Webhook example is not clear

Created on 22 Apr 2019  路  3Comments  路  Source: telegraf/telegraf

What does the three dashes mean?

https://github.com/telegraf/telegraf/blob/b8fe94ebaac3352d833a16c530779ea2691462fb/docs/examples/webhook-bot.js#L15

In general, the docs and the examples are not clear on how to use webhooks.

  1. Should I call myself telegrams API to register the webhook, or does telegraf handles this for me?

  2. Why does "start webhook directly" requires two steps and a secret path but the bot.launch method does not?

  3. What will be the endpoint that I need to register telegram with when using the launch method? My guess is that telegraf generates it automatically but I need to know this for debugging.

docs help wanted question

Most helpful comment

Ok, after some tinkering I figured myself most of the stuff. Still I think it is good to have these things documented.

My findings:
Three dashes are just an example. the domain parameter is where bot's back-end is deployed. When using the launch function, telegraf will register an endpoint with telegram and will set up the routing inside your application. It will look like https://yourdomain.net/telegraf/<secret hash>. To find out what is the registered endpoint I used getWebhookInfo API call (GET of https://api.telegram.org/bot<bot token>/getWebhookInfo).

All 3 comments

Ok, after some tinkering I figured myself most of the stuff. Still I think it is good to have these things documented.

My findings:
Three dashes are just an example. the domain parameter is where bot's back-end is deployed. When using the launch function, telegraf will register an endpoint with telegram and will set up the routing inside your application. It will look like https://yourdomain.net/telegraf/<secret hash>. To find out what is the registered endpoint I used getWebhookInfo API call (GET of https://api.telegram.org/bot<bot token>/getWebhookInfo).

// npm install -g localtunnel && lt --port 3000

This comment in line 1 gives you information how to acquire the domain

what if i want to use serveo? please help me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sijie123 picture sijie123  路  3Comments

bostrot picture bostrot  路  3Comments

Stephirio picture Stephirio  路  3Comments

Blaumaus picture Blaumaus  路  3Comments

rozi98 picture rozi98  路  3Comments