GithubHelp home page GithubHelp logo

waptik / telegram-bot-boilerplate-now-serverless-api Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 12.0 29 KB

A template for building Telegram bots with Vercel's Serverless Functions

Home Page: https://telegram-bot-boilerplate-now-serverless-api.now.sh

License: MIT License

TypeScript 98.40% Shell 1.60%
vercel vercel-now serverless-api telegram-bot telegraf vercel-serverless serverless-functions

telegram-bot-boilerplate-now-serverless-api's Introduction

Telegram Bot Boilerplate with Vercel's Serverless Functions

This template is a fork of Telegram Bot Boilerplate framework to be used with Vercel's Serverless Functions. Easily deploy to Vercel.

Deploy your own

The easiest way to get started is deploy using this template by clicking on the Deploy button below.

Deploy with Vercel

Alternatively, if you want to make some changes before deploying it, you can fork this template and do the necessary changes you need. Then you when are done with your changes simply goto vercel git import.

Notes

  • When importing a new project on vercel, you'll be asked to set the output directory. Set it to dist or the value inside tsconfig.js
  • You also need to set Environment variables. Please note the wording in brackets mentioned below. Also here is a list of environment variables you need to set:
  • BOT_TOKEN: Its value should be the token you received from BitFather when creating your bot. (secret)
  • VERCEL_URL: set to the system populated value seen in the dropdown when you choose the system variables option. (system)

Local development

Step 1. Clone the project locally

You can clone this template directly or the forked version you have.

git clone https://github.com/waptik/telegram-bot-boilerplate-now-serverless-api.git

# or

git clone https://github.com/<YOUR_GITHUB_USERNAME>/telegram-bot-boilerplate-now-serverless-api.git

Next, navigate to the cloned directory.

cd telegram-bot-boilerplate-now-serverless-api

Step 2. Configuration

Copy the .env.example file in this directory to .env (which will be ignored by Git):

cp .env.example .env

Next, copy your bot token you got from BotFather and and open .env to do the following changes.

BOT_TOKEN="<YOUR_BOT_TOKEN>"

Note: We are not using VERCEL_URL here because we are in development mode as it's not needed.

Step 3. Run the bot in development mode

Make sure you have Vercel CLI installed on your local machine.

npm install
npm run dev

# or

yarn install
yarn dev

Your app should be up and running! Send a message to your bot on telgram and you'll receive a reply instantly!

Step 4. Deploy on Vercel

After you are done, simply do the the following. If you cloned this template directly on your machine, you need set the origin. Read more on how to do that Add a remote.

After you are done or if you cloned the forked version, simply push to GitHub

git push

Demo

You can see a working version of the bot at @VercelServerlessFunctionsBot

Pull Requests are welcomed ๐Ÿ˜‰

telegram-bot-boilerplate-now-serverless-api's People

Contributors

waptik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

telegram-bot-boilerplate-now-serverless-api's Issues

not respons from bot

I have continued to deploy to the webhook, I want to try the test, it doesn't work at all, why? is there a yt tutorial for the method :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.