SMS templates define reusable text messages that the agent can send during a conversation, such as confirmations, links, or verification codes.
Templates support dynamic content through variables stored in conversation state.Location
SMS templates are defined in:sms_templates key.
What an SMS template contains
Each template can include the following fields:| Field | Description |
|---|---|
name | Identifier for the template. Referenced in prompts as {{twilio_sms:template_name}}. |
text | Message body. Supports {{vrbl:variable_name}} placeholders from conv.state. |
env_phone_numbers | Optional sender phone numbers for different environments. |
Environment-specific sender numbers
If needed, you can define different sender numbers for different environments:| Environment | Description |
|---|---|
sandbox | Sender number for sandbox use |
pre_release | Sender number for pre-release use |
live | Sender number for production use |
Example
How SMS templates are used
In rules, topics, and flows
Use
{{twilio_sms:template_name}} to tell the agent which SMS should be sent.In code
Call a function that triggers the SMS through
conv or the platform API.With variables
Use
{{vrbl:...}} placeholders to insert values from conversation state.In prompts and instructions
SMS templates can be referenced in rules, topics, and related instructions using:Using variables
Template text can include placeholders drawn fromconv.state, for example:
Best practices
- set required state variables before the SMS is triggered
- use separate templates for different purposes such as confirmation, verification, and follow-up
- keep templates short and clear
- configure
env_phone_numberswhen sender numbers differ between environments - prefer template references over hard-coded SMS text in prompts
Related pages
Variables
Learn how values are stored in
conv.state and referenced with {{vrbl:...}}.Functions
See how deterministic code can set variables and trigger SMS sending.
SMS setup (platform)
Configuring SMS channels, sender numbers, opt-out handling, and full template options.
Conversation object reference (platform)
Full reference for
conv.send_sms_template, conv.send_sms, and all other conv methods.
