Contacts & Location Messages

Sending and receiving contact cards and location messages via Cloud API.

Overview

Contacts and location are standard Cloud API message types sent through the same messaging endpoint. Both are free-form message types and must follow the standard customer service window policy.

Send Location Messages

Set type to location and provide latitude and longitude in decimal degrees (required), plus an optional name and address:

{
  "messaging_product": "whatsapp",
  "to": "<RECIPIENT_PHONE_NUMBER>",
  "type": "location",
  "location": {
    "latitude": 37.7790262,
    "longitude": -122.4199061,
    "name": "<LOCATION_NAME>",
    "address": "<LOCATION_ADDRESS>"
  }
}

Send Contacts Messages

Set type to contacts and provide one or more contacts (up to 257 per message, though Meta recommends fewer). Only name.formatted_name is required; every other field is optional.

{
  "messaging_product": "whatsapp",
  "to": "<RECIPIENT_PHONE_NUMBER>",
  "type": "contacts",
  "contacts": [
    {
      "name": {
        "formatted_name": "<CONTACT_DISPLAY_NAME>",
        "first_name": "<CONTACT_FIRST_NAME>",
        "last_name": "<CONTACT_LAST_NAME>"
      },
      "phones": [
        { "phone": "<CONTACT_PHONE_E164>", "type": "WORK", "wa_id": "<CONTACT_WA_ID>" }
      ],
      "emails": [
        { "email": "<CONTACT_EMAIL>", "type": "WORK" }
      ],
      "org": {
        "company": "<COMPANY_NAME>",
        "title": "<JOB_TITLE>"
      }
    }
  ]
}

Include phones[].wa_id to show Message and Save contact buttons on the card. Without it, both are replaced by an Invite to WhatsApp button. Meta also accepts addresses, birthday (YYYY-MM-DD), urls, and org.department. The recipient's device may not show every field, especially on their primary device.

Inbound Location Webhook

When a user shares a location, it arrives as a messages webhook with type="location":

{
  "messages": [
    {
      "from": "<WHATSAPP_USER_PHONE_NUMBER>",
      "id": "<WHATSAPP_MESSAGE_ID>",
      "timestamp": "<TIMESTAMP>",
      "type": "location",
      "location": {
        "latitude": 37.7790262,
        "longitude": -122.4199061,
        "name": "<OPTIONAL_LOCATION_NAME>",
        "address": "<OPTIONAL_LOCATION_ADDRESS>",
        "url": "<OPTIONAL_LOCATION_URL>"
      }
    }
  ]
}

url is usually only included for business locations.

Inbound Contact Card Webhook

When a user sends a contact card, it arrives with type="contacts":

{
  "messages": [
    {
      "from": "<WHATSAPP_USER_PHONE_NUMBER>",
      "id": "<WHATSAPP_MESSAGE_ID>",
      "timestamp": "<TIMESTAMP>",
      "type": "contacts",
      "contacts": [
        {
          "name": {
            "formatted_name": "<CONTACT_DISPLAY_NAME>",
            "first_name": "<CONTACT_FIRST_NAME>"
          },
          "phones": [
            { "phone": "<CONTACT_PHONE_E164>", "wa_id": "<CONTACT_WA_ID>", "type": "CELL" }
          ]
        }
      ]
    }
  ]
}

Blocking and Unblocking Contacts

Blocking is separate from contact cards: a blocked user cannot message that business number, and the business number cannot send messages to them. The Dualhook Runtime API relays Meta's Block Users API (POST, DELETE, and GET /<PHONE_NUMBER_ID>/block_users) with the connection's dh_live_... key. See Block Users for the 24-hour rule, per-user results, and error codes.

Dualhook Boundary

Dualhook sends location and contacts messages through the Runtime API /messages route and passes the payload to Meta unchanged. Inbound location and contact-card webhooks go from Meta straight to your endpoint through Webhook Override; Dualhook does not store them. Block Users calls go through the Runtime API without Dualhook storing or logging who was blocked.

Related

  • Messaging OverviewCore messaging endpoint, text messages, formatting, delivery statuses, and common errors.
  • Meta BSUID, Usernames & Contact Book Transition GuideOverview of Meta's WhatsApp BSUID rollout: usernames, contact book behavior, parent BSUIDs, API recipient support, webhook changes, and migration timeline.
  • Block UsersBlock, unblock, and list WhatsApp users on a business number with Meta's Block Users API through the Dualhook Runtime API: the 24-hour rule, per-user results, error codes, and Coexistence notes.
Browse more docsStart Free Trial