Facebook workplace page access token api doesn't work

801 views Asked by At

I'm making an application in angular 4. I get posts from a group in my app and I want people to comment on those posts. Problem is, you need a page access token but the api return an empty array!

https://graph.facebook.com/me/accounts?access_token={user_access_token}

I searched for days and looked through all the questions on stack but didn't find anything.

Keep in mind, it is for facebook workplace so the graph explorer doesn't work for this problem!

1

There are 1 answers

0
Francesca On

You have to give impersonate account permissions to your Workplace integration. Then, you have to impersonate the account:

https://graph.facebook.com/{userId}?fields=impersonate_token

once you have the user token, you can use it to comment a post on behalf of the user. It is a POST call

https://graph.facebook.com/{postId}/comments

with in the payload { 'message':'test' }