Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Serverless Telegram Bot

Create a serverless Telegram Bot with a database to keep track of users using Netlify Functions and FaunaDB

Deploy to Netlify

Getting Started

  • Getting Telegram Bot token and FaunaDB key
  • Deploy to Netlify
  • Hooking up the Bot

Getting Telegram Bot token and FaunaDB key

On Telegram, create a new Telegram bot by talking to @botfather and thereafter get the token for the Telegram Bot.

On FaunaDb site, create a collection with the name user (optionally, generate an index for the collection and specify the term for the userId to be unique). Head to the security section and generate a FaunaDB key for the collection.

Deploy to Netlify

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, FAUNA_SECRET_KEY with the token and the secret key obtained respectively

Hooking up the Bot

Thereafter, 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 {, }){your_bot_token}/setWebhook?url={your_netlify_domain_url}/api/bot

If it is set up correctly, it should respond back with

  "ok": true,
  "result": true,
  "description": "Webhook was set"

Afterwhich, YOU ARE DONE!πŸŽ‰πŸŽ‰

Try typing /start to your bot and watch as the user ID of the Telegram user is stored inside your FaunaDB database

Extending Telegram Bot Functionality

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 :)


Create serverless Telegram bot with Netlify Function and FaunaDB for free!







No releases published


No packages published