openclaw/src/channels
spiceoogway 84c1ab4d55 feat(telegram-gramjs): Phase 1 - User account adapter with tests and docs
Implements Telegram user account support via GramJS/MTProto (#937).

## What's New
- Complete GramJS channel adapter for user accounts (not bots)
- Interactive auth flow (phone → SMS → 2FA)
- Session persistence via StringSession
- DM and group message support
- Security policies (allowFrom, dmPolicy, groupPolicy)
- Multi-account configuration

## Files Added

### Core Implementation (src/telegram-gramjs/)
- auth.ts - Interactive authentication flow
- auth.test.ts - Auth flow tests (mocked)
- client.ts - GramJS TelegramClient wrapper
- config.ts - Config adapter for multi-account
- gateway.ts - Gateway adapter (poll/send)
- handlers.ts - Message conversion (GramJS → openclaw)
- handlers.test.ts - Message conversion tests
- setup.ts - CLI setup wizard
- types.ts - TypeScript type definitions
- index.ts - Module exports

### Configuration
- src/config/types.telegram-gramjs.ts - Config schema

### Plugin Extension
- extensions/telegram-gramjs/index.ts - Plugin registration
- extensions/telegram-gramjs/src/channel.ts - Channel plugin implementation
- extensions/telegram-gramjs/openclaw.plugin.json - Plugin manifest
- extensions/telegram-gramjs/package.json - Dependencies

### Documentation
- docs/channels/telegram-gramjs.md - Complete setup guide (14KB)
- GRAMJS-PHASE1-SUMMARY.md - Implementation summary

### Registry
- src/channels/registry.ts - Added telegram-gramjs to CHAT_CHANNEL_ORDER

## Test Coverage
-  Auth flow with phone/SMS/2FA (mocked)
-  Phone number validation
-  Session verification
-  Message conversion (DM, group, reply)
-  Session key routing
-  Command extraction
-  Edge cases (empty messages, special chars)

## Features Implemented (Phase 1)
-  User account authentication via MTProto
-  DM message send/receive
-  Group message send/receive
-  Reply context preservation
-  Security policies (pairing, allowlist)
-  Multi-account support
-  Session persistence
-  Command detection

## Next Steps (Phase 2)
- Media support (photos, videos, files)
- Voice messages and stickers
- Message editing and deletion
- Reactions
- Channel messages

## Documentation Highlights
- Getting API credentials from my.telegram.org
- Interactive setup wizard walkthrough
- DM and group policies configuration
- Multi-account examples
- Rate limits and troubleshooting
- Security best practices
- Migration guide from Bot API

Closes #937 (Phase 1)
2026-01-30 03:03:15 -05:00
..
allowlists refactor(channels): share allowlist + resolver helpers 2026-01-18 01:00:25 +00:00
plugins refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
web refactor!: rename chat providers to channels 2026-01-13 08:40:39 +00:00
ack-reactions.test.ts refactor: centralize ack reaction removal 2026-01-23 23:32:14 +00:00
ack-reactions.ts refactor: centralize ack reaction removal 2026-01-23 23:32:14 +00:00
allowlist-match.ts refactor(channels): centralize match metadata 2026-01-21 18:21:19 +00:00
channel-config.test.ts refactor(channels): centralize match metadata 2026-01-21 18:21:19 +00:00
channel-config.ts refactor(channels): centralize match metadata 2026-01-21 18:21:19 +00:00
chat-type.test.ts refactor: drop legacy room chatType 2026-01-17 05:46:40 +00:00
chat-type.ts refactor: drop legacy room chatType 2026-01-17 05:46:40 +00:00
command-gating.test.ts style: apply oxfmt 2026-01-18 02:19:35 +00:00
command-gating.ts refactor: unify channel config matching and gating 2026-01-18 01:24:00 +00:00
conversation-label.test.ts style: oxfmt format 2026-01-17 05:48:56 +00:00
conversation-label.ts refactor: prune room legacy 2026-01-17 07:41:24 +00:00
dock.ts refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
location.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
location.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
logging.ts refactor: standardize channel logging 2026-01-23 23:34:30 +00:00
mention-gating.test.ts refactor: unify channel config matching and gating 2026-01-18 01:24:00 +00:00
mention-gating.ts refactor: unify channel config matching and gating 2026-01-18 01:24:00 +00:00
registry.test.ts refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
registry.ts feat(telegram-gramjs): Phase 1 - User account adapter with tests and docs 2026-01-30 03:03:15 -05:00
reply-prefix.ts refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
sender-identity.test.ts style: oxfmt format 2026-01-17 05:48:56 +00:00
sender-identity.ts style: oxfmt format 2026-01-17 05:48:56 +00:00
sender-label.ts fix: unify inbound sender labels 2026-01-17 05:21:09 +00:00
session.ts refactor: centralize inbound session updates 2026-01-23 23:33:32 +00:00
targets.test.ts fix: normalize gateway dev mode detection 2026-01-18 01:08:47 +00:00
targets.ts fix(discord): add missing type exports and fix unused imports 2026-01-28 11:04:07 +05:30
typing.test.ts test: cover typing and history helpers 2026-01-23 23:34:30 +00:00
typing.ts fix: stabilize typing + summary merge 2026-01-23 23:34:30 +00:00