# Send a WhatsApp message

In order to send a WhatsApp message in Bird CRM you will need to setup a few things.

## Step 1: Setup your API key

To send WhatsApp messages, you must create an Access key with the `Application Developer` role. Refer to the [Access Management](/api/api-access/api-authorization.md) section to learn more. To send a message, set it up as shown below.

<figure><img src="/files/qczgYvhrR5ecOzsK858U" alt="" width="375"><figcaption><p>Access key setup</p></figcaption></figure>

The ability to create Access keys can be found in `Settings` -> `Security` -> `Access Keys`.

## Optional: Setup your number

This step is optional if your number is already configured in your Meta account. To send messages using a WhatsApp channel, you must first acquire a long-code number and complete all compliance requirements to activate it. You can buy your number in Developer Cloud by selecting `Numbers` -> `LongCode Numbers` -> `Buy a number`.

<figure><img src="/files/kjRsx1UfuTAgZCB7oV51" alt=""><figcaption><p>Buy a number</p></figcaption></figure>

## Step 2: Setup your channel

To set up your WhatsApp channel, ensure you have access to the Meta account you want to associate with it. Once you confirm the correct access and permissions, simply fill in the required information displayed in Developer Cloud after navigating to `WhatsApp` -> `WhatsApp Setup`. For more details, please refer to [Install WhatsApp](https://docs.bird.com/applications/channels/channels/supported-channels/whatsapp/quickstarts/install-whatsapp).

<figure><img src="/files/dceXjdFPP1mpDWryCCqM" alt=""><figcaption><p>Channel setup</p></figcaption></figure>

If the setup is successful, you should see a similar screen. Ensure that the channel is marked as `Live` and `healthy`.

<figure><img src="/files/OqFB9fi7vRRXEPubvGa6" alt=""><figcaption><p>Channel</p></figcaption></figure>

## Step 3: Setup a template

In Developer Cloud, select the `Template Management` option and create a new WhatsApp template by following the provided instructions, for more details, please refer to [WhatsApp Message Templates](https://docs.bird.com/applications/content/message-templates/concepts/whatsapp-message-templates). Keep in mind that using a template is a requirement from Meta to initiate a conversation.

<figure><img src="/files/69yp5LhFDpuCuEcpnWY9" alt=""><figcaption><p>Template creation</p></figcaption></figure>

Ensure that your template is both active and approved.

<figure><img src="/files/gYEjoErwIIerOHDU30Si" alt=""><figcaption><p>Template</p></figcaption></figure>

## Step 4: Send a message

With the Access key, Channel and Template set up, you’re ready to send messages. Use the following example cURL request to send a WhatsApp message using your API key, workspace ID, template ID, channel ID:

{% tabs %}
{% tab title="Request" %}

```bash
curl -X POST "https://api.bird.com/workspaces/a1405560-c8d3-4b1a-877d-3f449ad95352/channels/123e4567-e89b-12d3-a456-426614174000/messages" \
-H "Content-Type: application/json" \
-H "Authorization: AccessKey abcd" \
-d '{
  "receiver": {
    "contacts": [
      {
        "identifierValue": "+17077066620"
      }
    ]
  },
  "template": {
    "projectId": "123e4567-e89b-12d3-a456-426614174000",
    "version": "123e4567-e89b-12d3-a456-426614174000",
    "locale": "en",
    "variables": {
        "otp": "142144"
    }
  }
}'
```

{% endtab %}

{% tab title="Response (200 - OK)" %}

```json
{
    "id": "f67bc25c-3d20-4c4f-aee1-eb3a29e1f2fd",
    "channelId": "123e4567-e89b-12d3-a456-426614174000",
    "sender": {
        "connector": {
            "id": "9cd58079-2b09-4ee2-894d-12ca17a2e05d",
            "identifierValue": "118900147813532"
        }
    },
    "receiver": {
        "contacts": [
            {
                "id": "55f3777a-4e2d-4a54-ba11-47ec80aa7e6e",
                "identifierKey": "phonenumber",
                "identifierValue": "+17077066620",
                "platformAddress": "+17077066620",
                "countryCode": "US"
            }
        ]
    },
    "body": {
        "type": "authentication",
        "authentication": {
            "otp": {
                "disclaimer": false,
                "expirationTime": 60,
                "actions": [
                    {
                        "type": "postback",
                        "postback": {
                            "text": "Copy code",
                            "payload": "",
                            "otpType": "COPY_CODE"
                        }
                    }
                ]
            }
        }
    },
    "meta": {
        "extraInformation": {
            "use_wa_platform_account_id_approach": "true"
        }
    },
    "template": {
        "projectId": "65453a57-6e41-45d0-87ef-da85bfb4edd3",
        "version": "756cc66a-3a51-441a-b98d-cc3a5400b9df",
        "name": "",
        "locale": "en",
        "variables": {
            "otp": "142144"
        },
        "shortLinks": {
            "enabled": true,
            "domain": "test-4.ew1.sandbox.brd.to"
        },
        "parameters": []
    },
    "reference": "",
    "parts": [],
    "status": "accepted",
    "reason": "",
    "direction": "outgoing",
    "context": {},
    "lastStatusAt": "2024-12-03T13:00:00.000Z",
    "createdAt": "2024-12-03T13:00:00.000Z",
    "updatedAt": "2024-12-03T13:00:00.000Z",
    "notification": {},
    "batchId": null
}
```

{% endtab %}
{% endtabs %}

## Step 5: Checking messages

You can verify the [message status](/api/channels-api/message-status-and-interactions.md) through the following mechanisms:

### 1. UI

In the developer console, you can easily access the `Message Log` under the `WhatsApp` section.

<figure><img src="/files/Qnn4oK8mTsMhUPB0Xopr" alt=""><figcaption><p>WhatsApp log</p></figcaption></figure>

Alternatively, you can navigate to `Manage Channels`, select `WhatsApp`, and then choose the channel you used. After that, switch to the `Logs` tab to view the message logs.

<figure><img src="/files/mMOlgV55PYNgVN3JUSDG" alt=""><figcaption><p>Channel logs</p></figcaption></figure>

### 2. API

To retrieve message details via the API, refer to the [Messaging API Documentation](/api/channels-api/api-reference/messaging.md#retrieving-messages). You can find more information on the available endpoints, request formats, and required parameters.

### 3. Webhook

Subscribe to the `channels` service and the `whatsapp.outbound` event in Developer Cloud to receive updates. For additional information, refer to the [Notifications API](https://docs.bird.com/api/notifications-api). Example configuration:

<figure><img src="/files/S641cwSZzTRlfCDK6CIS" alt="" width="375"><figcaption><p>Webhook</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bird.com/api/quickstarts/send-a-whatsapp-message.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
