Skip to main content

Automated meta token renewal system with Graph API and data storage

Workflow preview

Workflow preview
100%
Automated meta token renewal system with Graph API and data storage preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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 monit...

Best for

  • DevOps automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.noop, n8n-nodes-base.datatable, n8n-nodes-base.if, n8n-nodes-base.set, n8n-nodes-base.httprequest, n8n-nodes-base.stickynote, n8n-nodes-base.manualtrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Geoffroy.

Original n8n.io source

1.1 Workflow description

Title
Automated meta token renewal system with Graph API and data storage
Workflow name
Automated meta token renewal system with Graph API and data storage

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 automatically before expiration, so your social automations keep running without surprises or late-night fire drills.

Who’s it for

  • Agencies, marketing team, creators managing Meta apps or scheduled social automations
  • Anyone tired of “token expired” errors breaking flows at 2 a.m.

How it works / What it does

  • Triggers: scheduled every 10 days, plus a Manual Trigger for testing.
  • Reads: pulls the current token row from your "Meta credential" Data Table (fields: token and expires_at).
  • Decides: IF the token expires in ≤ 15 days, proceed to renewal; otherwise do nothing.
  • Calls the Graph API to get a new access token
  • Updates: computes the new ISO expires_at from expires_in and writes the fresh token + expires_at back to the Data Table. Note: Meta typically issues ~60-day long-lived tokens; confirm for your app.

Requirements

  • A Meta app with an initial (short-lived or long-lived) user access token
  • n8n Data Tables enabled (you might need to update your instance to see the option) and a table named "Meta credential" with: ** token (string) ** expires_at (datetime)

How to set up

  • Create the data table: name it "Meta credential" with columns "token" and "expires_at". Insert one row with your current token and its expiration date.
  • Configure the IF node "Needs renewal?": keep (or tweak) the 15-day threshold logic.
  • Run once with the Manual Trigger to validate, then enable the Schedule Trigger (10-day cadence by default).

How to customize the workflow

  • Change the Schedule Trigger interval and hour.
  • Notify on renewal: Add a Slack/Email node after "Update Record" to alert on token refreshes.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - No Operation, do nothing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 3 - Get token expiration date

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 4 - Needs renewal?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 5 - Carry ID & Token

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - User Exchange

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 7 - Compute new expiry

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - Update Record

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 9 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - When clicking "Execute workflow"

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

3. Summary Table

Workflow Automated meta token renewal system with Graph API and data storage
Complexity intermediate
Nodes 13
Categories DevOps
Author Geoffroy
Published 14 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9604/9604.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated meta token renewal system with Graph API and data storage do?

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 monit...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.