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 contact or 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.
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
200
and 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." } ] }
The following parameters are supported by POST calls to
/v1/contacts/{phone_number}/block
:Settings | Description |
---|---|
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. |
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
200
and 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" } ] }
The following parameters are supported by POST calls to
/v1/contacts/{phone_number}/unblock
:Settings | Description |
---|---|
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. |
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" : "[email protected]" } ], "pagination" : { "limit" : 10 , "offset" : 0 , "total" : 1 } }
The following parameters are supported for GET calls to
/v1/contacts/blocklist
:Settings | Description |
---|---|
limit | Optional. Accepted range is (0;200]. Default: 100. |
offset | Optional. Default: 0. |
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
200
and 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." } ] }
The following parameters are supported by POST calls to
/v1/contacts/{phone_number}/report
:Settings | Description |
---|---|
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. |
Currently, it is not possible to block or unblock contacts in the Cloud API. Please refer to Meta's Support regarding this limitation.
Last modified 24d ago