I am trying to implement whatsapp embedded signup flow for integrating whatsapp . Followed the documentation : https://developers.facebook.com/docs/whatsapp/embedded-signup/embed-the-flow/
embedded a simple button as login in to facebook

and the javascript for that is as follows
window.fbAsyncInit = function () {
// JavaScript SDK configuration and setup
console.log(facebookMetaData.metaAPPID)
FB.init({
appId: facebookMetaData.metaAPPID, // Meta App ID
cookie: true, // enable cookies
xfbml: true, // parse social plugins on this page
version: 'v19.0' //Graph API version
});
};

// Load the JavaScript SDK asynchronously
(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'));

// Facebook Login with JavaScript SDK
function launchWhatsAppSignup() {
// Conversion tracking code
fbq && fbq('trackCustom', 'WhatsAppOnboardingStart', {appId: facebookMetaData.metaAPPID, feature: 'whatsapp_embedded_signup'});

// Launch Facebook login
FB.login(function (response) {
if (response.authResponse) {
const code = response.authResponse.code;
// The returned code must be transmitted to your backend,
// which will perform a server-to-server call from there to our servers for an access token
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {
config_id: facebookMetaData.configurationID, // configuration ID goes here
response_type: 'code', // must be set to 'code' for System User access token
override_default_response_type: true, // when true, any response types passed in the "response_type" will take precedence over the default types
// extras: {
// setup: {
// ... // Prefilled data can go here
// }
// }
});
}
}
For the above javascript variable like facebookMetaData.metaAPPID are replaced properly.
when clicking the button i am getting the error in console as
Uncaught ReferenceError: fbq is not defined
launchWhatsAppSignup
How to resolve the issue so that whatsapp embedded signup can be implemented?

Tag:-

2 comments.

  1. Weichen Gao

    I also have this question, may I ask if it has been solved? How to deal with it?

    1. Weichen Gao

      I also have this question, may I ask if it has been solved? How to deal with it?

Add a new comment.