๐ 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.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)
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:Get Template ID
Find your approved template ID:Look for your template name and copy its ID for the final call.
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)
Vambe Template Examples
Simple Template (No Variables)
Template with Variables
Carousel Template
Carousel templates allow you to send multiple product cards with images, descriptions, and action buttons in a single message.The
from-phone-number query parameter specifies which WhatsApp Business number to send from. This is useful when you have multiple phone numbers connected to your account.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 |
carouselVariables | object[] | Optional | Variables for carousel template cards (see below) |
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"].Carousel Card Variables
When sending carousel templates, each card in thecarouselVariables array has the following structure:
| Field | Type | Required | Description |
|---|---|---|---|
cardIndex | number | Required | Zero-based index of the carousel card (0, 1, 2, โฆ) |
headerVariable | string | Required | URL for the cardโs header image or video |
bodyVariables | string[] | Optional | Array of variables for the cardโs body text |
buttonVariables | string[] | Optional | Array of variables for the cardโs buttons (e.g., URLs) |
Alternative Endpoint: Body-based V2
Thereโs an alternative endpoint that accepts all parameters in the request body, including the phone number and template name: Endpoint:POST /api/public/whatsapp/message/send
V2 Request Body Schema
| Field | Type | Required | Description |
|---|---|---|---|
phone | string | Required | Phone number to send the template to |
template_name | string | Required | Name of the template to send |
contact_name | 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) |
stage_id | string | Optional | Pipeline stage ID where to send the message |
agent_id | string | Optional | Agent ID to assign to the conversation |
from_phone_number | string | Optional | Phone number to send the template from |
carouselVariables | object[] | Optional | Variables for carousel template cards (same as above) |
V2 Carousel Template Example
The V2 endpoint uses
template_name instead of templateId in the URL path, and uses snake_case for field names (contact_name, stage_id, from_phone_number) instead of camelCase.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.
