> 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/using-the-channel360-v1.1-api/conversations/send-media-message.md).

# Send Media Message

Send media messages and upload attachments for WhatsApp conversations.

## Send media messages

Send media to a customer's WhatsApp conversation through the reply endpoint.

<mark style="color:green;">`POST`</mark> `/v1.1/org/{orgId}/whatsapp/appuser/{appUserId}/reply`

`appUserId` is the customer's app user ID. Retrieve it from conversation history.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <api key>` |

{% hint style="info" %}
The web application uses `/webapi/org/{orgId}/…` with a Cognito session.
{% endhint %}

### Request body

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 Unsupported`.

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

### Upload an attachment

Upload a file before sending it. Use `attachment.mediaUrl` from the response as `mediaUrl` in a `document` message.

<mark style="color:green;">`POST`</mark> `/v1.1/org/{orgId}/whatsapp/attachments`

```bash
curl --location 'https://www.channel360.co.za/v1.1/org/{orgId}/whatsapp/attachments' \
  --header 'Authorization: Bearer <api key>' \
  --form 'source=@"/path/to/your-file.pdf"'
```

The response includes the hosted media URL and detected media type.

```json
{
  "attachment": {
    "mediaUrl": "https://media.smooch.io/apps/<app-id>/<file-id>/your-file.pdf",
    "mediaType": "application/pdf"
  }
}
```

### Send media

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

```json
{
  "type": "image",
  "mediaUrl": "https://media.smooch.io/…/receipt.jpg",
  "text": "Your receipt"
}
```

{% endtab %}

{% tab title="Video" %}

```json
{
  "type": "video",
  "mediaUrl": "https://media.smooch.io/…/demo-walkthrough.mp4"
}
```

{% endtab %}

{% tab title="Audio" %}

```json
{
  "type": "audio",
  "mediaUrl": "https://media.smooch.io/…/voice-note.ogg"
}
```

{% endtab %}

{% tab title="Document" %}

```json
{
  "type": "document",
  "mediaUrl": "https://media.smooch.io/apps/<app-id>/<file-id>/your-file.pdf",
  "filename": "September Invoice.pdf",
  "text": "Your invoice for September"
}
```

{% endtab %}
{% endtabs %}
