Giter Site home page Giter Site logo

telegram-serverless-mustachizer's Introduction

Telegram Serverless Mustachizer

Telegram Bot puts mustache on any face what he sees: Try live

image

Under the hood

image

How to install

Get all credentials needed

Yandex Cloud Installation

  • Install Terraform and terraform yandex provider.
  • Fill all variables needed for deploy and create terraform.tfvars file. (use terraform.tfvars.template)
  • Apply terraform scripts with terraform apply
  • Create table in YDB using scripts in terraform/create-table folder. Before run fill ENDPOINT env variable with YDB document API endpoint. (use UI for that)
  • Make the function public in the Yandex Cloud UI
  • Set webhook in the telegram pointing to the function URL.
curl -X POST https://api.telegram.org/bot<BOT SECRET>/setWebhook?url=https://functions.yandexcloud.net/<FUNCTION ID>
  • Profit

AWS Installation

  • Install the Serverless Framework
npm install -g serverless
  • Install the required plugins
npm install
  • Add the token received from telegram to .env.yml file
  • Deploy the application to dev environment (remove stage parameter for prod).
serverless deploy --stage dev
  • 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

Local testing

Fill .env file with credentials, install Serverless and Docker. After run dynamodb-local and install dependencies:

docker run -p 8000:8000 --name dynamodb amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb
npm install

Run DynamoDB migrations:

sls dynamodb migrate

After all, run command:

sls offline

Queue messages testing

serverless invoke local --function queueEventHandler --path test/queue/data.json

telegram-serverless-mustachizer's People

Contributors

voborgus avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.