Skip to content

acikyazilimagi/secim-bot-telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Chatbot

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.

Building the bot step by step using the Web AWS Console

You can check the MANUAL_STEPS for the all the necessary steps.

Building the bot with terraform

Prerequisites

  • 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

Preparation

  • 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 be token and the value should be the token provided by Telegram.

Installation

Building the lambda functions

  • 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.

Deploying the service to AWS

  • 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).

Telegram Webhook Commands

GET https://api.telegram.org/bot{{token}}/getWebhookInfo

POST https://api.telegram.org/bot{{token}}/setWebhook?url={{webhook_url}}&secret_token={{secret_token}}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published