# Send Location message

This endpoint sends a location message to a phone number on whatsapp.&#x20;

***Please note: We can only send a location message if client has initiated the conversation.***

**URL:​** ​<https://waapi.pepipost.com/api/v2/message/>&#x20;

**Method:** POST

### &#x20;Parameters:

| Parameter           | Description                                                                                                                                                                                                                                                                                       | Data Type | Required |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------- |
| recipient\_whatsapp | Recipient’s phone number. Must be a valid number. Phone number must include a country code otherwise message might not get delivered.                                                                                                                                                             | String    | Yes      |
| recipient\_type     | <p>Indicate whether the recipient is an <code>individual</code>or a <code>group</code>.</p><p> Specifying <code>recipient\_type</code> in the request is optional when the value is <code>individual</code>. However, <code>recipient\_type</code> is required when using <code>group</code>.</p> | String    | No       |
| message\_type       | Type of a message as `location`                                                                                                                                                                                                                                                                   | String    | Yes      |
| source              | Source id of the origin. Source id must be valid and obtained from source creation API.                                                                                                                                                                                                           | String    | Yes      |
| longitude           | Longitude of the location.It should be valid longitude.                                                                                                                                                                                                                                           | double    | Yes      |
| latitude            | Latitude of the location.It should be valid latitude.                                                                                                                                                                                                                                             | double    | Yes      |
| name                | Name of the location.                                                                                                                                                                                                                                                                             | string    | No       |
| address             | Full address of the location.                                                                                                                                                                                                                                                                     | string    | No       |
| x-apiheader         | Any custom data which user needs to send. X-apiheader can be used instead of message id for mapping messages.                                                                                                                                                                                     | String    | No       |

### Request Body

```
{ 
   "message": [ 
       { 
           "recipient_whatsapp": "919930609609",
           "recipient_type": "individual", 
           "message_type": "location", 
           "source": "329f-998", 
           "x-apiheader": "custom_data", 
           "type_location": [ 
               { 
                   "longitude": -122.425332, 
                   "latitude": 37.758056, 
                   "name": "Facebook HQ", 
                   "address": "1 Hacker Way, Menlo Park, CA 94025" 
               } 
           ] 
       } 
   ] 
} 
  
```

### Responses for message API

#### In case of success

```
{ 
   "status": "success", 
   "message": "Request received successfully.", 
   "data": { 
       "id": "6929d4af-490d-454a-8cf3-0502a3506f09" 
   } 
} 
```

This id in response is message id for future response. All the message status updates on webhook will be mapped to this id. So store this message id at your side.

#### In case of failure

```
{ 
   "status": "failure", 
   "error": { 
       "code": "8006", 
       "message": " type is required." 
   } 
} 
```

According to error code and message will change.
