Developer recipe

Read an existing Telegram conversation

Select an eligible account, list its existing chats, and read history without changing Telegram read state.

Result
A scoped page of existing messages is returned through GramClaw's internal Telegram provider.
Time
5 minutes
Key scopes
read

1. Set server-side credentials

Keep API keys outside browser code and source control.

Terminal
export GRAMCLAW_BASE_URL="https://gramclaw.com"
export GRAMCLAW_API_KEY="gc_live_replace_with_your_key"

2. List eligible accounts

Terminal
curl -s "$GRAMCLAW_BASE_URL/api/v1/me" \
  -H "Authorization: Bearer $GRAMCLAW_API_KEY"

3. List chats, then read history

Terminal
export TELEGRAM_ACCOUNT_ID="replace_with_account_id"
export TELEGRAM_CHAT_ID="telegram:chat:replace_with_chat_id"

curl -s "$GRAMCLAW_BASE_URL/api/v1/chats?account_id=$TELEGRAM_ACCOUNT_ID&limit=20" \
  -H "Authorization: Bearer $GRAMCLAW_API_KEY"

curl -s "$GRAMCLAW_BASE_URL/api/v1/chats/$TELEGRAM_CHAT_ID/messages?account_id=$TELEGRAM_ACCOUNT_ID&limit=20" \
  -H "Authorization: Bearer $GRAMCLAW_API_KEY"
  • History reads are non-mutating and never mark the chat read.
  • Only pre-existing chats owned by the selected account are available.
Chat on Telegram