Serverless Telegram Bot on AWS
A simple NodeJS Telegram bot using the Serverless Framework.
Frameworks Used
Requirements
- AWS credentials configured.
- NodeJS 12.x.
- A Telegram account.
Installation
- Install the Serverless Framework
npm install -g serverless
- Install the required plugins
npm install
-
Create a Telegram bot using @BotFather.
-
Add the token received to
serverless.env.yml
file
cat serverless.env.yml
TELEGRAM_TOKEN: <your_token>
- Deploy the application.
serverless deploy
- Using
setWebhook
URL the configuration, register the webhook on Telegram
curl -X POST https://<api_endpoint_url>/prod/setWebhook
Usage
Now you can /start
a conversation with the bot.
Removal
- To delete the project from AWS.
serverless remove