GithubHelp home page GithubHelp logo

alimli / secim-bot-telegram Goto Github PK

View Code? Open in Web Editor NEW

This project forked from acikyazilimagi/secim-bot-telegram

0.0 0.0 0.0 197 KB

License: MIT License

TypeScript 65.64% HCL 31.55% JavaScript 2.82%

secim-bot-telegram's Introduction

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}}

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.