> For the complete documentation index, see [llms.txt](https://docs.channel360.co.za/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.channel360.co.za/api-usage/reply-to-a-customer/send-a-media-reply.md).

# Send a media reply

Reply to a customer with an image, video, audio clip or document.

Send an image, video, audio clip or document to a customer who has written to you in the last 24 hours.

## Before you start

* The customer's app user ID (`<APP_USER_ID>`), from the `message:appUser` webhook event. See [Reply to a customer](/api-usage/reply-to-a-customer.md).
* The file, at a **public `https://` link**. WhatsApp downloads the file from that link, so it must open without a login.

## Request body

`POST` `/org/<ORG_ID>/whatsapp/appuser/<APP_USER_ID>/reply`

Set `type` for media messages. `mediaUrl` is required for every media type.

| `type`     | Optional fields    | Result                                         |
| ---------- | ------------------ | ---------------------------------------------- |
| `image`    | `text`             | Inline image                                   |
| `video`    | `text`, `filename` | Inline video                                   |
| `audio`    | `filename`         | Inline audio                                   |
| `document` | `filename`, `text` | Downloadable document with an optional caption |
| `file`     | `filename`, `text` | Legacy file message                            |

Any unsupported `type` returns `400`.

Use `document` for new file attachments. The `file` type remains available for older integrations.

## Send a document

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

```bash
curl -X POST "https://channel360.co.za/v1.1/org/<ORG_ID>/whatsapp/appuser/<APP_USER_ID>/reply" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "document",
    "mediaUrl": "https://example.com/files/september-invoice.pdf",
    "filename": "September Invoice.pdf",
    "text": "Your invoice for September"
  }'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const response = await fetch(
  "https://channel360.co.za/v1.1/org/<ORG_ID>/whatsapp/appuser/<APP_USER_ID>/reply",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer <API_KEY>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      type: "document",
      mediaUrl: "https://example.com/files/september-invoice.pdf",
      filename: "September Invoice.pdf",
      text: "Your invoice for September"
    })
  }
);

console.log(await response.json());
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

response = requests.post(
    "https://channel360.co.za/v1.1/org/<ORG_ID>/whatsapp/appuser/<APP_USER_ID>/reply",
    headers={
        "Authorization": "Bearer <API_KEY>",
        "Content-Type": "application/json",
    },
    json={
        "type": "document",
        "mediaUrl": "https://example.com/files/september-invoice.pdf",
        "filename": "September Invoice.pdf",
        "text": "Your invoice for September",
    },
)

print(response.json())
```

{% endtab %}
{% endtabs %}

## Other media types (body only)

Send these bodies to the same endpoint, with the same headers.

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

```json
{
  "type": "image",
  "mediaUrl": "https://example.com/files/receipt.jpg",
  "text": "Your receipt"
}
```

{% endtab %}

{% tab title="Video" %}

```json
{
  "type": "video",
  "mediaUrl": "https://example.com/files/demo-walkthrough.mp4"
}
```

{% endtab %}

{% tab title="Audio" %}

```json
{
  "type": "audio",
  "mediaUrl": "https://example.com/files/voice-note.ogg"
}
```

{% endtab %}
{% endtabs %}

## Check it worked

The API returns `201` with `{ "messages": [ { … } ] }`. Your webhook then receives `message:delivery:channel` and `message:delivery:user`.

If WhatsApp cannot download the file, the API returns `400` with WhatsApp's error message, or your webhook receives `message:delivery:failure`. Check that the link opens in a private browser window.

## Next

{% content-ref url="/pages/ttQZtXdx7lPV0kUjRdhc" %}
[Send an interactive reply](/api-usage/reply-to-a-customer/send-an-interactive-reply.md)
{% endcontent-ref %}
