Skip to content

Add firehose command for real-time message streaming#1

Open
serefyarar wants to merge 4 commits intoskillhq:mainfrom
indexnetwork:feat/telegram-firehose
Open

Add firehose command for real-time message streaming#1
serefyarar wants to merge 4 commits intoskillhq:mainfrom
indexnetwork:feat/telegram-firehose

Conversation

@serefyarar
Copy link
Copy Markdown

Summary

  • Adds a new telegram firehose command that streams incoming Telegram messages in real-time as NDJSON (one JSON object per line) to stdout, using GramJS NewMessage event handler.
  • Supports --chat <name|@user|id> to filter to a single chat, and --include-outgoing to include your own messages.
  • Exports resolveChat, getChatTitle, and ResolvedEntity from client.ts for reuse across commands.

Usage

telegram firehose                            # Stream all incoming messages
telegram firehose --chat "MetaDAO"           # Stream one chat only
telegram firehose --include-outgoing         # Include own outgoing messages
telegram firehose | jq .text                 # Pipe to jq

Each line is a JSON object with: id, date, chatId, chatTitle, sender, senderId, text, replyToMsgId, isOutgoing.

Test plan

  • Run telegram firehose and verify NDJSON lines appear for incoming messages
  • Run with --chat "SomeChat" and verify only that chat's messages appear
  • Run with --include-outgoing and verify own messages are included
  • Ctrl-C cleanly disconnects (no hanging process)
  • tsc builds without errors

Made with Cursor

Adds a long-running `telegram firehose` command that uses GramJS
NewMessage events to stream incoming messages as NDJSON to stdout.
Supports --chat filter and --include-outgoing flag. Exports
resolveChat/getChatTitle from client.ts for reuse.

Made-with: Cursor
GramJS NewMessage chats filter expects numeric IDs, not entity objects.

Made-with: Cursor
- Remove --since from firehose, keep it as pure live stream
- Make read chat argument optional; when omitted with --since, reads
  from all active chats with throttling and rate-limit handling

Made-with: Cursor
Each message is now one JSON line instead of a single pretty-printed
blob. Includes chatId/chatTitle in each line for all-chats mode.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant