إرسال إحداثيات الموقع الجغرافي

إرسال خطوط الطول والعرض وخريطة الموقع عبر الواتساب.

POST
https://api.wawp.net/v2/send/location?access_token=123456789&chatId=201234567890&instance_id=123456789&latitude=38.8937255&longitude=-77.0969763&message=123+Main+St%2C+New+York&reply_to=null&title=Our+office

تسجيل الدخول مطلوب

سجل الدخول لاستبدال المعرفات (Instance ID) ورمز الوصول (Access Token) بمعلومات حسابك الحقيقي لاختبار ال API مباشرة.

تسجيل الدخول
اختبار /v2/send/location
POSTGET

لا توجد معاملات استعلام مطلوبة

هذه النهاية الطرفية لا تتوقع بيانات في الرابط.

توصيات

  • Use "reply_to" to maintain conversation context.

  • Handle distinct message types (text, image, video) appropriately.

  • Implement a robust retry mechanism for failed sends.

Precision Positioning: Mastering the Geographic Location Engine

Location sharing is a powerful tool for bridging the gap between the digital conversation and the physical world. Whether you are helping a customer find a brick-and-mortar store, directing a delivery rider to a precise drop-off point, or organizing a physical meetup, the /v2/send/location endpoint provides a reliable way to send interactive map pins directly into a WhatsApp chat.


🏗️ The Geolocation Pipeline: From Data to Pin

When you call the /send/location endpoint, Wawp’s engine translates raw geographic data into a rich, interactive bubble on the recipient's phone:

  1. Coordinate Verification: The engine accepts latitude and longitude as decimal strings. It validates that these coordinates fall within the valid ranges (-90 to 90 for latitude, -180 to 180 for longitude).
  2. Metadata Injection: The title and message fields are injected into the message's metadata. These don't just appear on the bubble; they are often used as the "Label" when the user clicks the pin and opens it in external apps like Google Maps or Waze.
  3. Interactive Rendering: Wawp ensures the resulting message is rendered with a clickable map thumbnail. This thumbnail is generated by the WhatsApp network based on the coordinates provided, giving the user an instant visual "Context" of the surrounding area.

🛡️ Strategic Best Practices for Geographic Data

1. Decimal Precision (The Roof-Top Rule)

For location data, precision is everything.

  • Developer Action: Use at least 6 decimal places for your coordinates (e.g., 38.893725). This level of precision is accurate to approximately 0.1 meters—the difference between a pin landing on a building's roof and landing in the middle of a busy intersection.
  • Safety: Avoid rounding coordinates in your backend, as even slight changes in the 4th decimal place can shift a location by dozens of meters.

2. Crafting Meaningful Labels

The title and message fields are your chance to provide brand clarity.

  • Title (Place Name): Use the name of the destination (e.g., "Grand Plaza Hotel - Main Entrance").
  • Message (Context/Address): Use this for the specific address or helpful hints (e.g., "1st Floor, next to the fountain").
  • UX Impact: High-quality labels reduce user anxiety and make the automated message feel deliberate and professional.

3. Static vs. Dynamic Locations

  • Static Pins: This endpoint sends a Static Pin. It represents a specific "Snapshot" in space.
  • Live Location: Note that Wawp currently focuses on static pins for high-concurrency business flows. If your use case requires a real-time moving dot (Live Location), we recommend combining static pins with regular text updates or external tracking links via /v2/send/link-preview.

🧩 Advanced Use Cases

Last-Mile Delivery Support

In a delivery app, as soon as the rider clicks "Arrived," your system can automatically send the exact location pin to the customer. This enables the customer to open the pin in their preferred navigation app to cross-verify the rider's position, drastically reducing support calls.

Geo-Fenced Personalized Offers

If your system detects a user is near a specific retail branch, you can trigger an automated "Welcome" message that includes the location pin for that exact branch. Using the reply_to parameter, you can link this location to a specific discount coupon message, creating a highly relevant "Online-to-Offline" funnel.


🛠️ Common Pitfalls and Solutions

  • Swapped Coordinates: Mixing up latitude and longitude is a common developer error that results in pins landing in the middle of the ocean. Always double-check your coordinate pairs.
  • Blank Labels: Sending a location with an empty title often results in a generic "Location" bubble. To maintain brand authority, always provide a descriptive title.
  • Coordinate Strings: Ensure you send the coordinates as strings through the API to prevent floating-point precision loss that sometimes occurs with JSON number types at high decimal counts.

Summary of Capabilities:

  • Send interactive, clickable static map pins with custom titles and addresses.
  • High-precision support for decimal coordinates (latitude/longitude).
  • Seamless integration with Google Maps, Apple Maps, and Waze for the end-user.
  • Support for complex thread-nesting via the reply_to parameter.
  • Reliable success reporting with unique message_id generation for full delivery tracking.

البارامترات

قم بتهيئة المعاملات المطلوبة للتفاعل مع نقطة النهاية هذه. جميع وسائط الاستعلام والبيانات مدرجة أدناه مع تفاصيلها.

محتوى الطلب

يرسل كـ JSON
string

Unique ID of the WhatsApp session

مثال:
string

API access token

مثال:
string

Recipient's WhatsApp number

مثال:
string

Geographic latitude (e.g. 38.8937255)

مثال:
string

Geographic longitude (e.g. -77.0969763)

مثال:
string

Name of the place (e.g., 'Our Office')

مثال:
string

Address or additional description text

مثال:
string

Message ID to reply to

مثال:

برمج بالذكاء الاصطناعي باستخدام Wawp MCP

MCP READY

قم بربط الـ API مباشرة مع Cursor أو Windsurf أو Claude Desktop، ودع الذكاء الاصطناعي يكتب لك كود الربط وينفذه تلقائياً!

طريقة الربط والإعداد

أمثلة الكود

استخدم أمثلة الكود الجاهزة لدمج واجهة برمجة التطبيقات (API) في مشروعك بسرعة وكفاءة. اختر لغة البرمجة والمكتبة التي تفضلها.

1const baseUrl = "https://api.wawp.net";
2const endpoint = "/v2/send/location";
3const params = new URLSearchParams({
4 "instance_id": "123456789",
5 "access_token": "123456789"
6}).toString();
7const body = {
8 "chatId": "201234567890",
9 "latitude": "38.8937255",
10 "longitude": "-77.0969763",
11 "title": "Our office",
12 "message": "123 Main St, New York",
13 "reply_to": "null"
14};
15
16fetch(`${baseUrl}${endpoint}${params ? '?' + params : ''}`, {
17 method: "POST",
18 headers: { "Content-Type": "application/json" },
19 body: JSON.stringify(body)
20})
21 .then(async (response) => {
22 if (response.ok) {
23 const data = await response.json();
24 console.log("Success:", data);
25 return data;
26 }
27
28 // Error Handling
29 if (response.status === 400) {
30 console.error("Error 400: طلب غير صالح - معاملات مطلوبة مفقودة");
31 }
32 if (response.status === 400) {
33 console.error("Error 400: طلب غير صالح - الرقم المستهدف في قائمة الحظر الخاصة بك");
34 }
35 if (response.status === 400) {
36 console.error("Error 400: طلب غير صالح - المستلم قام بإلغاء الاشتراك تلقائياً");
37 }
38 if (response.status === 400) {
39 console.error("Error 400: Bad Request - Invalid Number (Egypt)");
40 }
41 if (response.status === 400) {
42 console.error("Error 400: Bad Request - Invalid Number (Saudi Arabia)");
43 }
44 if (response.status === 400) {
45 console.error("Error 400: Bad Request - Invalid Number (Unknown)");
46 }
47 if (response.status === 400) {
48 console.error("Error 400: طلب غير صالح (تنسيق XML)");
49 }
50 if (response.status === 400) {
51 console.error("Error 400: طلب غير صالح (نص عادي)");
52 }
53 if (response.status === 401) {
54 console.error("Error 401: غير مصرح - مفتاح الوصول غير صالح أو مفقود");
55 }
56 if (response.status === 401) {
57 console.error("Error 401: غير مصرح (تنسيق XML)");
58 }
59 if (response.status === 404) {
60 console.error("Error 404: غير موجود - الجلسة غير موجودة");
61 }
62 if (response.status === 404) {
63 console.error("Error 404: غير موجود (تنسيق XML)");
64 }
65 if (response.status === 429) {
66 console.error("Error 429: طلبات كثيرة جداً - تم تجاوز حد المعدل");
67 }
68 if (response.status === 500) {
69 console.error("Error 500: خطأ في الخادم الداخلي - فشل غير متوقع");
70 }
71 if (response.status === 500) {
72 console.error("Error 500: خطأ في الخادم الداخلي (HTML)");
73 }
74 if (response.status === 502) {
75 console.error("Error 502: بوابة غير صالحة - فشل الاتصال بالخادم الرئيسي");
76 }
77 if (response.status === 502) {
78 console.error("Error 502: بوابة غير صالحة (تنسيق XML)");
79 }
80
81 const errorText = await response.text();
82 console.error(`Error ${response.status}: ${errorText}`);
83 })
84 .catch((error) => console.error("Network Error:", error));
عينات تفاعلية
Ln 84, Col 1javascript

الردود المتوقعة

استكشف كافة الردود والنتائج المحتملة من الخادم. قمنا بتوثيق كل كود حالة (Status Code) مع أمثلة للبيانات لتسهيل معالجة الأخطاء والنجاح.

