My application is using Facebook Instagram Graph API and particularly loading its Javascript SDK to load the API. Facebook recently launched its v18.0 and v19.0 and some fields in the API Path is depreciated.
I am wanting to use v17.0 or v16.0. The FB.init will be launched at this version particulary but when calling any API then it will jump back to v19.0 which is very strange.
API I am trying to use: https://developers.facebook.com/docs/instagram-api/reference/ig-user/insights
Javascript SDK: https://developers.facebook.com/docs/javascript/advanced-setup
This is how I am initialising my Javascript SDK:
const loadFbLoginAPI = (): void => {
window.fbAsyncInit = function () {
window.FB.init({
appId: process.env.REACT_APP_FACEBOOK_API_APP_ID,
cookie: true,
xfbml: true,
version: "v17.0",
})
}
console.log("Loading fb api")
// Load the SDK asynchronously
;(function (d, s, id) {
let js,
fjs = d.getElementsByTagName(s)[0]
if (d.getElementById(id)) return
js = d.createElement(s)
js.id = id
js.src = "//connect.facebook.net/en_US/sdk.js"
fjs.parentNode.insertBefore(js, fjs)
})(document, "script", "facebook-jssdk")
}
This works perfectly for the FB login dialog but when it comes to calling the API like this it jumps to the latest version:
window.FB.api(
"/" + fbPageID,
"GET",
I want this API to also be called at v17.0 instead of v19.0(Latest)
Can someone please help, thank you