#real-time #stream-processing #data-processing #analytics #telegram

fluxus-sink-telegram

A Telegram sink component for the Fluxus stream processing framework, enabling real-time message delivery to Telegram channels and chats

1 unstable release

Uses new Rust 2024

new 0.1.0 May 14, 2025

#612 in Science

Apache-2.0

25KB
111 lines

Fluxus Sink Telegram

A Telegram sink component for the Fluxus stream processing framework, enabling real-time message delivery to Telegram channels and chats.

Features

  • Send messages to Telegram channels and chats
  • Support for both channel usernames and chat IDs
  • Optional proxy configuration for network connectivity
  • Asynchronous message delivery
  • Error handling and retry mechanisms
  • Easy integration with Fluxus framework

Installation

Add this to your Cargo.toml:

[dependencies]
fluxus-sink-telegram = "0.1"

Usage

Basic Example

use fluxus_sink_telegram::TelegramSink;
use fluxus::sinks::Sink;
use fluxus::utils::models::Record;
use std::time::SystemTime;

fn current_time() -> i64 {
    SystemTime::now()
        .duration_since(SystemTime::UNIX_EPOCH)
        .unwrap()
        .as_secs() as i64
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Initialize the Telegram sink
    let mut sink = TelegramSink::new(
        "YOUR_BOT_TOKEN".to_string(),
        "@your_channel".to_string(),
        None, // Optional proxy
    )?;

    let record = Record {
        data: "Hello from Fluxus!".to_string(),
        timestamp: current_time(),
    };

    // Send a message
    sink.write(record).await?;

    Ok(())
}

Using with Proxy

let mut sink = TelegramSink::new(
    "YOUR_BOT_TOKEN".to_string(),
    "@your_channel".to_string(),
    Some("http://proxy.example.com:8080".to_string()),
)?;

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Dependencies

~15–28MB
~406K SLoC