urasto.fi

AdeleTechnical handbook

SMS events and delivery receipts

Receiving a message, generating an answer and delivering it to the handset are separate events. The provider's delivery receipt determines when the outgoing answer enters continuity memory.

Lifecycle of one message

StageData or checkOutcome
1 · ReceiveMessageSid, From and Body arrive in an HTTPS webhook.The signature is checked and duplicate events are recognised.
2 · ProcessOpt-out status, permissions and per-user context.An accepted message becomes an SMS job. The user's turn enters the history.
3 · GenerateThe SMS worker receives the current message and bounded history.Render checks response length and SMS segments.
4 · SendAccepted text goes through Twilio's REST Messages API.The service follows the delivery status.
5 · ConfirmdeliveryConfirmed 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.

SMS events and delivery receipts
Open the sequence diagram at full size.

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