Unblock WhatsApp User Numbers
DELETE Method
The Unblock WhatsApp User Numbers API allows you to programmatically unblock one or more WhatsApp user mobile numbers, allowing them to send again incoming messages. Also, after you unblock the user numbers, you can send them again outgoing messages.
Note:
You can unblock the WhatsApp user numbers that were earlier blocked from your Kaleyra account. Any numbers blocked from different system cannot be unblocked from your kaleyra account.
Prerequisites
- Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID. A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on Kaleyra platform.
- To set up a WhatsApp account on Kaleyra platform, see Manual Signup and Embedded Signup.
- An active WhatsApp plan for Business API that includes:
- A WhatsApp business number.
- An associated profile with the business number.
- A WhatsApp verified and approved profile.
Note:
If you are using WhatsApp V1 version, use
https://<api_domain>/v1/<SID>endpoint.
API Domain and Value
| api_domain | Value |
|---|---|
| IN pod | api.in.kaleyra.io |
| SG Pod | api.ap.kaleyra.io |
| EU Pod | api.eu.kaleyra.io |
| NA pod | api.na.kaleyra.ai |
API request to Unblock WhatsApp User Numbers
To unblock WhatsApp user numbers, use https://<api_domain>/v2/<sid>/whatsapp/<phone_number>/block_users endpoint with the following request method.
The following is the request format to unblock WhatsApp user numbers:
curl --location --request DELETE 'https://<api-domain>/v2/<SID>/whatsapp/<phone_number>/block_users' \
-H 'api-key: <api-key>' \
-H 'Content-Type: <content-type>' \
-d '{
"messaging_product": "<messaging_product>",
"block_users": [
{
"user": "<phone_number>"
},
{
"user": "<phone_number1>"
},
{
"user": "<phone_number2>"
}
]
}'The following is the sample request format to unblock WhatsApp user numbers:
curl --location --request DELETE 'https://api.in.kaleyra.io/v2/HXAP16XXXXXX97IN/whatsapp/14094128XXXXXXXX/block_users' \
-H 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
-H 'Content-Type: application/json' \
-d '{
"messaging_product": "whatsapp",
"block_users": [
{
"user": "+9194070XXXXX"
},
{
"user": "+919863XXXXX"
},
{
"user": "+918074XXXXX"
}
]
}'URL Parameters and Headers
The following is the list of parameters and headers to unblock WhatsApp user numbers:
| Parameter / Headers | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXAP16XXXXXX97IN | Yes |
api-key | String | API key generated from Kaleyra account. | Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3 | Yes |
Content-Type | String | Indicates the format of the content the API will be processing. | The only allowed value is application/json. | Yes |
phone_number | String | Indicates the phone number for which you want to unblock user’s mobile numbers. | 14094128XXXXXXXX | Yes |
The following is the list of attributes to be used in the payload to unblock WhatsApp user numbers:
| Parameter / Headers | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
messaging_product | String | The platform being used for messaging. | The only allowed value is whatsapp. | Yes |
block_users | Array | An array of elements representing the WhatsApp user mobile numbers to be blocked. | See the specific table for details. | Yes |
The following table describes the attribute used for the block_users array:
| Parameter | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
user | String | The phone number in E.164 format of the WhatsApp user you want to unblock. | +919863XXXXX | Yes |
Sample Success Response
If all the passed user mobile numbers are removed from the block list, the following success message is returned with the status 200 Accepted:
{
"code": "WA200",
"message": "Request Processed Successfully",
"data": {
{
"block_users": {
"removed_users": [
{
"input": "+9194070XXXXX",
"wa_id": "9194070XXXXX"
},
{
"input": "+919863XXXXXX",
"wa_id": "919863XXXXXX"
},
{
"input": "+91807XXXXXXX",
"wa_id": "91807XXXXXXX"
}
]
},
"messaging_product": "whatsapp"
}
},
"error": {}
}Sample Failure Responses
The following are the failure responses:
WABA and WhatsApp Phone Number Check
401 Unauthorized WABA
{
"code": "WA401",
"message": "The phone number you're using not active",
"data": {},
"error": {
"phone_number": "The phone number you're using not active"
}
}401 Unauthorized Phone Number Status
{
"code": "WA401",
"message": "Phone number is not present or does not belong to the account.",
"data": {},
"error": {
"phone_number": "Phone number is not present or does not belong to the account."
}
}API Key and SID validations
401 Unauthorized
{
"code": "RBC001",
"message": "Incorrect SID or API key.",
"data": [],
"error": {
"error": "Incorrect SID or API key."
}
}Payload Validations
400 Incorrect payload
{
"code": "WA400",
"message": "Refer to correct payload format",
"data": {},
"error": {
"payload": "Incorrect payload format"
}
}Internal Server Errors
500 Internal Server Error
{
"code": "WA500",
"message": "Please try again later",
"data": {},
"error": {
"error": "Internal server error"
}
}Errors while removing user’s number from the blocklist on Meta side
200 OK Status
{
"code": "WA-200",
"message": "Request Processed Successfully",
"data": {
"block_users": {
"added_users": [],
"failed_users": [
{
"errors": [
{
"code": 131XXX,
"error_data": {
"details": "Failed to block due to re-engagement check failed"
},
"message": "Re-engagement check failed"
}
],
"input": "+919456XXXXXX"
}
]
},
"errors": {
"code": 139XXX,
"error_data": {
"details": "Failed to block some users, see the block_users response list for details"
},
"message": "(#139XXX) Failed to block/unblock users",
"type": "OAuthException"
},
"messaging_product": "whatsapp"
},
"error": {}
}Updated 1 day ago
