Use this API to Block one or more users for the specified app
Request Parameters
Key | Description | Value | Data type | Required/Optional | Constraints |
---|---|---|---|---|---|
Authorization | Access Token for the application |
| String | Required | Should be a valid Partner App Access Token |
appId | App ID to fetch the access token |
| String | Required |
|
messaging_product | String | Required | Messaging service used for the request. Must be "whatsapp". Cloud API only. | ||
block_users | Object | Required | List of user(s) to block. | ||
user | String | Required | The phone number or WhatsApp ID to be blocked. |
Sample Request
curl --location 'https://partner.gupshup.io/partner/app/{{APP_ID}}/user/block' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/json' \
--data '{
"messaging_product": "whatsapp",
"block_users": [
{
"user": "<PHONE_NUMBER>"
}
]
}'
Sample Response
{
"block_users":
{
"added_users":
[
{
"input": "919163805873",
"wa_id": "919163805873"
}
]
},
"messaging_product": "whatsapp",
"status": "success"
}
Status Codes
Status Code | Response | Comments |
---|---|---|
Success | ||
200 | { "block_users": {"added_users":[{"input": "919163805873", "wa_id": "919163805873" } ] }, "messaging_product": "whatsapp", "status": "success" } } | |
Error | ||
400 | { "messaging_product": "whatsapp", "block_users": {"added_users": [{"input": "<PHONE_NUMBER> or <WA_ID>","wa_id": "<WA_ID>" }, { "input": "<PHONE_NUMBER> or <WA_ID>", "wa_id": "<WA_ID>" }, ... ], "failed_users": [ { "input": "<PHONE_NUMBER> or <WA_ID>", "wa_id": "<WA_ID>" }, { "input": "<PHONE_NUMBER> or <WA_ID>", "wa_id": "<WA_ID>" }, ... "errors": [{ "message": "<MESSAGE>", "code": "<CODE>", "error_data": { "details": "<DETAILS>"" }] } } ] }, "error": { "message": "(#139100) Failed to block/unblock users", "type": "OAuthException", "code": 139100, "error_data": { "details": "Failed to block some users, see the block_users response list for details" }, "fbtrace_id": "<FBTRACE_ID>" } } } |