Posts tagged with facebook-webhooks

While Integrating the Facebook login for business I am facing "It looks like this app isen't available". I have followed all the steps mention in the META documentation. please click here to refer the images which I have followed.

<!DOCTYPE html> <html> <head>     <title>Facebook Login JavaScript Example</title>     <meta charset="UTF-8">     <script type="text/javascript" src="<c:url value='/facebooksdk/js/fbsdk.js'/>"></script>     <script>         window.fbAsyncInit = function() {           FB.init({             appId      : APPID,             cookie     : true,             xfbml      : true,             version    : APIVERSION,             response_type: "code"           });           checkLoginState();         };         (function(d, s, id){            var js, fjs = d.getElementsByTagName(s)[0];            if (d.getElementById(id)) {return;}            js = d.createElement(s); js.id = id;            js.src = "https://connect.facebook.net/en_US/sdk.js";            fjs.parentNode.insertBefore(js, fjs);          }(document, 'script', 'facebook-jssdk'));       </script> </head> <body>       <fb:login-button onlogin="checkLoginState();"> </fb:login-button>     <div id="status">     </div> </body> </html> const APPID = "1450727115804587"; const APIVERSION = "v19.0"; const CONFIGID = "422168783777066"; function statusChangeCallback(response) { // Called with the results from FB.getLoginStatus().     console.log('statusChangeCallback');     console.log(response); // The current login status of the person.     if (response.status === 'connected') { // Logged into your webpage and Facebook.         testAPI();     } else { // Not logged into your webpage or we are unable to tell.         document.getElementById('status').innerHTML = 'Please log '             + 'into this webpage.';     } } function checkLoginState() { // Called when a person is finished with the Login Button.     FB.getLoginStatus(function (response) { // See the onlogin handler         statusChangeCallback(response);     }); } function testAPI() {     console.log('Welcome!  Fetching your information.... ');     FB.api('/me', function (response) {         console.log('Successful login for: ' + response.name);         document.getElementById('status').innerHTML = 'Thanks for logging in, '             + response.name + '!';     }); } 

Step 1 : Create a new app Note : I have selected Other option

Select an App Type -> I have selected an second option Business App Type

Provide App Name & Business Profile and click on Create App

(3.1) Business App details - Business app is verified

App Details : - Display Name - EduCRM - App Domain : educloud.app - Privacy policy & Terms of service Url : https://zdp2.educloud.app/lms/tandc - Category : Education - Image Update : Yes

Add Product “facebook login for business”

Click Setup button of Facebook Login for Business

Facebook Login for business get Advance permission Permission requested pages_show_list ads_management
leads_retrieval pages_read_engagement
pages_manage_metadata
pages_read_user_content pages_manage_ads
pages_manage_engagement public_profile

Configuration Quick Start steps: Select Web option : to get SDK code Make the App live :

I am stuck with the Webhook endpoint where I receive the Facebook feeds.

I need to create an API to get the Facebook feeds (comments, like, etc) which are made on my Facebook page.

By following the steps, I have created a facebook app with the developer account. With webhook added

Webhook Added

After that I went to the settings page.

Since I want the feeds, I have select the Page from the dropdown and clicked subscribe. The I need to enter the callback URL.

From my API side, I have created a .NET Core 5 application. Then create a Get and Post method called Webhook. Since I need an https:// connection, I have installed ngRok and setup the test API. And the GET method will return the challenge:

[HttpGet("webhook")] public async Task<IActionResult> Receive([FromQuery(Name = "hub.mode")] string hubMode,                                    [FromQuery(Name = "hub.challenge")] int hubChallenge,                                    [FromQuery(Name = "hub.verify_token")] string hubVerifyToken) {     return Ok(hubChallenge); // this is working... no issue here } 

Back to the Facebook side.

I have added the callback URL after clicking subscribe and got Challenge key in my API Get method. Once its done I need to select the fields i need to subscribe i.e.; feed in order to get the Facebook page response.

Feeds

Then i need to setup permission so, i have subscribed to permission dropdown. Added the callback URL, get the Challenge key and subscription is complete. After that subscribed to pages_manage_metadata , pages_show_list and pages_manage_engagement(although document didn't mention pages_manage_engagement).

After that Went to facebook graph explorer and done the subscription to feed using the page access token https://graph.facebook.com/{page-id}/subscribed_apps?subscribed_fields=feed&access_token={page-access-token}

subscribe to page

This is also done and its says true

I check with the GET method to see whether it is complete and its says feed is in subscribed list Subscribed fields

But after this everything stops :(

When i click the test button its not sending any feed to my Post method in my API.

So i used the graph explore API to comment the Post and post is done , but no webhook response tried comment manually but no response.

So i thought maybe some issue with my API Post endpoint i have created. So i tested with Postman and the request is going through.

I changed by computer to my laptop with different network(you need to try everything possible), still no response.

So Just for the testing i subscribed to the Messaging option in facebook, just to check whether its an issue with the Page. The thing is i got a response to my Post method, so the messaging webhook is sending to the POST method. That means my API end point is correct.

So i thought something to do with by permission, so i enabled all permissions related to the page and tried, but no response.

I changes my facebook account to some other account, not working.

Then i tried with an account with facebook business enabled, no luck

I have tried changing the Permissions in the page, still no luck.

I tryed the gemini,chatgpt 3.5 and 4 ... no luck. asked in the facebook community...that place is kinda dead.

The main issue is i am not even getting any response when i click the Test button. Most of the online issues, they atleast get a hit from test.

So next thing to do is review the app and then test. but when i am in the review page , they are saying we need to test the app well before we go to review. So i an not sure what to do now.

Am i missing something? Any help would be valuable.

I dont know whether its a facebook bug or not. Because some document say

you need if the Page has not disabled the App platform in its App Settings. But in that page there is a turn on button, but it will change its status once we click it, but it will go back to the original state when we refresh the page. App Settings page

If anyone faced this issue and manage to solve this please help. i have been on this for quiet a while and i don't know what to do next.

Thankyou

I´m testing the official WhatsApp Business API by Meta, and want to receive the messages that i send to the users through the webhook, because the logic on my program manage the messages that way (I´ve been using Ultramsg and they send a webhook event whenever i send a message to a user).

Could be because i´m using the test phone number provided by meta, or is it always like that?

I tried subscribing to every webhook event available but none of those seem to send the object that i need.

I'm trying to set up a webhook in my Google Cloud Function that can receive incoming messages from the WhatsApp Business API and forward them to platform called Front. However, when configuring the webhook on Meta for Whatsapp, I get the error The callback URL or verify token couldn't be validated. Please verify the provided information or try again later.

Here's the relevant code from my index.js file:

const axios = require('axios'); const FRONT_API_TOKEN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZXMiOlsicHJvdmlzaW9uaW5nIiwicHJpdmF0ZToqIiwic2hhcmVkOioiXSwiaWF0IjoxNjc5NTE0MDU1LCJpc3MiOiJmcm9udCIsInN1YiI6ImI4MGUzZDExODQyMDUzZTk5OGE0IiwianRpIjoiYmM5NzNlNGQyZTA3YTAzMiJ9.7LBqJ5Kw3O65c4GttZuh4K2Zt7fkGIIq9yI96l06TJ8'; const FRONT_CUSTOM_CHANNEL_WEBHOOK_URL = 'https://api2.frontapp.com/channels/cha_ak6s0/incoming_messages'; const VERIFY_TOKEN = 'whatsappfronttoken'; const handleVerification = (req, res) => {   const queryToken = req.query.verify_token;   console.log('Verification request received:', req.query);   if (queryToken === VERIFY_TOKEN) {     res.send(req.query.challenge);   } else {     console.error('Invalid verify token:', queryToken);     res.sendStatus(403);   } }; exports.whatsappHandler = async (req, res) => {   if (req.query.verify_token) {     handleVerification(req, res);   } else {     const message = req.body;     if (!message.contacts || !message.messages) {       console.warn('Received message with missing contacts or messages property. Skipping message processing.');       res.sendStatus(200);       return;     }     // Extract relevant information from the WhatsApp message     const sender = message.contacts[0].profile.name || message.contacts[0].wa_id;     const text = message.messages[0].text.body;     // Format the message for Front's custom channel webhook URL     const formattedMessage = {       sender: {         name: sender,         handle: sender,       },       subject: 'WhatsApp Message',       body: text,       body_format: 'markdown',     };     // Forward the message to Front's custom channel webhook URL     try {       await axios.post(FRONT_CUSTOM_CHANNEL_WEBHOOK_URL, formattedMessage, {         headers: {           'Authorization': `Bearer ${FRONT_API_TOKEN}`,         },       });       res.sendStatus(200);     } catch (error) {       console.error(error);       res.sendStatus(500);     }   } }; 

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

Any assistance or guidance would be greatly appreciated. Thank you!

I've confirmed that my WhatsApp Business API credentials and webhook URL are set up correctly. I've also verified that my Google Cloud Function is deployed and accessible.

I've checked the logs for my Google Cloud Function and when trying to verify the webhook, I see an error Received message with missing contacts or messages property. Skipping message processing. To bypass this, I tried to return a 200 status as I thought this could be caused by the fact that I was just verifying the webhook and not actually receiving an actual message from Meta.

I am trying to create a connection between our WhatsApp Business account and our website where we gather all messages sent to our business on different channels (through our own app, text, WhatsApp, ...).

I've followed this tutorial (https://developers.facebook.com/docs/whatsapp/cloud-api/get-started) and have everything set up: our WhatsApp Business is working correctly, I've added a Meta App and I've set up the webhooks with a connection to my node.js backend. When I click Test next to the "Messaging" webhook, I receive the message on my node.js backend and website. So I know this side is working as it should.

I've then used the Graph API to subscribe my Meta app to the messages with the business id of the WhatsApp with the correct permissions. When checking the subscribed apps with the {business_id}/subscribed_apps endpoint, I can see my Meta app. So I believe everything is set up correctly. My Meta app is also set to "production".

However, when I try to send a message with my personal WhatsApp to my business WhatsApp, I receive nothing on the webhook. I checked the logs on my server and nothing is being received, so I know it's not an issue in my node.js backend.

Is there something else I need to do to make this work? Does the Meta app need to be verified to use the webhook in production? If so, how can I do this? The guide for verification says I need a platform and login insctructions, but the Meta app is really only a webhook without an interface.

Thanks in advance.