Skip to main content

fluxus_sink_telegram/
lib.rs

1//! Fluxus Sink Telegram
2//!
3//! A Telegram sink component for the Fluxus stream processing framework that enables
4//! real-time message delivery to Telegram channels and chats. This component provides
5//! a simple and efficient way to send messages to Telegram as part of your data
6//! processing pipeline.
7//!
8//! # Features
9//!
10//! - Send messages to Telegram channels and chats
11//! - Support for both channel usernames and chat IDs
12//! - Optional proxy configuration for network connectivity
13//! - Asynchronous message delivery
14//! - Error handling and retry mechanisms
15//!
16//! # Example
17//!
18//! ```rust,no_run
19//! use fluxus_sink_telegram::TelegramSink;
20//! use fluxus::sinks::Sink;
21//! use fluxus::utils::models::Record;
22//! use std::time::SystemTime;
23//!
24//! fn current_time() -> i64 {
25//!     SystemTime::now()
26//!         .duration_since(SystemTime::UNIX_EPOCH)
27//!         .unwrap()
28//!         .as_secs() as i64
29//! }
30//!
31//! #[tokio::main]
32//! async fn main() -> anyhow::Result<()> {
33//!     let mut sink = TelegramSink::new(
34//!         "YOUR_BOT_TOKEN".to_string(),
35//!         "@your_channel".to_string(),
36//!         None, // Optional proxy
37//!     )?;
38//!
39//!     let record = Record {
40//!         data: "Hello from Fluxus!".to_string(),
41//!         timestamp: current_time(),
42//!     };
43//!
44//!     sink.write(record).await?;
45//!
46//!     Ok(())
47//! }
48//! ```
49
50mod telegram_bot;
51
52mod telegram;
53pub use telegram::TelegramSink;