This project is an extension of the Article How to Build a Reliable, Scalable, and Cost-Effective Telegram Bot and the second presentation of this WAES TechTalk.
You can check the MANUAL_STEPS for the all the necessary steps.
- AWS Console configured with a user allowed to create Lambda Functions, Api Gateways, SQS Queues, IAM policies and IAM roles. This project is currently using the default profile (you can change in the
source/infrastructure/locals.tf
) - NodeJS installed to build the functions.
- Terraform installed to deploy the bot to AWS
- You need to create an S3 bucket in the same region you will deploy this service. This S3 bucket will be used in the deployment to upload the lambda function. Currently the project is using eu-west-1 (you can change in the
source/infrastructure/locals.tf
). - You need to create your bot (check the article to understand how) with Telegram and store the Token in the secret manager. The type should be
Other type of secret
, the key should betoken
and the value should be the token provided by Telegram.
-
Go to the directory
source/inbound_function
and execute the command:npm run build
. -
Go to the directory
source/outbound_function
and execute the command:npm run build
.
- Go to the directory
source/infrastructure
and execute the commands:
terraform init
And then create and select your workspace.
terraform workspace new dev
terraform workspace select dev
Execute terraform to apply changes.
terraform apply -var-file dev.auto.tfvars
After terraform finishes the deployment you can set the Telegram Bot WebHook (check the article to understand how).
GET https://api.telegram.org/bot{{token}}/getWebhookInfo
POST https://api.telegram.org/bot{{token}}/setWebhook?url={{webhook_url}}&secret_token={{secret_token}}