Template Variables
Variables allow you to personalize your WhatsApp messages with dynamic content. Instead of sending the same generic message to everyone, you can customize each message with the recipient's name, order details, appointment times, and more.
Understanding Variables
Variables are placeholders in your template that get replaced with actual data when you send a message. They use a numbered format: {{1}}, {{2}}, {{3}}, and so on.
How Variables Work
When you create a template:
Hi {{1}}, your order #{{2}} has shipped!
When you send a campaign, the variables are replaced:
Hi Sarah, your order #ORD-5678 has shipped!
Each recipient gets a personalized message based on their data.
Variable Syntax
Basic Syntax
Variables use double curly braces with a sequential number:
| Variable | Position | Example Use |
|---|---|---|
{{1}} |
First variable | Customer name |
{{2}} |
Second variable | Order number |
{{3}} |
Third variable | Product name |
{{4}} |
Fourth variable | Price |
Numbering Rules
- Sequential numbering: Variables must be numbered sequentially (1, 2, 3...)
- No gaps: You cannot skip numbers (e.g., using
{{1}}and{{3}}without{{2}}) - Reuse allowed: You can use the same variable multiple times in a template
- Unique values: Each number represents one piece of dynamic data
Valid:
Hi {{1}}, your code is {{2}}. Use {{2}} at checkout, {{1}}!
Invalid:
Hi {{1}}, your order {{3}} is ready. // Missing {{2}}
Variable Placement
Body Variables
The template body supports multiple variables and is where most personalization occurs.
Example:
Hello {{1}},
Thank you for your purchase of {{2}}!
Your order total is {{3}} and will be delivered to:
{{4}}
Tracking number: {{5}}
Header Variables
Text headers support exactly one variable, always numbered {{1}}.
Example header:
Order Update for {{1}}
Note: When you use a header variable, body variables start at
{{2}}.
Button URL Variables
Dynamic URL buttons support one variable at the end of the URL.
Example:
https://example.com/track/{{1}}
The variable must be at the end of the URL path.
Standard Contact Fields
Waflow provides standard fields that are automatically available for every contact in your audience. These are the most commonly used for personalization.
Available Standard Fields
| Field Name | Description | Example Value |
|---|---|---|
firstName |
Contact's first name | Sarah |
lastName |
Contact's last name | Johnson |
fullName |
First and last name combined | Sarah Johnson |
email |
Email address | [email protected] |
phone |
Phone number with country code | +14155551234 |
phoneLocal |
Phone without country code | 4155551234 |
Using Standard Fields
When creating a campaign, you map template variables to contact fields:
| Template Variable | Maps To | Result |
|---|---|---|
{{1}} |
firstName | Sarah |
{{2}} |
fullName | Sarah Johnson |
{{3}} |
[email protected] |
Template:
Hi {{1}},
We've sent a confirmation to {{2}}.
Result for Sarah:
Hi Sarah,
We've sent a confirmation to [email protected].
Custom Fields
Beyond standard fields, you can create custom fields to store additional contact data. Custom fields are perfect for business-specific information.
Creating Custom Fields
- Go to Contacts > Custom Fields
- Click Add Custom Field
- Enter field name and type
- Save the field
Custom Field Types
| Type | Description | Example |
|---|---|---|
| Text | Free-form text | Company name, preferences |
| Number | Numeric values | Order count, loyalty points |
| Date | Date values | Birthday, signup date |
| Boolean | Yes/No values | VIP status, opt-in |
| List | Single selection from options | Membership tier |
Example Custom Fields
| Field Name | Type | Use Case |
|---|---|---|
companyName |
Text | B2B personalization |
orderId |
Text | Order references |
loyaltyPoints |
Number | Rewards messaging |
membershipTier |
List | Tiered offers |
lastPurchaseDate |
Date | Re-engagement campaigns |
isVip |
Boolean | Exclusive offers |
Using Custom Fields in Variables
Custom fields work the same as standard fields when mapping:
Template:
Hi {{1}},
As a {{2}} member with {{3}} points, you've unlocked exclusive access!
Field mapping:
{{1}}-> firstName{{2}}-> membershipTier{{3}}-> loyaltyPoints
Result:
Hi Sarah,
As a Gold member with 2,500 points, you've unlocked exclusive access!
Computed Variables
Computed variables are dynamic values generated at send time rather than stored in contact records. These are useful for time-sensitive or calculated data.
Available Computed Variables
| Variable | Description | Example Output |
|---|---|---|
currentDate |
Today's date | December 28, 2024 |
currentTime |
Current time | 2:30 PM |
expiryDate |
Date + offset | January 4, 2025 (7 days) |
randomCode |
Generated code | A7X9K2 |
Date Formatting
You can format dates according to your needs:
| Format | Output |
|---|---|
currentDate:short |
12/28/24 |
currentDate:long |
December 28, 2024 |
currentDate:iso |
2024-12-28 |
Using Computed Variables
Template:
Hi {{1}},
Your exclusive offer expires on {{2}}.
Use code {{3}} before {{4}} to save 20%!
Mapping:
{{1}}-> firstName{{2}}-> expiryDate:7days{{3}}-> randomCode{{4}}-> expiryDate:short
Result:
Hi Sarah,
Your exclusive offer expires on January 4, 2025.
Use code A7X9K2 before 1/4/25 to save 20%!
Formatting Variables
Number Formatting
Format numbers for currency, percentages, or plain numbers:
| Format | Input | Output |
|---|---|---|
currency:USD |
1500 | $1,500.00 |
currency:INR |
1500 | ₹1,500.00 |
currency:EUR |
1500 | €1,500.00 |
percent |
0.25 | 25% |
number |
1500 | 1,500 |
Text Formatting
Transform text casing:
| Format | Input | Output |
|---|---|---|
uppercase |
sarah | SARAH |
lowercase |
SARAH | sarah |
capitalize |
sarah johnson | Sarah Johnson |
titlecase |
the quick fox | The Quick Fox |
Applying Formats
When mapping variables in a campaign, you can apply formats:
Mapping configuration:
{{1}} -> firstName | capitalize
{{2}} -> orderTotal | currency:USD
{{3}} -> discountPercent | percent
Variable Best Practices
Sample Values
Always provide realistic sample values when creating templates:
Good samples:
- Name: "Sarah" (not "XXX" or "NAME")
- Order ID: "ORD-12345" (not "123")
- Price: "$99.00" (not "PRICE")
Why it matters:
- Helps WhatsApp reviewers understand your template
- Improves approval rates
- Makes previews meaningful
Handling Missing Data
Plan for cases where contact data might be missing:
Strategy 1: Use fallback values
In Waflow, you can set fallback values for variables:
firstName -> "there" (fallback if empty)
Template: "Hi {{1}}, welcome!" Result with data: "Hi Sarah, welcome!" Result without data: "Hi there, welcome!"
Strategy 2: Segment contacts
Create segments that only include contacts with complete data for your template variables.
Variable Count Guidelines
| Template Type | Recommended Variables |
|---|---|
| Simple greeting | 1-2 |
| Order confirmation | 3-5 |
| Detailed notification | 4-6 |
| Complex transactional | 5-8 |
Tip: More variables mean more complexity. Only use variables that add real value to the message.
Security Considerations
Do:
- Use variables for names, order numbers, tracking links
- Store sensitive data securely
- Limit access to contact data
Don't:
- Include full credit card numbers
- Send passwords in plain text
- Include sensitive personal information
Mapping Variables in Campaigns
When you create a campaign, you'll map template variables to data sources:
Mapping Interface
- Select your template
- For each variable, choose the data source:
- Contact field: Standard or custom field
- Static value: Same value for all recipients
- Computed: Generated at send time
- CSV column: From uploaded file
Mapping Example
Template:
Hi {{1}},
Your {{2}} subscription renews on {{3}} for {{4}}.
Questions? Reply to this message.
Variable mapping:
| Variable | Source Type | Value |
|---|---|---|
{{1}} |
Contact field | firstName |
{{2}} |
Contact field | subscriptionPlan |
{{3}} |
Computed | currentDate:+30days |
{{4}} |
Contact field | monthlyPrice (currency:USD) |
Preview Before Sending
Always preview your messages with actual contact data before sending:
- Click Preview in the campaign builder
- Select sample contacts to preview
- Verify all variables are replaced correctly
- Check for formatting issues
Troubleshooting Variables
Common Issues
Variable not replaced:
- Check that all variables are mapped
- Verify contact has data for that field
- Ensure variable numbers are sequential
Wrong data appearing:
- Verify mapping is correct
- Check field names match exactly
- Review data in contact record
Formatting issues:
- Apply appropriate format type
- Check locale settings for currency/dates
- Use fallback values for missing data
Next Steps
- Create a Template - Build templates with variables
- Approval Process - Submit templates for review
- Create a Campaign - Use variables in campaigns