Skip to main content
This page connects a Claude Agent SDK agent to Telegram and iMessage: each message becomes a query(), and the agent’s text is sent back as chat bubbles. iMessage is for replies only, on a line the Flow team sets up for your app; WhatsApp is coming (it waits on Meta’s approval) and will use the same code.

How it fits

  • reply() reads the query() iterator: with includePartialMessages it sends text as it streams, otherwise each assistant message’s text. Tool calls, results and system messages are not sent to the person.
  • Each assistant turn becomes its own bubble, which reads naturally in chat (“Let me check that…” then the answer).
  • tools: [] turns off Claude Code’s built-in tools, which a customer-facing agent should not have by default; allowedTools only pre-approves tools and does not restrict them.
  • Keep one Claude session per Flow conversation (conversation.id) to carry context between messages: remember each run’s session_id and pass it as resume next time (the full example does this).
  • Your production agent talks to Flow through the SDK or HTTP. The hosted MCP server is a separate build-time tool for coding agents; whether a project adds it is the project owner’s decision.

Full example

examples/claude-agent-sdk on GitHub.