Skip to content

Whatsapp Location Messages

Location messages allow you to send a location's latitude and longitude coordinates to a WhatsApp user.

Image Alt Text

Location Object

Parameter Type Description Value / Pattern
*longitude String Longitude of the Location you wants to send in decimal degrees. 37.44216251868683
*latitude String Longitude of the Location you wants to send in decimal degrees. -122.16153582049394
name String Name of the Location you wants to send. Philz Coffee
address String Address of the Location you wants to send. Only displayed if the name is present. 101 Forest Ave, Palo Alto, CA 94301
 "location": {
                 "longitude": 77.6109,
                 "latitude": 12.9379,
                 "name": "ABC PRIVATE LIMITED",
                 "address": " 30, Hosur Main Road"
             }

Programing Examples:

 curl --location 'https://apialpha.d7networks.com/whatsapp/v2/send' \
 --header 'Content-Type: application/json' \
 --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc' \
 --data-raw '{
     "messages": [
         {
             "originator": "{registered_phone_number}",
             "content": {
                 "message_type": "LOCATION",
                 "location": {
                     "longitude": 77.6109,
                     "latitude": 12.9379,
                     "name": "KARIxx PRIVATE LIMITED",
                     "address": " 30, Hosur Main Road"
                 }
             },
             "recipients": [
                 {
                     "recipient": "{recipient}",
                     "recipient_type": "individual",
                     "cust_ref": "[email protected]",
                     "message_tag1": "chatbot1234",
                     "conversation_id": "conv1234"
                 }
             ],
             "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
         }
     ]
 }'
npm i direct7
const Client = require('direct7')

const client = new Client(apiToken="Your API token")

const response = await client.whatsapp.sendWhatsAppFreeformMessage({
        originator:"{registered_phone_number}",
        recipient: "{recipient}",
        message_type: "LOCATION",
        latitude:"12.93803129081362",
        longitude:"77.61088653615994",
        name:"Mobile Pvt Ltd",
        address:"30, Hosur Rd, 7th Block, Koramangala, Bengaluru, Karnataka 560095"
    });

console.log(response);
pip install direct7
1
2
3
4
5
from direct7 import Client

client = Client(api_token="Your API token")

client.whatsapp.send_whatsapp_freeform_message(originator="{registered_phonenumber}", recipient="{recipient}", message_type="LOCATION", longitude= "77.6109", latitude="12.9379", name="ABC PRIVATE LIMITED", address="Bengaluru, Karnataka")

composer require direct7/direct7-php
require_once 'vendor/autoload.php';
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(
  originator:"{registered_phonenumber}", 
  recipient:"{recipient}", 
  message_type:"LOCATION", 
  latitude: "12.93803129081362", 
  longitude: "77.61088653615994", 
  name: "Pvt Ltd", 
  address: "Bengaluru, Karnataka"
);

var_dump($response);
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7.NewClient(apiToken)
whatsapp := direct7.NewWhatsApp(client)
originator := "{registered_phonenumber}"
recipient := "{recipient}"
messageType := "LOCATION"
optParams := &OptionalParams{
  longitude: "77.1249",
  latitude: "12.8779",
  name: "NameOfLocation",
  address: "AddressOfLocation",
}
response, err := whatsapp.SendWhatsAppFreeformMessage(originator, recipient, messageType, optParams)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"LOCATION\",\n                \"location\": {\n                    \"longitude\": 77.6109,\n                    \"latitude\": 12.9379,\n                    \"name\": \"KARIxx PRIVATE LIMITED\",\n                    \"address\": \" 30, Hosur Main Road\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7\"\n        }\n    ]\n}");
Request request = new Request.Builder()
  .url("https://apialpha.d7networks.com/whatsapp/v2/send")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")
  .build();
Response response = client.newCall(request).execute();
var headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'
};
var request = http.Request('POST', Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));
request.body = json.encode({
  "messages": [
    {
      "originator": "{registered phone_number}",
      "content": {
        "message_type": "LOCATION",
        "location": {
          "longitude": 77.6109,
          "latitude": 12.9379,
          "name": "KARIxx PRIVATE LIMITED",
          "address": " 30, Hosur Main Road"
        }
      },
      "recipients": [
        {
          "recipient": "{recipient}",
          "recipient_type": "individual",
          "cust_ref": "[email protected]",
          "message_tag1": "chatbot1234",
          "conversation_id": "conv1234"
        }
      ],
      "report_url": "https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7"
    }
  ]
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
 $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
 $headers.Add("Content-Type", "application/json")
 $headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc")

 $body = @"
 {
 `"messages`": [
 {
 `"originator`": `"{registered phone_number}`",
 `"content`": {
 `"message_type`": `"LOCATION`",
 `"location`": {
 `"longitude`": 77.6109,
 `"latitude`": 12.9379,
 `"name`": `"KARIxx PRIVATE LIMITED`",
 `"address`": `" 30, Hosur Main Road`"
 }
 },
 `"recipients`": [
 {
 `"recipient`": `"{recipient}`",
 `"recipient_type`": `"individual`",
 `"cust_ref`": `"[email protected]`",
 `"message_tag1`": `"chatbot1234`",
 `"conversation_id`": `"conv1234`"
 }
 ],
 `"report_url`": `"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7`"
 }
 ]
 }
 "@

 $response = Invoke-RestMethod 'https://apialpha.d7networks.com/whatsapp/v2/send' -Method 'POST' -Headers $headers -Body $body
 $response | ConvertTo-Json
gem install direct7
require 'direct7'

client = Direct7::Client.new('Your API token')

client.whatsapp.send_whatsapp_freeform_message(
    originator='{originator}',
    recipient='{recipient}',
    message_type='LOCATION',
    body=nil, first_name=nil, last_name=nil, formatted_name=nil, middle_name=nil, suffix=nil, prefix=nil, birthday=nil, phones=nil, emails=nil, urls=nil, 
    latitude='12.93803129081362', 
    longitude='77.61088653615994', 
    name='Mobile Pvt Ltd', 
    address='Bengaluru, Karnataka 56009'
)
1
2
3
4
5
6
7
8
 var client = new HttpClient();
 var request = new HttpRequestMessage(HttpMethod.Post, "https://apialpha.d7networks.com/whatsapp/v2/send");
 request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc");
 var content = new StringContent("{\n    \"messages\": [\n        {\n            \"originator\": \"{registered phone_number}\",\n            \"content\": {\n                \"message_type\": \"LOCATION\",\n                \"location\": {\n                    \"longitude\": 77.6109,\n                    \"latitude\": 12.9379,\n                    \"name\": \"KARIxx PRIVATE LIMITED\",\n                    \"address\": \" 30, Hosur Main Road\"\n                }\n            },\n            \"recipients\": [\n                {\n                    \"recipient\": \"{recipient}\",\n                    \"recipient_type\": \"individual\",\n                    \"cust_ref\": \"[email protected]\",\n                    \"message_tag1\": \"chatbot1234\",\n                    \"conversation_id\": \"conv1234\"\n                }\n            ],\n            \"report_url\": \"https://webhook.site/e8839c21-2de3-499f-90a9-be31fd0cddb7\"\n        }\n    ]\n}", null, "application/json");
 request.Content = content;
 var response = await client.SendAsync(request);
 response.EnsureSuccessStatusCode();
 Console.WriteLine(await response.Content.ReadAsStringAsync());