How to Integrate Facebook Graph API with n8n: A Complete Guide
If you want to automate Facebook Page management—posting updates, reading feeds, managing comments—using n8n and Facebook Graph API, this guide walks you through the entire process. From setting up your Facebook app and getting the right permissions to creating your first post using n8n, you’ll learn exactly what you need.
Why Use Facebook Graph API with n8n?
Facebook Graph API is the official way to interact programmatically with Facebook Pages, Groups, and user profiles. n8n is a powerful automation tool that can help you build workflows to automate tasks like:
- Posting updates automatically
- Reading and processing comments
- Managing Page insights and analytics
Step 1: Understand Facebook Permissions & Use Cases
Before diving in, understand the permissions your app needs. Different tasks require different scopes:
| Task | Required Permissions |
|---|---|
| Read Page info and posts | pages_show_list, pages_read_engagement |
| Post content to Page feed | pages_manage_posts, pages_read_engagement |
| Manage comments | pages_manage_engagement |
| Access Page insights | pages_read_engagement |
Make sure you request the minimum necessary permissions to keep your app simple and compliant.
Step 2: Create and Configure Your Facebook App
- Go to the Facebook Developers Console
- Create a new app (select type "Business" or related)
- Add Facebook Login if you want user authentication flow
- Add Facebook Pages API access
- Fill in required details like Privacy Policy URL, App Domains, and contact info
- Set up app roles (admins, developers, testers) to control who can test before review
Step 3: Generate Access Tokens with the Right Permissions
a. Get a User Access Token
Use the Graph API Explorer to:
- Select your app
- Click Get User Access Token
- Select these permissions:
pages_show_listpages_read_engagementpages_manage_posts
- Accept Facebook’s permission dialog and generate the token
b. Get the Page Access Token
With the User Access Token, call:
GET https://graph.facebook.com/v24.0/me/accounts?access_token=USER_ACCESS_TOKEN
The response includes the pages you manage, plus their Page Access Tokens.
Use the Page Access Token for any further calls to manage the page.
Step 4: Test Facebook API Calls Manually
Before automating with n8n, test your calls using the Graph API Explorer or curl:
List page feed:
GET /{page-id}/feed?access_token=PAGE_ACCESS_TOKENPost a message:
POST /{page-id}/feedmessage=Hello from n8n!access_token=PAGE_ACCESS_TOKEN
You should receive a post ID confirming your post was successful.
Step 5: Submit Your App for Facebook Review (If Needed)
If you want to go live with users other than admins or testers:
- Submit your app for review in the Facebook Developer Dashboard
- Request the permissions you use (
pages_manage_posts,pages_read_engagement, etc.) - Provide Facebook with a clear explanation, screencast, and test users for validation
- After approval, your app can be used publicly
Step 6: Automate Posting in n8n
Now that your app and tokens are ready, configure an HTTP Request node in n8n:
| Field | Value |
|---|---|
| HTTP Method | POST |
| URL | https://graph.facebook.com/v24.0/{page-id}/feed (replace {page-id}) |
| Authentication | None (pass token manually) |
| Body Content Type | Form URL-Encoded |
| Body Parameters | message: Your post text access_token: Your Page Access Token |
Example n8n Workflow JSON Snippet:
{ "nodes": [ { "parameters": { "httpMethod": "POST", "url": "https://graph.facebook.com/v24.0/763374396870113/feed", "bodyContentType": "form-url-encoded", "bodyParametersUi": { "parameter": [ { "name": "message", "value": "Hello world from n8n!" }, { "name": "access_token", "value": "YOUR_PAGE_ACCESS_TOKEN" } ] } }, "name": "Post to Facebook Page", "type": "httpRequest", "typeVersion": 1, "position": [450, 300] } ]}
Step 7: Best Practices
- Always use the Page Access Token (never the User Access Token) when interacting with pages.
- Handle token expiration by using long-lived tokens or automating token refresh.
- Store your tokens securely (n8n Credentials or environment variables).
- Test all calls first in Graph API Explorer before automating.
- Respect Facebook API rate limits and permissions policies.
Summary
By carefully managing Facebook app permissions and tokens, and configuring your n8n workflow correctly, you can fully automate Facebook Page management tasks — posting updates, reading feeds, and more.
If you follow this guide, you’ll avoid common pitfalls like permission errors, expired tokens, or invalid API paths.