Contacts and Location Messages

See how to use the message node to send contacts or location messages and how to report and block contacts.

You can only send a location message up until 24 hours after receiving a message from the user. If you have not received a message from the user within this time, you will need to start a new conversation by sending a Template message.

Sending Location Messages

To send location messages, make a POST call to the /messages endpoint and attach a message object with type=location. Then, add a location object.

Send Location Message

POST https://waba-v2.360dialog.io/messages

Request Body

NameTypeDescription

to*

string

Recipient wa_id

type*

string

Message type: location

messaging_product*

string

Required for Cloud API. Messaging service used for the request. Use "whatsapp".

location*

object

A successful response includes an object with an identifier prefixed with wamid. Use the ID listed after wamid to track your message status.

{
  "messaging_product": "whatsapp",
  "contacts": [{
      "input": "PHONE_NUMBER",
      "wa_id": "WHATSAPP_ID",
    }]
  "messages": [{
      "id": "wamid.ID",
    }]
}
POST https://waba-v2.360dialog.io/messages' \
 
 {
  "messaging_product": "whatsapp",
  "to": "PHONE_NUMBER",
  "type": "location",
  "location": {
    "longitude": LONG_NUMBER,
    "latitude": LAT_NUMBER,
    "name": LOCATION_NAME,
    "address": LOCATION_ADDRESS
  }
}'

Location Object

NameDescription

longitude

Required.

Longitude of the location.

latitude

Required.

Latitude of the location.

name

Required.

Name of the location.

address

Required.

Address of the location.

A successful response in the Cloud API includes an object with an identifier prefixed with wamid. Use the ID listed after wamid to track your message status.

{
  "messaging_product": "whatsapp",
  "contacts": [{
      "input": "PHONE_NUMBER",
      "wa_id": "WHATSAPP_ID",
    }]
  "messages": [{
      "id": "wamid.ID",
    }]
}

[will be deprecated] If the WABA is registered in On-premise API

As announced in November 2023, Meta is transitioning to a fully Cloud-hosted WhatsApp Business Platform and will stop supporting On-Premise API in October 2025.

Starting from On-Premise client v2.53, all new feature updates will be exclusively delivered to Cloud API. While the On-Premise API client will receive quarterly releases, they will focus solely on bug fixes and security patches. From May 15, 2024, 360dialog will not allow for new numbers to be onboarded with On-Premise API. We will continue supporting already registered On-Premise API throughout 2024, but we strongly recommend to start changing the hosting type of numbers to Cloud as soon as possible. Learn here how to integrate with Cloud API.

Send Template Message

POST https://waba.360dialog.io/v1/messages

Request Body

NameTypeDescription

type*

string

to*

string

location*

object

{
    "messages": [{
       "id": "message-id"
    }]
}
{
    "to": "recipient-wa-id",
    "type": "location",
    "location": {
        "longitude": -122.425332,
        "latitude": 37.758056,
        "name": "Facebook HQ",
        "address": "1 Hacker Way, Menlo Park, CA 94025"
    }
}

For On-premise API, a successful response looks like this:

{
    "messages": [{
       "id": "message-id"
    }]
}

How to block contacts

Currently, it is not possible to block or unblock contacts in the Cloud API. Please refer to Meta's Support regarding this limitation.

If you block a number in On-premise and then migrate to Cloud API, the number will remain blocked without the option to unblock it.

[will be deprecated] If the WABA is registered in On-premise API

If you are using On-Premise API, remember that it is being discontinued by Meta. No new signups will be allowed with this type of integration from May 15, 2024.

Numbers registered before this date will still be supported, but should start planning a change of hosting type as soon as possible.

To block a contact, you must have received a message from them within the last 24 hours.

Submit an API call to /v1/contacts/{phone_number}/block with a reason for blocking another business account.

POST / v1 / contacts /+ 16315551000 / block
 { "reason" : "Optional string(0;60). Freeform block reason. Will be used when another business account is being blocked" }

When successful, the response will have HTTP status 200and will come without the "errors" object. The failed response looks like this:

{ "errors" : [ { "code" : 2048 , "title" : "Not engaged contact" , "details" : "Invalid Request. This contact has not engaged with you in the last 24 hrs." } ] }   

blocking parameters

The following parameters are supported by POST calls to /v1/contacts/{phone_number}/block:

SettingsDescription

reason

Optional.

Blocking reason in free text format. It will be used during the process of blocking another business account. Must be less than 60 characters.

phone_number

Mandatory.

Numbers can be in any phone number format. The recommended format for contact phone numbers includes a plus sign (+) and country code.

How to unblock contacts

To unblock a contact, send an API call to/v1/contacts/{phone_number}/unblock

POST / v1 / contacts /+ 16315551000 / unblock

When successful, the response will have HTTP status 200and will come without the "errors" object.

The failed response looks like this:

{ "errors" : [ { "code" : 1009 , "title" : "Parameter value is not valid" , "details" : "Provided WhatsApp ID is not valid. Please provide a valid WhatsApp ID or a phone number with a country code" } ] }   
     

unblock parameters

The following parameters are supported by POST calls to /v1/contacts/{phone_number}/unblock:

SettingsDescription

phone_number

Mandatory.

Numbers can be in any phone number format. The recommended format for contact phone numbers includes a plus sign (+) and country code.

How to get a Block List

Here's how to get a list of your blocked contacts.

Send an API call to /v1/contacts/blocklist to receive a paginated list of your blocked contacts.

GET / v1 / contacts / blocklist ? limit = 10 & offset = 0

You will receive a response with a page from your block list and paging information.

{ "contacts" : [ { "wa_id" : "16315551000@s.whatsapp.net" } ], "pagination" : { "limit" : 10 , "offset" : 0 , "total" : 1 } }
    

block list parameters

The following parameters are supported for GET calls to /v1/contacts/blocklist:

SettingsDescription

limit

Optional.

Accepted range is (0;200]. Default: 100.

offset

Optional.

Default: 0.

How to Report a Contact

To report a contact, you must have received a message from them within the last 24 hours.

Send an API call to /v1/contacts/{phone_number}/report including a reason if you are blocking another business account.

POST / v1 / contacts /+ 16315551000 / block
 { "reason" : "Optional string(0;60). Freeform block reason. Will be used when another business account is being blocked" , "block" : "true | false optional boolean with default of false" , "message_id" : "message-id. Optional reported message id" }
 

When successful, the response will have HTTP status 200and will come without the "errors" object.

The failed response looks like this:

{ "errors" : [ { "code" : 2048 , "title" : "Not engaged contact" , "details" : "Invalid Request. This contact has not engaged with you in the last 24 hrs." } ] }  

reporting parameters

The following parameters are supported by POST calls to /v1/contacts/{phone_number}/report:

SettingsDescription

reason

Optional.

Blocking reason in free text format. It will be used during the process of blocking another business account. Must be less than 60 characters.

block

Optional.

The default is False.

If you just want to report or also block the contact.

message_id

Optional.

The ID of the message to be reported. If not specified, the last 5 messages will be sent to WhatsApp.

phone_number

Mandatory.

Numbers can be in any phone number format. The recommended format for contact phone numbers includes a plus sign (+) and country code.

Last updated