๐ What youโll build
Youโll send your first WhatsApp template message using the Vambe API with the correct 3-step flow to gather required IDs.Template messages allow you to reach customers outside the 24-hour window and
send structured, pre-approved content for notifications and marketing.
Prerequisites
Before sending template messages, ensure you have:- โ Connected WhatsApp Business API
- โ Created and approved templates
- โ Valid Vambe API key from developers page
- โ Customer phone numbers (must have opted in to receive messages)
Important: Only send template messages to customers who have explicitly
opted in. Sending unsolicited messages violates WhatsAppโs policies and can
result in account suspension.
Complete API Flow for Sending Templates
To send a template message, you need to make 3 API calls in sequence to get the required IDs:1
Get Channel Information
First, retrieve your channel details:Sample Response:
This endpoint retrieves the channel configuration by type. Use
whatsapp
, instagram
, web-whatsapp
, or playground
as channel types. Save the phone_number
and client_id
for the template call.2
Get Pipeline and Stage IDs
Retrieve your pipeline configuration to get stage IDs:Sample Response:
Save the stage ID where you want to send the message. Youโll need this
stageId
parameter for the template call.3
Get Template ID
Find your approved template ID:Look for your template name and copy its ID for the final call.
4
Send the Template Message
Now send your template using the collected IDs:
Required fields based on Vambe API:
contactName
: Customer namevariables
: Array of values for template variables (in order)stageId
: Stage ID from pipeline responsetoPhoneNumber
: Destination numbermeta_data
: Additional metadata object (can be empty)
5
Handle the Response
Process the API response to confirm delivery:Response codes:
201
: Message sent successfully400
: Bad request (check required fields)401
: Unauthorized (verify API key)
Vambe Template Examples
Simple Template (No Variables)
Template with Variables
Understanding Vambe Template Format
Based on theSendTemplateDto
schema, here are the required and optional fields:
Field | Type | Required | Description |
---|---|---|---|
contactName | string | Optional | Customerโs name for personalization |
variables | string[] | Required | Array of values for template variables in order |
meta_data | object | Optional | Additional metadata (key-value pairs) |
stageId | string | Optional | Pipeline stage ID where to send the message |
toPhoneNumber | string | Optional | Destination phone number |
Variable Order: The
variables
array must match the order of variables in your template. If your template has {{1}}
for name and {{2}}
for order number, then variables: ["John Doe", "ORD-123"]
.Advanced Use Cases
Bulk Template Sending
Send templates to multiple customers efficiently:Error Handling
Common Error Responses
Template Not Found (404)
Template Not Found (404)
- Verify template ID is correct
- Check template approval status in Vambe dashboard
- Ensure template exists for your account
Invalid Stage ID (400)
Invalid Stage ID (400)
- Check stage ID from pipeline API response
- Verify stage belongs to your account
- Ensure pipeline is active and configured
Invalid Phone Number (400)
Invalid Phone Number (400)
- Include country code (e.g., +1 for US)
- Validate phone number format
- Ensure number is active on WhatsApp
Rate Limit Exceeded (429)
Rate Limit Exceeded (429)
- Implement exponential backoff retry logic
- Check your messaging tier limits
- Spread messages over longer time periods
Robust Error Handling Example
Best Practices
Message Timing
- Respect time zones - Send during business hours
- Consider urgency - Use appropriate delivery timing
- Batch wisely - Spread bulk sends over time
- Avoid peak hours - Prevent rate limiting
Content Optimization
- Personalize content - Use customer data effectively - Keep variables relevant - Donโt include unnecessary data - Test thoroughly - Verify all variable combinations - Monitor performance - Track delivery and engagement
Compliance
- Verify opt-ins - Only message consenting customers - Honor opt-outs
- Respect unsubscribe requests - Follow policies - Adhere to WhatsApp guidelines - Document consent - Keep records of permissions
Technical Excellence
- Handle errors gracefully - Implement proper error handling
- Use rate limiting - Respect API limits
- Monitor delivery - Track message status
- Log thoroughly - Maintain audit trails
Next Steps
Congratulations! Youโve successfully sent your first WhatsApp template
message.
Automate with Pipelines
Integrate template messages into automated conversation flows
Track Performance
Monitor delivery rates, engagement, and customer responses
Webhook Integration
Set up real-time notifications for message status updates
Channel Management
Connect additional channels for multi-platform messaging
Remember: Template messages are powerful tools for customer communication.
Use them responsibly and always prioritize customer value and consent.