Lifecycle of one message
| Stage | Data or check | Outcome |
|---|---|---|
| 1 · Receive | MessageSid, From and Body arrive in an HTTPS webhook. | The signature is checked and duplicate events are recognised. |
| 2 · Process | Opt-out status, permissions and per-user context. | An accepted message becomes an SMS job. The user's turn enters the history. |
| 3 · Generate | The SMS worker receives the current message and bounded history. | Render checks response length and SMS segments. |
| 4 · Send | Accepted text goes through Twilio's REST Messages API. | The service follows the delivery status. |
| 5 · Confirm | deliveryConfirmed acknowledges delivery. | The reply is recorded as an assistant turn in the user's memory. |
Two different retries
A duplicate incoming event is filtered before it triggers a second run. An overly long model answer is rejected and the job is offered again to produce a shorter answer. In the latter case the original answer has yet to leave as a text message.
Why wait for the receipt?
If the send request was accepted but delivery later failed, a subsequent call should not assume the recipient was already told the answer. Tying the memory write to delivery preserves that distinction.

Source material · Technical brochure, 26 Nov, pp. 3 and 5–6. Technical specification, 19 Nov, pp. 3 and 5.
