This recipe covers the complete SMS consent-and-send pattern: confirm the number, ask for consent, send the message, and confirm delivery — all without the agent making promises it can’t keep.Documentation Index
Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
Use this file to discover all available pages before exploring further.
When to use this
Use this pattern when:- You need to send a follow-up (link, confirmation, summary) after a call interaction
- Compliance or brand requirements mean you must collect explicit consent before sending
- You want a hard confirmation step so the agent never sends SMS without the user agreeing
The complete pattern
Step 1 – Collect the phone number
collect_phone_number.”
Step 2 – Ask for consent
record_consent with consented=True if they agree, consented=False if they decline.”
Step 3 – Send and confirm
send_confirmation_sms to send the message and confirm delivery.”
Flow structure
Key decisions
Why store state between steps?
Why store state between steps?
Each flow step runs in a separate LLM request. The phone number collected in Step 1 must be stored in
conv.state to be accessible in Step 3 — the LLM does not carry it forward automatically.Why exit the flow on decline?
Why exit the flow on decline?
If the caller declines consent,
flow.exit_flow() returns control to the LLM, which can continue the conversation naturally. Do not loop back to the consent step — that would feel coercive.Why check consent again in Step 3?
Why check consent again in Step 3?
The defensive consent check in
send_confirmation_sms ensures you never send an SMS even if the flow logic has a bug or is called out of order. Treat it as a safety net.Check your understanding
← Back to Recipes
All recipes
Retry with handoff →
Next recipe

