osoncode/easygram-producer-bot

By osoncode

โ€ขUpdated 3 months ago

Telegram bot forwarding updates to Kafka or RabbitMQ, configurable via env, no code needed.

Image
Languages & frameworks
Integration & delivery
Message queues
0

389

osoncode/easygram-producer-bot repository overview

โ ๐Ÿš€ Producer Bot โ€” Overview

Producer Bot is a Docker-ready Telegram bot that acts as a message relay layer between Telegram and your messaging infrastructure.

Instead of handling updates locally, it forwards every incoming Telegram update directly to a message broker โ€” either Apache Kafka or RabbitMQ โ€” enabling scalable, decoupled bot architectures.

It is designed for zero-code configuration using standard Spring Boot properties, making it extremely easy to deploy and integrate into existing systems.

๐ŸŒ Official project site: easygram.osoncode.uzโ 


โ ๐Ÿง  Core Idea

This bot follows a producer-only architecture:

  • Receives updates from Telegram
  • Converts them into JSON
  • Publishes them to a message broker
  • Does NOT process business logic

๐Ÿ‘‰ All actual bot logic is handled downstream by consumer services


โ โš™๏ธ Key Features

โ ๐Ÿ”Œ Plug-and-play deployment
  • Fully Dockerized
  • Ready for Docker Compose
  • No code changes required
โ ๐Ÿ”„ Flexible update ingestion

Supports:

  • Long Polling (default)
  • Webhook (production-ready)
โ ๐Ÿ“ก Multi-broker support

Works with:

  • Apache Kafka
  • RabbitMQ
โ ๐Ÿงฉ Configuration-first design
  • Everything controlled via .env
  • Uses Spring Boot property naming
  • No custom config format
โ ๐Ÿš€ Forward-only mode
  • Skips local handlers entirely
  • Acts as a pure event producer

โ ๐Ÿ—๏ธ Architecture

Telegram โ†’ Producer Bot โ†’ Message Broker โ†’ Consumer Bot(s)

โ ๐Ÿณ Docker Compose Example (RabbitMQ)

bot:
  image: osoncode/easygram-producer-bot:0.0.5
  build: .
  environment:
    # โ”€โ”€ Required โ€” provide in .env file โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    easygram.token: "${easygram.token}"

    # โ”€โ”€ Transport: LONG_POLLING (default) or WEBHOOK โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    # easygram.update.transport: WEBHOOK
    # easygram.update.webhook.url: https://example.com/webhook
    # easygram.update.webhook.path: /webhook
    # easygram.update.webhook.secret-token: <secret>

    # โ”€โ”€ Messaging โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    easygram.messaging.type: PRODUCER
    easygram.messaging.forward-only: "true"
    easygram.messaging.producer.type: RABBIT
    easygram.messaging.rabbit.exchange: easygram-exchange
    easygram.messaging.rabbit.queue: easygram-updates
    easygram.messaging.rabbit.routing-key: easygram.updates
    easygram.messaging.rabbit.create-if-absent: "true"

    # โ”€โ”€ RabbitMQ connection โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    spring.rabbitmq.host: rabbitmq
    spring.rabbitmq.port: "5672"
    spring.rabbitmq.username: rabbit
    spring.rabbitmq.password: rabbit

  ports:
    - "8080:8080"    # only needed for WEBHOOK mode

  depends_on:
    rabbitmq:
      condition: service_healthy

  restart: on-failure

โ ๐Ÿ”„ Supported Deployment Modes

ModeDescription
Long Polling โ†’ KafkaDefault setup, easiest to run locally
Long Polling โ†’ RabbitMQSimple queue-based setup
Webhook โ†’ KafkaProduction-grade streaming
Webhook โ†’ RabbitMQProduction queue-based

โ ๐Ÿงฑ Use Cases

โ ๐Ÿงฉ Microservices architecture
  • auth service
  • command handler
  • analytics pipeline
โ ๐Ÿ“Š Event streaming
  • analytics systems
  • real-time dashboards
  • ML pipelines
โ โšก High scalability
  • Horizontal scaling via Kafka partitions or RabbitMQ queues
  • Multiple consumers per stream

โ ๐Ÿงช Example Flow

{
  "update_id": 123456,
  "message": {
    "text": "Hello bot",
    "chat": {
      "id": 987654
    }
  }
}

โ ๐Ÿ”ง Why This Design Matters

Producer Bot transforms Telegram bots into:

  • stateless services
  • scalable systems
  • event-driven pipelines

โ ๐Ÿ’ก Summary

Producer Bot = Telegram โ†’ Broker bridge

  • No business logic
  • Fully configurable
  • Production-ready
  • Built for modern distributed systems

Tag summary

Content type

Image

Digest

sha256:800421e89โ€ฆ

Size

117.5 MB

Last updated

3 months ago

docker pull osoncode/easygram-producer-bot:0.0.6