تم إرسال الرسالة بنجاح
النوع:
application/json
object *
string *
object *
number *
boolean *
string *
string *
number *
string *
string *
string *
boolean *
number *
boolean *
boolean *
boolean *
boolean *
boolean *
array *
array *
array *
boolean *
array *

Example

{
"_data": {
  "id": {
    "fromMe": true,
    "remote": "000000000000@c.us",
    "id": "MSG_ID_123456",
    "_serialized": "true_000000000000@c.us_MSG_ID_123456"
    },
  "viewed": false,
  "body": "BASE64_IMAGE_DATA",
  "type": "image",
  "t": 1759108866,
  "from": {
    "server": "c.us",
    "user": "111111111111",
    "_serialized": "111111111111@c.us"
    },
  "to": {
    "server": "c.us",
    "user": "000000000000",
    "_serialized": "000000000000@c.us"
    },
  "ack": 0,
  "isNewMsg": true,
  "star": false,
  "kicNotified": false,
  "caption": "Here's your requested image.",
  "deprecatedMms3Url": "https://example.com/media-url",
  "directPath": "/media/direct/path/example",
  "mimetype": "image/jpeg",
  "filehash": "FILE_HASH_PLACEHOLDER",
  "encFilehash": "ENC_FILE_HASH_PLACEHOLDER",
  "size": 192487,
  "mediaKey": "MEDIA_KEY_PLACEHOLDER",
  "mediaKeyTimestamp": 1759108865,
  "streamable": false,
  "mediaHandle": null,
  "isFromTemplate": false,
  "pollInvalidated": false,
  "isSentCagPollCreation": false,
  "latestEditMsgKey": null,
  "latestEditSenderTimestampMs": null,
  "mentionedJidList": {
    },
  "groupMentions": {
    },
  "isEventCanceled": false,
  "eventInvalidated": false,
  "isVcardOverMmsDocument": false,
  "isForwarded": false,
  "isQuestion": false,
  "questionReplyQuotedMessage": null,
  "questionResponsesCount": 0,
  "readQuestionResponsesCount": 0,
  "labels": {
    },
  "hasReaction": false,
  "disappearingModeInitiator": "chat",
  "disappearingModeTrigger": "chat_settings",
  "productHeaderImageRejected": false,
  "lastPlaybackProgress": 0,
  "isDynamicReplyButtonsMsg": false,
  "isCarouselCard": false,
  "parentMsgId": null,
  "callSilenceReason": null,
  "isVideoCall": false,
  "callDuration": null,
  "callCreator": null,
  "callParticipants": null,
  "isCallLink": null,
  "callLinkToken": null,
  "isMdHistoryMsg": false,
  "stickerSentTs": 0,
  "lastUpdateFromServerTs": 0,
  "invokedBotWid": null,
  "bizBotType": null,
  "botResponseTargetId": null,
  "botPluginType": null,
  "botPluginReferenceIndex": null,
  "botPluginSearchProvider": null,
  "botPluginSearchUrl": null,
  "botPluginSearchQuery": null,
  "botPluginMaybeParent": false,
  "botReelPluginThumbnailCdnUrl": null,
  "botMessageDisclaimerText": null,
  "botMsgBodyType": null,
  "requiresDirectConnection": false,
  "bizContentPlaceholderType": null,
  "hostedBizEncStateMismatch": false,
  "senderOrRecipientAccountTypeHosted": false,
  "placeholderCreatedWhenAccountIsHosted": false,
  "galaxyFlowDisabled": false,
  "links": {
    }
  },
"mediaKey": "MEDIA_KEY_PLACEHOLDER",
"id": {
  "fromMe": true,
  "remote": "000000000000@c.us",
  "id": "MSG_ID_123456",
  "_serialized": "true_000000000000@c.us_MSG_ID_123456"
  },
"ack": 0,
"hasMedia": true,
"body": "Here's your requested image.",
"type": "image",
"timestamp": 1759108866,
"from": "111111111111@c.us",
"to": "000000000000@c.us",
"deviceType": "android",
"isForwarded": false,
"forwardingScore": 0,
"isStatus": false,
"isStarred": false,
"fromMe": true,
"hasQuotedMsg": false,
"hasReaction": false,
"vCards": {
  },
"mentionedIds": {
  },
"groupMentions": {
  },
"isGif": false,
"links": {
  }
}
طلب غير صالح - معاملات مطلوبة مفقودة
غير مصرح - مفتاح الوصول غير صالح أو مفقود
غير موجود - الجلسة غير موجودة
طلبات كثيرة جداً - تم تجاوز حد المعدل
خطأ في الخادم الداخلي - فشل غير متوقع
بوابة غير صالحة - فشل الاتصال بالخادم الرئيسي
الموضوع السابقإرسال رابط معاينة (Link Preview)
الموضوع التاليإرسال استطلاع رأي (Poll)

Command Palette

Search for a command to run...