Posts tagged with facebook-graph-api

Since Meta has moved pages from in-stream ads to Content Monetization, the video_insights / total_video_ad_break_earnings has stopped showing up.

It gives this error:

{ "error": { "message": "(#200) Monetization metrics are only visible for Page admins with access to monetization insights.", "type": "OAuthException", "code": 200, "fbtrace_id": "Ap-R3KlquI-LCVIDcC9dXqD" } } 

We, and our clients, have the correct admin rights and were able to get earnings data before the update. The update is the only thing that has changed.

How do we update the code to make it work?

My app was already live in facebook. I had then changed it back to "In development" , to integrate instagram. Although i did spend some time, i did not request for any new permission. I reverted any changes i had done to my developer account. The only change which i cannot revert is to remove Instagram from "Products" in my app.

My privacy policy url was always : https://hype.workflowlabsfusion.com/privacypolicy/index.html

It is accessible. Now when i try to change it to In development mode, facebook keeps giving the error

You must provide a valid Privacy Policy URL in order take your app Live. Go to Basic Settings and make sure it is valid. 

But my url is very much accessible, there is no change in content of the privacy policy. What is possibly going wrong ? I have been trying to resolve this from the past 2 days. Any help would be appreciated. Thanks.

currently I have a node js server which Listens for incoming messages and sending a response to the client based on his msg content .

  • I have a Verified Business account, Whatsapp business account + phone number set and a webhook set for my node js server

I am now trying to expand it and to Listen for 2 whatsapp numbers . meta allows to set only one webhook per "app" which I think there is my problem . after creating a new app , and associated it to the same business account which has 2 whatsapp phone numbers , I still Can't listen to the 2nd number .

This is the current code which runs :

