๐ฑ Automate Facebook page token renewal with data tables storage
โก 221 views ยท ๐ฑ Social Media & Email Marketing
๐ก Pro Tip โ If youโve run into Facebookโs Graph API permission restrictions, ScraperNode is a community node that scrapes pages, groups, posts, and comments directly โ no app review needed.
Description
Get Long-Lived Facebook Page Access Token with Data Table
> Set up n8n self-hosted via Tino.vn VPS โ use code VPSN8N for up to 39% off (affiliate link).
Good to Know
This workflow automatically solves the common issue of Facebook Page Access Tokens expiring. It proactively renews your Page Tokens and stores them in an n8n Data Table.
It runs every two months, ensuring your Page Access Tokens remain valid. This guarantees seamless and uninterrupted automation for all your Facebook API integrations.
How It Works
The workflow performs the following steps to keep your tokens up to date:
- Schedule Trigger: The workflow runs on a set schedule โ every two months by default.
- Set Parameters: It initializes the required credentials:
client_id,client_secret, a short-liveduser_access_token, and theapp_scoped_user_id(all obtained from Facebook Developer Tools). - Get Long-Lived User Token: It exchanges the short-lived User Access Token for a long-lived one.
- Get Page Tokens: Using the long-lived User Token, it fetches all pages you manage and their corresponding Page Access Tokens.
- Update Data Table: For each page, it extracts the
access_token,name, andid, then performs an Upsert operation to update or insert rows in your n8n Data Table, ensuring the stored tokens are always current.
How to Use
-
Import: Import this JSON file into your n8n instance.
-
Configure Credentials: Open the Set Parameters node and replace the placeholder values for
client_id,client_secret,user_access_token, andapp_scoped_user_idwith your actual credentials from Facebook. -
Configure Data Table: Open the Upsert row(s) node.
- Select or create an n8n Data Table to store your tokens.
- Make sure the column mapping (
token,name_page,id_page) matches your table schema.
-
Activate: Save and activate the workflow. It will now run automatically based on your configured schedule.
Requirements
-
n8n instance : > Set up n8n self-hosted via Tino.vn VPS โ use code VPSN8N for up to 39% off (affiliate link).
-
Facebook App: A Facebook Developer App to generate the following credentials:
client_idandclient_secret- A short-lived
user_access_token app_scoped_user_id
-
Data Table: An n8n Data Table configured with columns to store token information (e.g.,
token,name_page,id_page).
Customizing This Workflow
- Change Schedule: To modify how often tokens are renewed, edit the Schedule Trigger node. You can change the interval from 2 months to 1 month, or schedule it for a specific day.
- Filter Pages: If you only want to store tokens for specific pages, insert a Filter node right after Split Out. Use the page name or ID to filter before sending data to Upsert row(s).
- Alternative Storage: Instead of an n8n Data Table, you can replace the Upsert row(s) node with another option (e.g., Google Sheets, a database, or a Set node) to store tokens elsewhere.
๐ Nodes Used
HTTP Request, Schedule Trigger, Data table
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File