简体   繁体   中英

Ionic 4 Post to Facebook Page

I would like to post a message that the user creates from within my app to a facebook page that I own

I have set up facebook login on my app already, I would just like to know how I can use the graph api in my app to post on my facebook page

here is the link to the IONIC Cordova Facebook Plugin Repo: https://github.com/jeduan/cordova-plugin-facebook4 So something like this should work:

this.facebook.api("/114987089875646/feed", ["manage_pages","publish_pages"])

But it does not work because the api method only creates GET requests and there is no way to set the request method to POST

Also the cordova's Facebook plugin also doesn't seem like it supports posting to Graph API.

Why you dont use the angular http to make your request?

https://angular.io/guide/http

like this:

this.http.post('https://graph.facebook.com/{your-page-id}/feed?message=Awesome!&access_token={your-page-access-token}', { data }, { headers }).map(res => res.json());

request url find here:https://developers.facebook.com/docs/graph-api/using-graph-api/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM