Skip to content

bjkawecki/Telegram-GPT-Translator-Bot

Repository files navigation

Telegram GPT Translator Bot

Terraform AWS Python Telegram ChatGPT Github-Actions

logo.png

Telegram bot that picks up messages from an input channel, translates them, and forwards them to an output channel.

Table of Contents

  1. How it Works
  2. Requirements
  3. Getting Started
  4. Architecture Illustration
  5. Note on the Use of DynamoDB

How it Works

  • The Telegram bot is subscribed to a source channel. When a new post is published, Telegram sends it via a webhook to an AWS Lambda function.
  • The Lambda function extracts the post's text and sends it to the OpenAI API to generate a translated version.
  • Once translated, the bot sends the translated post to a designated output channel.

Requirements

  • OpenAI API key
  • Telegram Bot Token
  • AWS Account

Getting Started

  1. Set up environment variables in terraform.tfvars.
  2. Deploy infrastructure with Terraform.
  3. Push code to trigger deployment.
  4. Test locally (optional) with python main.py and json test events.

Architecture Illustration

architecture-overview.svg

Note on the Use of DynamoDB

The bot differentiates between single-media messages and media groups. This is because Telegram treats posts with multiple media attachments as media groups, splitting them into multiple events. To aggregate these related events and reconstruct them into a single message for reposting, DynamoDB is used as temporary storage.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published