Request Location
🔒 WhatsApp 24-Hour Session Rule
Before requesting for a location, make sure the WhatsApp session with the user is active.
If the user has not messaged your business within the last 24 hours, WhatsApp requires the first message to be a template message.
After the customer replies, the 24-hour session opens and you may request a location using this API. For sandbox testing, send your join code to the sandbox number to activate your session. Learn more
WhatsApp offers an API to request a user's location.

POST
https://gateway.lipachat.com/api/v1/whatsapp/request_locationHeaders
Content-Type
application/json
apiKey
Get apiKey from App portal settings tabhttps://app.lipachat.com/app/settings
Body
messageId
string
A unique identifier for the message. This will be used to track the message status and for deduplication purposes.
from
string
Sandbox number +254110090747 or your own WABA phone number.
to
string
Receiver phone number. It should start with a country code.
text
string
Message body text. Supports URLs.
Maximum 1024 characters.
curl --location 'https://gateway.lipachat.com/api/v1/whatsapp/request_location' \
--header 'apiKey: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"messageId": "b3e1e37c-e50b-48b2-8972-6cc659ac33d2",
"to": "2547XXXX",
"from": "254110090747",
"text": "Let'\''s start with your pickup. You can either manually *enter an address* or *share your current location*."
}'// Create an instance of OkHttpClient
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
// Define the media type for the request
MediaType mediaType = MediaType.parse("application/json");
// Create the request body with the necessary JSON payload using a text block
RequestBody body = RequestBody.create(mediaType, """
{
"messageId": "b3e1e37c-e50b-48b2-8972-6cc659ac33d2",
"to": "2547XXXX",
"from": "254110090747",
"text": "Let'\''s start with your pickup. You can either manually *enter an address* or *share your current location*."
}
""");
// Build the request with the required headers
Request request = new Request.Builder()
.url("https://gateway.lipachat.com/api/v1/whatsapp/request_location")
.method("POST", body)
.addHeader("apiKey", "YOUR_API_KEY")
.addHeader("Content-Type", "application/json")
.build();
// Execute the request and get the response
Response response = client.newCall(request).execute();
const axios = require('axios');
let data = JSON.stringify({
"messageId": "b3e1e37c-e50b-48b2-8972-6cc659ac33d2",
"to": "2547XXXX",
"from": "254110090747",
"text": "Let'\''s start with your pickup. You can either manually *enter an address* or *share your current location*."
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://gateway.lipachat.com/api/v1/whatsapp/request_location',
headers: {
'apiKey': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Response
{
"timestamp": "2023-08-06T01:27:56.825898971",
"data": {
"messageId": "7addc006-07db-4fae-aac5-b285903b41d4",
"waId": "wamid.HBgMMjU0NzE3NzQ2NTY1FQIAEnRgSRjJGRkMzNkQ0QUVENTIxQ0NBAA==",
"status": "SENT",
"statusDesc": "Message sent successfully"
},
"status": "success",
"message": "",
"errors": null
}{
"timestamp": "2023-08-06T17:50:35.701+00:00",
"status": 400,
"error": "Bad Request",
"path": "/api/v1/whatsapp/request_location"
}{
"timestamp": "2023-08-06T20:49:48.455464058",
"data": null,
"status": "success",
"message": "Invalid credentials",
"errors": null
}Last updated