Skip to main content
This pattern covers a very common voice + SMS flow: the agent has the caller’s number from the inbound call, confirms the last four digits with the caller, and sends an SMS to that number. If the caller’s number is not available (for example, in a chat session), the agent asks for it instead.

Files involved

start_function.py

Stash the raw caller_number at call start so it is available throughout the conversation.
start_function.py may already existIf your project was set up via Quick Agent Setup, start_function.py likely already contains initialization logic. Add the conv.state.caller_number line to the existing function rather than replacing the file.

caller_number_confirmed.py

Called when the caller has confirmed (or declined) sending the SMS. Branches on whether caller_number is present, then validates the last-four match before sending.
Prose conditionals and empty variablesThe topic actions above use a natural-language conditional on $caller_number. This works when the variable is populated, but can behave unreliably if the variable is always empty (for example, in chat). If you need strict branching, move the presence check into caller_number_confirmed and call it unconditionally from the topic action.

SMS template (config/sms_templates.yaml)

All SMS templates are defined in a single config/sms_templates.yaml file under the sms_templates key.

SMS templates

Reference for SMS template structure and variable substitution.

Variables

How conv.state variables are discovered and referenced.

Anti-patterns

Why prose conditionals on variable presence are unreliable.

Conversation object reference

Full reference for conv.caller_number, conv.send_sms_template, and all other conv attributes.

Start function (platform)

When start function runs, what it can access, and how to use it for initialization.

SMS setup (platform)

Configuring SMS channels, sender numbers, and template structure.
Last modified on July 9, 2026