Location Template API

1. Overview

The location header lets a WhatsApp template render a pinned map location above the message body, used for pickup points, delivery destinations, store locators, and rideshare pickups. Two APIs are involved: template creation (registers the template with Meta via RML's template management API) and message send (dispatches the template with runtime coordinates via the unified messaging API). This document covers both, plus validation rules and test coverage for each.

2. Template Creation API

Endpoint: POST https://apis.rmlconnect.net/wba/template/create

2.1 Payload — Happy Path (UTILITY)

POST https://apis.rmlconnect.net/wba/template/create

Authorization: Bearer <your_jwt_token>
Content-Type: application/json
{
  "template_name": "delivery_pickup_location1111",
  "language": ["en"],
  "template_category": "UTILITY",
  "components": {
    "header": {
      "type": "location"
    },
    "body": {
      "text": "Your order {{1}} is ready for pickup at the location shown above.",
      "example": ["ORD-12345"]
    }
  }
}

Note: The source material identifies this exact case as “Created But Rejected” against the expected 200 OK response. Template creation returned a success response, but the template was subsequently rejected, likely during Meta's review. Treat this as a known discrepancy pending clarification, rather than a confirmed pass.

2.2 Payload — Footer Variant

Location header supports an optional footer component alongside body:

{
  "template_name": "rideshare_pickup",
  "language": ["en"],
  "template_category": "UTILITY",
  "components": {
    "header": { "type": "location" },
    "body": {
      "text": "Your driver {{1}} is arriving at the pickup point shown above.",
      "example": ["Rahul"]
    },
    "footer": {
      "text": "Tap the pin for directions"
    }
  }
}

2.3 Field Reference

FieldTypeRequiredConstraints
template_namestringYesUnique template identifier
languagearrayYese.g. ["en"]
template_categorystringYesUTILITY or MARKETING supported for location header; AUTHENTICATION rejected (TC-4)
components.header.typestringYesMust be "location"; no text or example field permitted (TC-5, TC-6)
components.body.textstringConditionalRequired for UTILITY/MARKETING; template creation fails without it (TC-7)
components.body.examplearrayRecommendedSample values for {{n}} placeholders in body text
components.footer.textstringNoOptional static footer line
message_send_ttl_secondsintegerNoFor UTILITY: 30–43200 inclusive (TC-8)

2.4 Test Cases — Template Creation

IDScenarioExpected
TC-1Location header, UTILITY category, body + example200 OK (flagged: created but rejected downstream)
TC-2Location header, MARKETING category200 OK
TC-3Location header with footer, UTILITY category200 OK
TC-4Location header with AUTHENTICATION category422 — location header not supported for AUTHENTICATION category templates
TC-5Location header includes text field422 — text field is not supported for location header type
TC-6Location header includes example field422 — example field is not supported for location header type
TC-7Location header with no body component422 — please provide body element in components
TC-8message_send_ttl_seconds = 50000 (UTILITY)422 — message_send_ttl_seconds should have value in range from 30 to 43200 for utility templates

3. Message Send API

Endpoint: POST https://apis.rmlconnect.net/wba-testing/v1/messages

3.1 Payload — Full Location Params

POST https://apis.rmlconnect.net/wba-testing/v1/messages

Authorization: <YOUR_TOKEN>
Content-Type: application/json
{
  "phone": "<MOBILE NUMBER>",
  "media": {
    "type": "media_template",
    "template_name": "delivery_pickup_location1111",
    "lang_code": "en",
    "body": [{ "text": "ORD-12345" }],
    "header": [
      {
        "location": {
          "latitude": 19.0760,
          "longitude": 72.8777,
          "name": "RML Connect Office",
          "address": "123 Business Park, BKC, Mumbai"
        }
      }
    ]
  }
}

3.2 Field Reference

FieldTypeRequiredConstraints
phonestringYesRecipient mobile number
media.typestringYesMust be "media_template"
media.template_namestringYesMust match a previously created, approved location template
media.lang_codestringYese.g. "en"
media.bodyarrayYesRuntime values for body {{n}} placeholders
header[].location.latitudenumberYesNumeric only (TC-10); range ‒90 to 90 inclusive (TC-7, TC-12, TC-14)
header[].location.longitudenumberYesNumeric only (TC-11); range −180 to 180 inclusive (TC-8, TC-13, TC-14)
header[].location.namestringYesRequired (TC-4)
header[].location.addressstringYesRequired (TC-5)

3.3 Test Cases — Message Send

IDScenarioExpected
TC-1Full valid location payload (Mumbai)200 OK
TC-2Full valid location payload (Delhi)200 OK
TC-3Negative coordinates, valid range (Sydney)200 OK
TC-4Missing name400/422 — name is required in location header
TC-5Missing address400/422 — address is required in location header
TC-6Missing latitude and longitude400/422 — latitude and longitude are required in location header
TC-7Latitude > 90 (95.0)400/422 — latitude must be a number between -90 and 90
TC-8Longitude > 180 (200.0)400/422 — longitude must be a number between -180 and 180
TC-9Empty location object400/422 — location value cannot be empty object
TC-10Latitude as string ("nineteen")400/422 — expected numeric type (result not documented in source — see note below)
TC-11Longitude as string ("seventy")422 — longitude must be a number between -180 and 180
TC-12Latitude < -90 (-95.0)422 — latitude must be a number between -90 and 90
TC-13Longitude < -180 (-200.0)422 — longitude must be a number between -180 and 180
TC-14Boundary values: lat 90.0, long 180.0200 OK — boundary values accepted, inclusive

Note on TC-10: The source material identifies this as a NOT WORKING / should-fail case but does not specify the expected error message, unlike TC-11, which covers the equivalent longitude-as-string case. This is documented as an open gap rather than assuming that the error message matches the wording used in TC-11.


Did this page help you?