It would be awesome to have a tiny utility component which can be included in all the hosting guides which require a webhook to be set. While it is not hard for many users to correctly set the webhook URL using curl or other tools, some beginners struggle with understanding which URL to fetch.
It would be nice to have a small interactive component on the website which lets users paste their token and URL and then it will set the webhook for them. It could also get some neat information to validate the info:
- Call
getMe with the token to confirm the bot name
- Pass the URL to the
URL constructor to validate the URL
- Display information from
getWebhookInfo so that there is an easy way to confirm that things are working correctly
- Provide a tooltip that explains that the bot token will never be used for anything else than setting for this component to function, and tell users to never give away their token to anyone, no matter how polite a website asks.
- Have a link that opens the chat with the new bot in a new tab so that users can easily head over to Telegram when the webhook was set and the bot is working.
- Perhaps have a second button to delete the webhook again? This might not be necessary, but it could be that it feels more natural to have it. Sometimes people feel the urge to clean up after themselves.
- Perhaps store the token locally in the browser so that it persists across page loads? We must not do this if it feels shady, I don't want anyone to believe we store the token server-side (even though we will never do this)
It would be awesome to have a tiny utility component which can be included in all the hosting guides which require a webhook to be set. While it is not hard for many users to correctly set the webhook URL using
curlor other tools, some beginners struggle with understanding which URL to fetch.It would be nice to have a small interactive component on the website which lets users paste their token and URL and then it will set the webhook for them. It could also get some neat information to validate the info:
getMewith the token to confirm the bot nameURLconstructor to validate the URLgetWebhookInfoso that there is an easy way to confirm that things are working correctly