const RecievedMessage = (req,res)=> {     try {         var entry = (req.body["entry"])[0];         var changes = (entry["changes"])[0];         var value = changes["value"];         var messageObject = value["messages"];         if (typeof messageObject != "undefined"){             var messages = messageObject[0];             var number = messages["from"];             var msgid = messages["id"];             var text = getTextUser(messages); // getting the usr message             if(text != ""){               processMessage.Process(text,number,msgid);              }         }         myConsole.log(text);         res.send("EVENT_RECEIVED")     }catch(error) {         myConsole.log(error);         res.send("EVENT_RECEIVED")     } }     

for the webhooks I set 2 different endpoints one on each app: /whatsapp /whatsapp2

the verify function :

 const VerifyToken = (req,res) => {     try {         const keyValuePairs = req._parsedOriginalUrl.query.split('&');         const parsedValues = {};                  keyValuePairs.forEach(pair => {             const [key, value] = pair.split('=');             parsedValues[key] = value;         });                       var accessToken = 'token';              var token = parsedValues['hub.verify_token'];//req._parsedOriginalUrl.query["hub.verify_token"];              var challenge = parsedValues['hub.challenge'];//req._parsedOriginalUrl.query["hub.challenge"]                       if(challenge !=null && token != null && token == accessToken) {                 res.send(challenge);              } else {                  res.status(400).send();              }                     } catch(error) {             res.status(400).send();            } }    

express routes

app.get('/whatsapp',async(req,res)=> {    try { const keyValuePairs = req._parsedOriginalUrl.query.split('&'); const parsedValues = {}; keyValuePairs.forEach(pair => {     const [key, value] = pair.split('=');     parsedValues[key] = value; }); const hubMode = parsedValues['hub.mode']; const hubChallenge = parsedValues['hub.challenge']; const hubVerifyToken = parsedValues['hub.verify_token'];      var accessToken = 'token';      var token = parsedValues['hub.verify_token'];      var challenge = parsedValues['hub.challenge'];      if(challenge !=null && token != null && token == accessToken) {         res.send(challenge);      } else {          res.status(400).send();      }    } catch(error) {     res.status(400).send();    } })     
 app.get('/whatsapp2',async(req,res)=> {    try { const keyValuePairs = req._parsedOriginalUrl.query.split('&'); const parsedValues = {}; keyValuePairs.forEach(pair => {     const [key, value] = pair.split('=');     parsedValues[key] = value; }); const hubMode = parsedValues['hub.mode']; const hubChallenge = parsedValues['hub.challenge']; const hubVerifyToken = parsedValues['hub.verify_token'];      var accessToken = 'token';      var token = parsedValues['hub.verify_token'];      var challenge = parsedValues['hub.challenge'];//req._parsedOriginalUrl.query["hub.challenge"]      if(challenge !=null && token != null && token == accessToken) {         res.send(challenge);      } else {          res.status(400).send();      }    } catch(error) {     res.status(400).send();    } })   

I am sure I'm not the first one which need a multi-phone number setup for a Whatsapp chatbot Thanks everyone , cheers

I am currently developing a application that interacts with the Messenger API. Everything was working as expected until I submitted my app for a permissions review to Meta for the pages_messaging permission. After Meta’s review team tested the app by sending messages to the associated Facebook Page, the Messenger functionality for that Page stopped working entirely.

Here is what happens:

When I use the Access Token to make a request to me?, the response is successful, and I can retrieve basic Page information. However, when I try to query Messenger conversations using the /PAGE_ID/conversations endpoint, the following error is returned:

{   "error": {     "message": "An unexpected error has occurred. Please retry your request later.",     "type": "OAuthException",     "is_transient": true,     "code": 2,     "fbtrace_id": "AX_i_atlXLLuT2YAz5tkvl6"   } } 

Additional Observations: The issue occurs only for the Page tested by Meta's review team. Other Pages linked to the same application work without issues. The Access Token is valid and includes the necessary permissions (pages_messaging and pages_read_engagement). According to Meta Status, there are no ongoing disruptions for the Messenger API. The error is marked as is_transient: true, but retrying multiple times over hours/days still produces the same error. I have reviewed the Page's settings and permissions, and everything seems configured correctly.

Questions: What could cause the Messenger API to stop working specifically for a Page after Meta's review process? Is there any action I need to take to resolve this issue, such as resetting permissions, reassigning roles, or contacting Meta support? Could this issue be related to the permissions granted during the review process? If so, how can I verify this? How should I approach debugging this error further? For instance, is there a way to trace the problem using the provided fbtrace_id?

Any insights or guidance would be greatly appreciated!

I used the Access Token to call the Messenger API multiple times for the /PAGE_ID/conversations endpoint. I also verified that the Access Token has the required permissions (pages_messaging and pages_read_engagement) using the Graph API Explorer. I tested the /me endpoint with the same token, and it returned the expected Page data, confirming the token is valid.

I expected to receive a list of conversations for the Page, as it works correctly for other Pages linked to the same app. The Access Token should function properly because it is newly generated and has all the required permissions.

Instead of the expected response, the API returned the following error: json

{   "error": {     "message": "An unexpected error has occurred. Please retry your request later.",     "type": "OAuthException",     "is_transient": true,     "code": 2,     "fbtrace_id": "AX_i_atlXLLuT2YAz5tkvl6"   } } 

Additional Details:

This error happens only with the Page that was tested during the permissions review by Meta’s review team. Other Pages linked to the same application are working as expected and do not encounter this issue.

I'm trying to subscribe to a webhook for a Facebook Page using my Facebook App, but I'm encountering the following error:

{     "error": {         "message": "(#200) User does not have sufficient administrative permission for this action on this page. If the page business requires Two Factor Authentication, the user also needs to enable Two Factor Authentication.",         "type": "OAuthException",         "code": 200,         "fbtrace_id": "AL8xntMekDRZFSc5PBI8ct8"     } } 

Here’s what I’ve done so far:

  1. I added my Facebook account as a role (Admin) in the Facebook App through the developer dashboard.
  2. Logged into my Facebook account and successfully retrieved the Page Access Token.
  3. Verified that I have full admin access to the Facebook Page.
  4. However, when I try to subscribe to the webhook, I get the error above.

Other details:

  1. Two-Factor Authentication (2FA) enabled for the page or my account.
  2. My Facebook App is in development mode.

What could be causing this issue, and how can I resolve it?