Automated meta token renewal system with Graph API and data storage
Ready for 3.0What this workflow does
This workflow has 9 nodes and runs on a schedule (every 10 days at 21:00) (plus 1 other trigger). It uses only n8n's built-in nodes. It also calls graph.facebook.com over HTTP.
How it runs
Trigger: On a schedule (every 10 days at 21:00) (plus 1 other trigger).
- Get token expiration date (Data table): get
- Needs renewal? (If): checks a condition and branches into true / false
- Carry ID & Token (Edit Fields (Set)): sets 2 fields: record_id, current_token
- User Exchange (HTTP Request): calls graph.facebook.com (POST)
- Compute new expiry (Edit Fields (Set)): sets 3 fields: token, expired_at, record_id
- Update Record (Data table): update
HTTP calls to: graph.facebook.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (7)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - No Operation, do nothing
n8n-nodes-base.noOp - Data table
n8n-nodes-base.dataTable - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - Manual Trigger
n8n-nodes-base.manualTrigger
From the author
Meta long-lived user tokens typically expire after ~60 days. If a token expires, any workflows that rely on it start failing. Manual renewal is easy to forget and time consuming. This template monitors the token you store in an n8n Data Table and refreshes it…