Skip to main content

πŸš€ 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:
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 name
  • variables: Array of values for template variables (in order)
  • stageId: Stage ID from pipeline response
  • toPhoneNumber: Destination number
  • meta_data: Additional metadata object (can be empty)
  • agent_id: (Optional) Agent ID to assign to the conversation
5

Handle the Response

Process the API response to confirm delivery:
Response codes:
  • 201: Message sent successfully
  • 400: Bad request (check required fields)
  • 401: Unauthorized (verify API key)

Vambe Template Examples

Simple Template (No Variables)

Template with Variables

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 the SendTemplateDto schema, here are the required and optional fields:
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"].
When sending carousel templates, each card in the carouselVariables array has the following structure:
Carousel Templates allow you to send multiple cards with images/videos in a single message. Each card can have its own header media, body text variables, and button actions. Cards are indexed starting from 0.

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

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

Solutions:
  • Verify template ID is correct
  • Check template approval status in Vambe dashboard
  • Ensure template exists for your account
Solutions:
  • Check stage ID from pipeline API response
  • Verify stage belongs to your account
  • Ensure pipeline is active and configured
Solutions:
  • Include country code (e.g., +1 for US)
  • Validate phone number format
  • Ensure number is active on WhatsApp
Solutions:
  • 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.
Now you can:

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.