logo
enes

Block and unblock users

Last update: 6 hours ago by Irais Aguirre

Integration summary

  • Base URL: https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services
  • Token: admin token, in the Authorization: Bearer {{admin-token}} header (how to generate it)
  • Endpoints on this page:
    • POST /v1/block_users/{{waba_id}}/{{phone_number_id}}: Block users
    • PUT /v1/block_users/{{waba_id}}/{{phone_number_id}}: Unblock users

Block and unblock WhatsApp users for a phone number in your WABA. You can identify each user by their phone number or BSUID.

Block users

Request

Block users request:

URLhttps://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/block_users/{{waba_id}}/{{phone_number_id}}
MethodPOST
Typeapplication/json

Headers

Block users headers:

NameDescriptionTypeRequirements
Content-Typeapplication/jsonStringRequired
AuthorizationAdmin token. See Generate authentication token.StringRequired

Parameters

Block users parameters:

NameDescriptionTypeRequirements
waba_idWhatsApp Business Account ID.StringRequired
phone_number_idID of the phone number that blocks the users.StringRequired

Body

Block users body fields:

NameDescriptionTypeRequirements
block_usersList of users to block.List of user objectsRequired

User object

NameDescriptionTypeRequirements
userThe user's phone number or business-scoped user ID (BSUID).String
  • Required.
  • Can't be empty.

Example

Complete Block users example:

curl --location 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/block_users/{{waba_id}}/{{phone_number_id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{admin-token}}' \
--data '{
"block_users": [
{
"user": "521550123456"
},
{
"user": "US.13491208655302741918"
}
]
}'

Response

Block users response:

If the request succeeds, the service returns HTTP 201.

NameDescriptionType
messaging_productAlways "whatsapp". Included to match Meta Cloud API responses.String
block_usersObject with the users that were blocked and those that weren't.Object
errorsTop-level error returned by Meta when the request failed as a whole (as opposed to per-user failures, which appear under block_users.failed_users). Omitted on a fully successful response.Object

Block users object

NameDescriptionType
added_usersList of blocked users.List of added users objects
failed_usersList of users that couldn't be blocked.List of failed users objects

Added users object

NameDescriptionType
inputIdentifier sent in the request.String
wa_idWhatsApp ID resolved by Meta.String
{
"messaging_product": "whatsapp",
"block_users": {
"added_users": [
{
"input": "2721520198",
"wa_id": "5212721520198"
}
],
"failed_users": [
{
"input": "2721520160",
"errors": [
{
"code": 131047,
"message": "Re-engagement check failed",
"error_data": {
"details": "Failed to block due to re-engagement check failed"
}
}
]
}
]
}
}


Unblock users

Request

Unblock users request:

URLhttps://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/block_users/{{waba_id}}/{{phone_number_id}}
MethodPUT
Typeapplication/json

Headers

Unblock users headers:

NameDescriptionTypeRequirements
Content-Typeapplication/jsonStringRequired
AuthorizationAdmin token. See Generate authentication token.StringRequired

Parameters

Unblock users parameters:

NameDescriptionTypeRequirements
waba_idWhatsApp Business Account ID.StringRequired
phone_number_idID of the phone number that unblocks the users.StringRequired

Body

Unblock users body fields:

NameDescriptionTypeRequirements
block_usersList of users to unblock.List of user objectsRequired

Example

Complete Unblock users example:

curl --location --request PUT 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/block_users/{{waba_id}}/{{phone_number_id}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{admin-token}}' \
--data '{
"block_users": [
{
"user": "2721520198"
}
]
}'

Response

Unblock users response:

If the request succeeds, the service returns HTTP 200.

NameDescriptionType
block_usersObject with the users that were unblocked and those that weren't.Object

Block users unblock object

NameDescriptionType
removed_usersList of unblocked users.List of removed users objects
failed_usersList of users that couldn't be unblocked.List of failed users objects

Removed users object

NameDescriptionType
inputIdentifier sent in the request.String
wa_idWhatsApp ID resolved by Meta.String
{
"block_users": {
"removed_users": [
{
"input": "2721520198",
"wa_id": "5212721520198"
}
],
"failed_users": [
{
"input": "US.13491208655302741918",
"errors": [
{
"code": 131047,
"message": "Re-engagement check failed",
"error_data": {
"details": "Failed to block due to re-engagement check failed"
}
}
]
}
]
}
}

Failed users object

Used for both blocking and unblocking.

NameDescriptionType
inputIdentifier sent in the request.String
errorsList of errors that prevented the operation.List of errors objects

Errors object

NameDescriptionType
codeError code.Number
messageError message.String
error_dataError details.Object

Error data object

NameDescriptionType
detailsDetailed reason why the user couldn't be blocked or unblocked.String


WhatsApp — Previous
Block users
Next
List blocked users