How it works

Sending transactional WhatsApp messages with Cocoonmail involves two main steps:
1

Create WhatsApp Templates

First, you need to create and get approval for your WhatsApp templates within the Meta / WhatsApp Business Platform. Once approved, they will be available in Cocoonmail.
2

Send with the API

To send transactional WhatsApp messages, you use the Cocoonmail API. You need to provide the template_name, from_number, and recipient details.

Request Parameters

When sending a transactional WhatsApp message, you need to provide several key parameters in your API request.

Sender and Template

  • from_number: The WhatsApp Business number you are sending from.
  • template_name: The name of the approved WhatsApp template.
  • template_language: The language code of the template (e.g., en).

Recipient Data

You can send to multiple recipients in a single request. For each recipient, you can provide:
  • whatsapp_number: The recipient’s phone number in international format.
  • first_name: Recipient’s first name.
  • email: Recipient’s email address.
  • attributes: Custom attributes for the recipient (e.g., city, plan).

Custom Parameters

Use custom_parameters to provide global values that can be used across your templates or integrated into your business logic.

Event Data

The event object allows you to trigger specific workflows or track the message against a particular business event (e.g., a “START” event for a marathon).

Example API Request

Endpoint: POST /webhook/whatsapp_message/send Payload:
{
    "from_number": "+91 94494 41410",
    "template_name": "marathon_start_testing_2",
    "template_language": "en",
    "recipient": [
        {
            "whatsapp_number": "+919886000187",
            "first_name": "sourabh first",
            "email": "sourabh@inofinix.com",
            "attributes": {
                "city": "New York",
                "plan": "premium"
            }
        }
    ],
    "custom_parameters": {
        "organization.company_name": "Cocoonmail"
    },
    "event": {
        "code": "START",
        "name": "start",
        "data": {
            "event_name": "24hr marathon"
        }
    }
}

Metrics

After messages are sent, you can track their delivery status and engagement metrics within the Cocoonmail dashboard. This includes:
  • Sent: The message was successfully sent from our system.
  • Delivered: The message was delivered to the recipient’s device.
  • Read: The recipient has read the message.
  • Failed: Any issues encountered during delivery.

Best Practices

  • Opt-in: Ensure you have the necessary opt-ins to send WhatsApp messages to your recipients.
  • Template Quality: Use clear and concise language in your templates to ensure high approval rates and better user engagement.
  • Testing: Test your integration using test numbers before sending to your entire list.