Telegram Bot puts mustache on any face what he sees: Try live
- Serverless flows on JS
- State storage with DynamoDB or YDB
- Photo storage with S3
- Messaging with SQS
- Face Detection by Yandex Cloud
- Serverless Framework for AWS and Terraform Yandex Cloud provider for Yandex Cloud.
- Telegraf Bot Framework
- Create a Telegram bot using @BotFather.
- Install Terraform and terraform yandex provider.
- Fill all variables needed for deploy and create
terraform.tfvars
file. (useterraform.tfvars.template
) - Apply terraform scripts with
terraform apply
- Create table in YDB using scripts in
terraform/create-table
folder. Before run fillENDPOINT
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
- 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
Now you can /start
a conversation with the bot.
- To delete the project from AWS.
serverless remove
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
serverless invoke local --function queueEventHandler --path test/queue/data.json