The facebook
platform manages a facebook page (not your feed)
using the plain graph api - no extensions installed.
- go to https://developers.facebook.com/
- create an app that can manage pages
- under 'settings', find your app ID
- save this as
FAIRPOST_FACEBOOK_APP_ID
in your global .env
- save this as
- under 'settings', find your app secret
- save this as
FAIRPOST_FACEBOOK_APP_SECRET
in your global .env
- save this as
- keep the app under development, otherwise the localhost return url wont work
- Add 'facebook' to your
FEED_PLATFORMS
in your usersstorage.json
- go to https://business.facebook.com/
- find your page (currently under 'settings > accounts > pages')
- save the page id as
FACEBOOK_PAGE_ID
in your usersstorage.json
This token should last forever. It involves getting a user access token, exchanging it for a long-lived user token and then requesting the 'accounts' for your 'app scoped user id'; but this app provides a tool to help you do that.
Requesting access tokens only works
- in dev mode and for users that can manage the app
- or in live mode if the app has advanced access permissions
To get advanced access permissions, the app has to go through a review. Below, I will assume you use dev mode when requesting the tokens. Once you have the tokens, you can turn on Live mode and start posting.
- set your app back in dev mode
- go to https://developers.facebook.com/
- select your app, edit it
- set App Mode to 'dev'
- call
./fairpost.js @userid setup-platform --platform=facebook
- follow instructions from the command line
- call
./fairpost.js @userid test-platform --platform=facebook
before you use the app, set the App Mode to 'Live'
- go to https://developers.facebook.com/
- select your app, edit it
- set App Mode to 'live'
- use https://github.com/commonpike/fairpost/blob/master/public/privacy-policy.md for the privacy policy url
One fairpost user can only manage one page. If you create a second user, you can use the same app to manage a different page. The app is registered on your account, so if you can manage the other page, so can the app.
- call
./fairpost.js create-user --userid=foo
- Go to https://www.facebook.com/settings/?tab=business_tools
- edit the app and check the boxes of the other pages you want to manage.
- set your app back in dev mode
- go to https://developers.facebook.com/
- select your app, edit it
- set App Mode to 'dev'
- call
./fairpost.js @foo setup-platform --platform=facebook
- follow instructions from the command line
- put your app back in live mode
- call
./fairpost.js @foo test-platform --platform=facebook
FACEBOOK_PLUGIN_SETTINGS
- a json object describing / overwriting the plugins used to prepare postsFACEBOOK_PUBLISH_POSTS
- if false, posts will be posted but not be published
From https://developers.facebook.com/docs/graph-api/reference/page/photos/ :
Facebook strips all location metadata before publishing and resizes images to different dimensions to best support rendering in multiple sizes.
Facebook supports the following formats:
- JPEG
- BMP
- PNG
- GIF
- TIFF
Files must be 4MB or smaller in size. For PNG files, try keep the file size below 1 MB. PNG files larger than 1 MB may appear pixelated after upload.
https://dev.to/xaypanya/how-to-connect-your-nodejs-server-to-facebook-page-api-1hol https://developers.facebook.com/docs/pages/getting-started https://developers.facebook.com/docs/pages-api/posts https://developers.facebook.com/docs/graph-api/reference/page/photos/ https://developers.facebook.com/docs/video-api/guides/publishing
large uploads: https://developers.facebook.com/docs/graph-api/guides/upload/
https://www.npmjs.com/package/formdata-node https://medium.com/deno-the-complete-reference/sending-form-data-using-fetch-in-node-js-8cedd0b2af85
https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow