A serverless Telegram Bot to keep track of a group's presentation order using Netlify Functions and Telegraf
- Getting Telegram Bot token
- Deploy to Netlify
- Hooking up the Bot
On Telegram, create a new Telegram bot by talking to @botfather and thereafter getting the token for the Telegram Bot.
Deploy to Netlify either by linking to this repository manually or by clicking the "Deploy to netlify" above.
Remember to fill in the environment variables on netlify - TELEGRAM_BOT_TOKEN
with the token and the secret key obtained respectively
Therafter, you need to specify and tell telegram where your bot should direct the messages it received to. Do so by simply visiting this url (without the {
, }
)
https://api.telegram.org/bot{your_bot_token}/setWebhook?url={your_netlify_domain_url}/api/bot
If it is setup correctly it should reponse back with
{
"ok": true,
"result": true,
"description": "Webhook was set"
}
Afterwhich, YOU ARE DONE!🎉🎉
Try typing /order
to your bot and watch as the user ID of the Telegram user is stored inside your FaunaDB database
This bot uses telegraf.js for its Telegram Bot functionality. Head to its website to find out how to extend the functionality of the bot you have created :)