Skip to content

croc100/telegram-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

telegram-webhook

Forty by croc100

This example demonstrates how to use a webhook in a Telegram bot to inspect or process intermediate values from a server other than the user interface.

To run this example, follow the steps below:

  1. Make sure you have Node.js installed on your system.
  2. Replace 'YOUR_BOT_TOKEN' with your Telegram Bot API token in the code.
  3. Replace 'YOUR_WEBHOOK_URL' with the URL where you want to inspect intermediate values.
  4. Open a terminal and navigate to the directory containing the code.
  5. Install the required dependencies by running the command: npm install.
  6. Start the server by running the command: node index.js.
  7. Once the server is running, use the following endpoint to set the webhook URL:
    • GET /setWebhook/YOUR_BOT_TOKEN
  8. After setting the webhook, any messages sent to your Telegram bot will trigger an HTTP POST request to the specified webhook URL. The server will log the received message and you can inspect or process any intermediate values as needed.
  9. Customize the logic in the /webhook/${botToken} endpoint to handle the received messages and perform desired response actions.

Note: Make sure the webhook URL is publicly accessible and uses HTTPS for security purposes.

For more information on Telegram Bot API and webhooks, refer to the official documentation: https://core.telegram.org/bots/api#setwebhook

About

Telegram webhook

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published