logo
enes

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) and type (details)
  • type values 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:

NameDescriptionTypeRequirements
longitudeLongitude in decimal degrees. Allowed range: strictly between -181 and 181 (exclusive).NumberRequired.
latitudeLatitude in decimal degrees. Allowed range: strictly less than 90 (exclusive upper bound).NumberRequired.
nameLocation name.StringOptional.
addressLocation address.StringOptional.

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:

NameDescriptionTypeRequirements
send_location_requestObject with the location request.ObjectRequired.
send_location_request.bodyPlain text of the message.StringRequired.
send_location_request.actionAction object. If sent, action.name is always forced to send_location.ObjectOptional.

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"
}
}
}


Previous
Media
Next
Contacts