in services/graph-api.js [180:206]
static async postPersonaAPI(name, profile_picture_url) {
let requestBody = {
name,
profile_picture_url
};
console.log(`Creating a Persona for app ${config.appId}`);
console.log({ requestBody });
let url = new URL(`${config.apiUrl}/me/personas`);
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.`);
let json = await response.json();
return json.id;
} else {
console.error(
`Unable to postPersonaAPI: ${response.statusText}`,
await response.json()
);
}
}