# POST Send Message API

### API End Points

```
https://api-v7.express-chat.com/whatsapp-automation/wa/templates?apiKey=*API KEY*
```

### Request Headers

| Header       | Details          |
| ------------ | ---------------- |
| apiKey       | *API KEY*        |
| Content-Type | application/json |

{% tabs %}
{% tab title="Plain Text Messages" %}

### Request Body

```
{
    "userName": "Test",
    "wa_id": "910987654321",
    "type": "text",
    "message": {
        "text": "hi"
    },
    "tags": [ "test" ]
}
```

### Parameters

| Parameter                     | Type   | Description                                                                                                                        |
| ----------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| userName                      | string | The name of the user to whom the message is being sent.                                                                            |
| wa\_id                        | string | The WhatsApp number of the user to whom the message is being sent. The number must contain the country code without the plus sign. |
| type                          | string | The type of message being sent (e.g., text, image).                                                                                |
| message.text                  | string | message that needs to be sent                                                                                                      |
| message.label                 | string | The caption you want to send along with the image (optional) Only if type is image                                                 |
| message.source                | string | <p>The image link                                                                                                                  |
| <br>(optional)                |        |                                                                                                                                    |
| <br>Only if type is image</p> |        |                                                                                                                                    |
| tag                           | array  | Tags are the labels that you can assign to conversations or chats to help organize and manage effectively.                         |

{% endtab %}

{% tab title="Media Messages" %}

### Request Body

```
{
    "userName": "Test",
    "wa_id": "910987654321",
    "type": "image",
    "message": {
        "source": "https://imgv3.fotor.com/images/blog-cover-image/part-blurry-image.jpg",
        "label": "hey",
    }
}
```

### Parameters

| Parameter      | Type   | Description                                                                                                                        |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| userName       | string | The name of the user to whom the message is being sent.                                                                            |
| wa\_id         | string | The WhatsApp number of the user to whom the message is being sent. The number must contain the country code without the plus sign. |
| type           | string | The type of message being sent (e.g., text, image).                                                                                |
| message.source | string | The URL of the media being sent.                                                                                                   |
| message.label  | string | The text to attach to the media.                                                                                                   |
| message.type   | string | The type of media being sent (e.g., image, document).                                                                              |

### Example

```
curl --location '<https://api-v7.express-chat.com/whatsapp-automation/wa/send-message?apiKey=*API KEY*>' \\\\
--header 'apiKey: *API KEY*' \\\\
--header 'Content-Type: application/json' \\\\
--data '{
    "userName": "Test",
    "wa_id": "910987654321",
    "type": "image",
    "message": {
        "source": "<https://imgv3.fotor.com/images/blog-cover-image/part-blurry-image.jpg>",
        "label": "hey",
        "type": "image"
    }
}'
```

{% endtab %}
{% endtabs %}

### Error Codes <a href="#error-codes" id="error-codes"></a>

Refer to the [official documentation](https://developers.facebook.com/docs/whatsapp/on-premises/errors) for more information on error codes.


---

# 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://partners.botpenguin.com/api-documentation/whatsapp-cloud-api/post-send-message-api.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.
