Is there any way to change the user\'s profile picture using the graph api?
I know you can\'t with the rest api (reference), but I could not find anything in the new
I had this problem too. I've managed to upload a profile picture using this endpoint.
This link provides information about how to upload a profile picture
private async uploadProfilePhoto(pageId:string, accessToken: string, photoUrl: string){
let url = FACEBOOK_API_URL + `${pageId}/picture`+
`?access_token=${accessToken}`+
`&picture=${photoUrl}`;
let response = null;
try {
response = await axios({
method: 'post',
url: url,
});
} catch (err) {
/** Here this error occures but the profile image is still uploaded.
* {message: 'Unsupported post request.', type: 'GraphMethodException', code: 100, fbtrace_id: 'AGhsadasdaiqyf_YHJaztdasdadG7'
*/
}
return response;
}
Then to get the id of the profile picture in case you need it you can perform a get request on this endpoint.
const FACEBOOK_API_URL ='https://graph.facebook.com/v7.0/'
let url = FACEBOOK_API_URL + `${pageId}/photos`+
`?access_token=${accessToken}` +
`&fields=picture`;