Skip to main content
This page connects a LangChain model or chain to Telegram and iMessage: Flow delivers each message and reply() sends the streamed chunks 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

  • Any runnable whose .stream() yields message chunks works with reply(): chat models, prompt.pipe(model) chains, and chains ending in a string output parser.
  • The Python version answers in the webhook response (one round trip). Flow waits 10 seconds for the answer, so this suits fast chains; for slower ones answer {} at once and send later with POST /v1/conversations/{conversation_id}/messages. fallback: "auto" sends the markdown as plain text where a channel has no formatting, and the reply goes out as one message, so keep it within the channel’s text limit (4096 characters on Telegram). See Events and webhooks.
  • Keep chat history per conversation.id, or read it from GET /v1/conversations/{conversation_id}/messages.

Full example

examples/langchain on GitHub.