# Sending Media Attachments – Push

You can send media files using the below method;

{% hint style="info" %}
Please pass your internet facing public URL of your media file through **“globalmedia”** please make sure the media file can be downloaded and accessible through internet.\
\
Those who are using standalone application or don't have a webserver for media files then can make use of **"globalmedia\_code"** to pass the base64 code of the media files&#x20;
{% endhint %}

### **Supported Media Files**&#x20;

| Platform | Type     | Extension                     | Max Size |
| -------- | -------- | ----------------------------- | -------- |
| WhatsApp | Images   | jpg, jpeg, gif, png, image    | 5 MB     |
| WhatsApp | Video    | mp4, 3gpp                     | 16 MB    |
| WhatsApp | Audio    | mp3, wav, aac, m4a, amr, opus | 16 MB    |
| WhatsApp | Document | Any valid MIME-type           | 100 MB   |

Only H.264 video codec and AAC audio codec is supported by WhatsApp

### **Optional Caption Message**

For image & video you can pass caption text in the **“globalmessage”** or **“message”** variables, by passing a separate message in the **“message”** variable you have the capability to send dynamic caption message which is helpful for sending personalised messages with image & video. Please note caption message works only with **“image & video”** files

![whatsapp-image-with-caption-message](https://3382165395-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LlJChpzcxtwOYGcBd1q%2F-LlLzqPXlHHuRZkeRq-P%2F-LlM-a9UcHUjgBCoeR01%2Fwhatsapp-image-with-caption-message.png?alt=media\&token=8f49c68e-3afe-4935-b865-c2865c262a3d)

{% hint style="warning" %}
**Sending Dynamic Media**&#x20;

Currently we don't support sending dynamic media files to each contacts through a single API for phone & WhatsApp Web automation, so if you need to send dynamic images then please trigger the API multiple times keeping **5 seconds** intervals between each API request.\
\
**Sending dynamic media file is supported for those who are using WhatsApp Official or WhatsApp Shared Numbers use "media" or "media\_code" variable**&#x20;
{% endhint %}

## Sending Media Attachments Messages&#x20;

<mark style="color:green;">`POST`</mark> `https://pickyassist.com/app/api/v2/push`

This API allows you to send  Messages with media attachments

### Request URL (V4)

Method : **`POST`**

```
https://app.pickyassist.com/api/v2/push
```

#### Request Body

| Name          | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| token         | string | Your API token for authentication                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| media\_name   | string | Optional for PDF & Documents, pass the file name to be displayed, not supported in Phone Automation, a maximum of 20 characters                                                                                                                                                                                                                                                                                                                                                                                                 |
| media\_code   | string | If you need to pass base64 of the media file then please pass through this variable                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| application   | number | <p>Specify through which application the message need to sent.<br><br>1 = Whatsapp Personal<br>2 = Whatsapp Business<br>3 = SMS<br>4 = Call Conference<br>8 = WhatsApp Official <br>10 = WhatsApp Web Automation</p><p>121 = WhatsApp Official Managed<br>101 = WhatsApp Cloud API<br><br><strong>If you have connected multiple channels or using WhatsApp Cloud api then please get the channel id from your project under Settings -></strong> <a href="https://pickyassist.com/app/settings/channels">Channels </a><br></p> |
| globalmessage | string | Pass Caption Message Here supports only for image and video.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| globalmedia   | string | URL from we need to fetch the media ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| priority      | string | <p>This gives priority  in the message queue <br><br>0 = Low (Default) <br>1 = High</p>                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| data          | array  | This is an array in which you need to pass the mobile number and message                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| number        | number | <p>Mobile Number with full country code <em><strong>without 0 or +</strong></em> <br><br><del>+55 12345 6789</del> – Wrong Format<br><strong>55123456789 – Correct Format</strong></p>                                                                                                                                                                                                                                                                                                                                          |
| message       | string | <p>Pass Caption message here <br><br><strong>Caption text is not supported for PDF, Audio, Document</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                |

{% tabs %}
{% tab title="200 Please note “100 -> Sucess”  response doesn’t means the message has been successfully send to the user, it means your message has been accepted by our servers and pushed to your phone / docker / app for processing.
" %}

```javascript
{
    "status": 100,
    "push_id": "7478630",
    "message": "Success",
    "data": [
        {
            "msg_id": "9844217",
            "number": "934343442290",
            "credit": "0.005"
        },
        {
            "msg_id": "9844218",
            "number": "35435304220",
            "credit": "0.005"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### Sample Request Body JSON for Sending Static Media Files

```javascript
{
  "token": "PICKY_API_TOKEN",
  "priority ": "0",
  "application": "1",
  "media_file": "Name of the File",
  "globalmessage": "Media URL", 
  "globalmedia": "MEDIA FILE UNIQUE URL",
  "data": [
    {
      "number": "NUMBER 1", 
      "message": "Caption Message" 
    }
  ]
}
```

### Sample Request Body JSON for sending Static Media Files using Base64

```javascript
{
  "token": " PICKY_API_TOKEN  ",
  "priority ": "0",
  "application": "8",
  "globalmessage": "GLOBAL MESSAGE",
  "globalmedia_code": "Media Base64 Code",
  "data": [
    {
      "number": " NUMBER 1 ",
      "message": "Caption Message"
    }
  ]
}

```

###

### Sample Request Body JSON for Sending Audio File as Voice Note

{% hint style="danger" %}
Please note this method works only WhatsApp Web Automation Channel
{% endhint %}

```javascript
{
   "token":"248f02903a57ee0fed380bd500dd1293e6d",
   "application":"10",
   "globalmedia":"Audio URL",
   "voice":1,
   "data":[
      {
         "number":"1194407768",
         "message":""
      }
   ]
}
```

### Sample Request Body JSON for Sending Dynamic Media&#x20;

{% hint style="danger" %}
Sending dynamic media is supported only in WhatsApp Official & WhatsApp Shared Numbers
{% endhint %}

```javascript
{
   "token":"PICKY_API_TOKEN",
   "priority ":"0",
   "application":"8",
   "globalmessage":"",
   "data":[
      {
         "number":"NUMBER 1",
         "message":"MESSAGE FOR NUMBER 1",
         "media":"media url for number 1"
      },
      {
         "number":"NUMBER 2",
         "message":"MESSAGE FOR NUMBER 2",
         "media":"media url for number "
      },
      {
         "number":"NUMBER 3",
         "message":"MESSAGE FOR NUMBER 3",
         "media":"media url for number 3"
      },
      {
         "number":"NUMBER 4",
         "message":"MESSAGE FOR NUMBER 4",
         "media":"media url for number 4"
      },
      {
         "number":"NUMBER 5",
         "message":"MESSAGE FOR NUMBER 5",
         "media":"media url for number 5"
      }
   ]
}
```

### Sample Request Body JSON for Sending Dynamic Media through Base64&#x20;

{% hint style="danger" %}
Sending dynamic media is supported only in WhatsApp Official & WhatsApp Shared Channels&#x20;
{% endhint %}

```javascript
{
   "token":"PICKY_API_TOKEN",
   "priority ":"0",
   "application":"8",
   "globalmessage":"",
   "data":[
      {
         "number":"NUMBER 1",
         "message":"MESSAGE FOR NUMBER 1",
         "media_code":"base64 code for number 1"
      },
      {
         "number":"NUMBER 2",
         "message":"MESSAGE FOR NUMBER 2",
         "media_code":"base64 code for number 2"
      },
      {
         "number":"NUMBER 3",
         "message":"MESSAGE FOR NUMBER 3",
         "media_code":"base64 code for number 3"
      },
      {
         "number":"NUMBER 4",
         "message":"MESSAGE FOR NUMBER 4",
         "media_code":"base64 code for number 4"
      },
      {
         "number":"NUMBER 5",
         "message":"MESSAGE FOR NUMBER 5",
         "media_code":"base64 code for number 5"
      }
   ]
}
```

###

### Sample Response

```javascript
{
    "status": 100,
    "push_id": "7478630",
    "message": "Success",
    "data": [
        {
            "msg_id": "9844217",
            "number": "934343442290",
            "credit": "0.005"
        },
        {
            "msg_id": "9844218",
            "number": "35435304220",
            "credit": "0.005"
        }
    ]
}
```

{% hint style="info" %}
Please note **“100 -> Sucess”** response doesn’t means the message has been successfully sent to the user, it means your message has been accepted by our servers and pushed to your phone / docker /app for processing.
{% endhint %}
