reply() sends the agent’s stream 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.
TypeScript
How it fits
reply()reads the stream’stextStream, keeps typing on and sends a bubble at each paragraph break.- Mastra memory: use the Flow
conversation.idas the thread ID andconversation.contact(the contact’s ID) as the resource ID, so each person keeps their own history. - In a Mastra server, receive Flow webhooks on a custom route and call the same code; verify signatures with
flow.webhooks.constructEvent(rawBody, signatureHeader, secret), which returns the typed event withevent.conversationready toreplyon. See Events and webhooks.