Moderate Conversations API for Instagram |
We explain how to use the Moderate Conversations API to:
This guide assumes you have read the Messenger Platform Overview and implemented the needed components for sending and receiving messages and notifications.
You will need:
instagram_manage_messages, instagram_basic, and business_management permissions. Advanced Access is required to use this API for conversations involving your business and people who do not have a role on your messaging app, your Facebook page, or your business unblock_user cannot be included in the same request as block_user| Property | Description |
|---|---|
| Instagram-Scoped ID for the person the action should be applied |
| Action | Description |
|---|---|
| Blocks user and Instagram business interactions on Instagram. Prevents a user from messaging the Instagram business and prevents the business from messaging the user. The user will not be able to find the business’s profile, posts, or stories on Instagram. |
| Unblocks user and Instagram business interactions on Instagram. Allows the user and business to message each other again. The user will be able to view and interact with the business’s content on Instagram. |
| Marks the conversation as spam and moves the conversation to the spam folder in Meta Business Suite inbox. |
To block messaging with a user, send a POST request to the /PAGE-ID/moderate_conversations endpoint with the instagram-scoped id for the user and the block_user action.
curl -X POST -H "Content-Type: application/json" -d '{
"user_ids":[
{
"id": "{IGSID}"
}
],
"actions": [
"block_user"
]
}' "https://graph.facebook.com/v22.0/{PAGE-ID}/moderate_conversations?access_token={PAGE-ACCESS-TOKEN}"On success, your app will receive the following JSON response with the success field set to true. On failure, the success field will be set to false.
"success": "true"
To unblock a user, send a POST request to the /PAGE-ID/moderate_conversations endpoint with the Instagram-scoped id for the user and the unblock_user action.
curl -X POST -H "Content-Type: application/json" -d '{
"user_ids":[
{
"id":"{IGSID}"
}
],
"actions": [
"unblock_user"
]
}' "https://graph.facebook.com/v22.0/{PAGE-ID}/moderate_conversations?access_token={PAGE-ACCESS-TOKEN}"On success, your app will receive the following JSON response with the success field set to true. On failure, the success field will be set to false.
"success": "true"
To mark a conversation as spam and move it to the spam folder in the Meta Business Suite inbox, send a POST request to /PAGE-ID/moderate_conversations with the Instagram-scoped id for the user and the move_to_spam action.
curl -X POST -H "Content-Type: application/json" -d '{
"user_ids":[
{
"id":"{IGSID}"
}
],
"actions": [
"move_to_spam"
]
}' "https://graph.facebook.com/v22.0/{PAGE-ID}/moderate_conversations?access_token={PAGE-ACCESS-TOKEN}"On success, your app will receive the following JSON response with the success field set to true. On failure, the success field will be set to false.
"success": "true"
If you would like to perform multiple actions at once for a set of users, send a POST request to /PAGE-ID/moderate_conversations with the Instagram-scoped ids for the users and a list of the actions that should be applied to the users.
Block two users and move the conversations to spam.
curl -X POST -H "Content-Type: application/json" -d '{
"user_ids":[
{
"id":"{IGSID}"
},
{
"id":"{IGSID}"
}
],
"actions": [
"block_user",
"move_to_spam"
]
}' "https://graph.facebook.com/v22.0/{PAGE-ID}/moderate_conversations?access_token={PAGE-ACCESS-TOKEN}"On success, your app will receive the following JSON response with the success field set to true. On failure, the success field will be set to false.
"success": "true"
If you are facing any of the following errors while trying to complete the request for multiple users, you can retry the request with one user at a time.
| Error Code | Message |
|---|---|
| Invalid parameter The provided user ids or actions may be invalid The user ID is not a valid PSID or IGSID Invalid actions |
| Failed to block Instagram user Failed to unblock Instagram user Instagram Direct thread not found between business and consumer Unexpected error: Failed to move Instagram thread to spam folder |