in services/graph-api.js [34:55]
static async callMessengerProfileAPI(requestBody) {
// Send the HTTP request to the Messenger Profile API
console.log(`Setting Messenger Profile for app ${config.appId}`);
let url = new URL(`${config.apiUrl}/me/messenger_profile`);
url.search = new URLSearchParams({
access_token: config.pageAccesToken
});
let response = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(requestBody)
});
if (response.ok) {
console.log(`Request sent.`);
} else {
console.warn(
`Unable to callMessengerProfileAPI: ${response.statusText}`,
await response.json()
);
}
}