Location
Last update: 6 hours ago by Irais Aguirre
Integration summary
- Endpoint:
POST https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging- Token: messaging token, in the
Authorization: Bearer {{wa-msg-api-token}}header (how to generate it)- Common fields:
from,to(phone number or BSUID) andtype(details)typevalues on this page:"location","interactive"- Response: the same for every message (see response)
Messages to send a location or ask the user to share theirs. All are sent with POST /v1/messaging; headers, common fields and the response are in HTTP connection.
Location
Sends a location with its coordinates and, optionally, a name and address. The type field must be "location".
Body
Fields for Location, in addition to the common fields:
| Name | Description | Type | Requirements |
|---|---|---|---|
| longitude | Longitude in decimal degrees. Allowed range: strictly between -181 and 181 (exclusive). | Number | Required. |
| latitude | Latitude in decimal degrees. Allowed range: strictly less than 90 (exclusive upper bound). | Number | Required. |
| name | Location name. | String | Optional. |
| address | Location address. | String | Optional. |
Example
Complete Location example (HTTP request and JSON body):
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "location","longitude": -122.425332,"latitude": 37.758056,"name": "Facebook HQ","address": "1 Hacker Way, Menlo Park, CA 94025"}'
Body
{"from": "5215500000001","to": "5215500000002","type": "location","longitude": -122.425332,"latitude": 37.758056,"name": "Facebook HQ","address": "1 Hacker Way, Menlo Park, CA 94025"}
Location request
Asks the user to share their location. The type field must be "interactive".
Body
Fields for Location request, in addition to the common fields:
| Name | Description | Type | Requirements |
|---|---|---|---|
| send_location_request | Object with the location request. | Object | Required. |
| send_location_request.body | Plain text of the message. | String | Required. |
| send_location_request.action | Action object. If sent, action.name is always forced to send_location. | Object | Optional. |
Example
Complete Location request example (HTTP request and JSON body):
HTTP request
curl -X POST 'https://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "interactive","send_location_request": {"body": "Please share your location to continue with the service.","action": {"name": "send_location"}}}'
Body
{"from": "5215500000001","to": "5215500000002","type": "interactive","send_location_request": {"body": "Please share your location to continue with the service.","action": {"name": "send_location"}}}
