Home Facebook Messenger API - How to Unsubscribe a user from a Page?
Reply: 1

Facebook Messenger API - How to Unsubscribe a user from a Page?

user1076731
1#
user1076731 Published in 2018-01-13 09:25:05Z

Is there a way to programmatically unsubscribe a Facebook user so he doesn't receive any messages from the bot on my Facebook Page?

I can mark him in my database as unsubscribed so my program can check and not send him messages via Send APIs, but he will still receive broadcasts sent via Broadcasts API.

NatKSS
2#
NatKSS Reply to 2018-01-13 12:14:48Z

It looks like you're able to unsubscribe the user by using your database and SendAPI, but can't do the same for the Broadcast API. In order for the user to not receive specific broadcasts, you'll need to remove the broadcast label from the user's PSID by using FB's Targeted Broadcast API.

For example, if you have a broadcast that is associated by a label "MY_BROADCAST_LABEL_123", you'll need to:

  1. associate all of your subscribed users' PSIDs to this broadcast label
  2. remove that label associated to all of your unsubscribed users' PSIDs

Then, simply include the label "MYBROADCAST_LABEL_123" in the custom_label_id property of the request payload when you send the broadcast message, like this:

{    
    "message_creative_id": <YOUR_BROADCAST_MESSAGE_ID_HERE>,
    "custom_label_id": "MY_BROADCAST_LABEL_123"
}

To do all of the above, you should take a look at the FB documentation for Targeting Broadcast Messages for all the implementation details you need. Do make sure that you're at least on Graph API v2.11.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301585 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO