AutomationFlowsAI & RAG › Automate Facebook Page Token Renewal with Data Tables Storage

Automate Facebook Page Token Renewal with Data Tables Storage

ByĐỗ Thành Nguyên @nathando on n8n.io

> Set up n8n self-hosted via Tino.vn VPS — use code VPSN8N for up to 39% off (affiliate link).

Cron / scheduled trigger★★★★☆ complexity12 nodesData TableHTTP Request
AI & RAG Trigger: Cron / scheduled Nodes: 12 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #10038 — we link there as the canonical source.

This workflow follows the Datatable → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateId": "2535"
  },
  "nodes": [
    {
      "id": "11a68266-f7ec-4c56-9327-c4fd0e4478f6",
      "name": "Set Parameter",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b1f6b8a1-dc25-4b1e-9aa3-0c0e452ae2de",
              "name": " client_id",
              "type": "string",
              "value": "651431600883439"
            },
            {
              "id": "9a63879a-c359-49ad-9fec-19c9e4c78dd6",
              "name": " client_secret",
              "type": "string",
              "value": "8be00a2b58c01c0d8ca3a7c0e9855396"
            },
            {
              "id": "6971a841-ed5e-4d96-bdab-1eaec2d51ccc",
              "name": "user_access_token",
              "type": "string",
              "value": "=EAAJQeT0qhu8BPmFJqHqKGzLwJpnaPegdRxkjucArXp5ZCwo6CgFWOhl8C4JR1BtZBCWeBhZB4aJPWOvRsC6TBYaQLE88wdboeslVxfxIfySHsXT8WWGFgUKeMkDfXzfnXme4yvZBWFDUzVsVXAM95J3o1rVJc30faaX5dgWfIAcHg0IeEpmkUjK1xSZBQw0tpxicBrAGZAGDGXdlOV"
            },
            {
              "id": "c75d5e50-62ea-4ee0-bfaa-5f79cf4d147e",
              "name": "app_scoped_user_id",
              "type": "string",
              "value": "2098981707228804"
            },
            {
              "id": "75516211-496a-46bf-82ad-2352f7080512",
              "name": "long_user_access_token",
              "type": "string",
              "value": "={{ $json.body.access_token }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c844cc76-6a73-4e4c-b5af-dd3b0c391a66",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        352,
        880
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {
          "includeBinary": false
        },
        "fieldToSplitOut": "body.data"
      },
      "typeVersion": 1
    },
    {
      "id": "5bbff2d4-0b0e-4194-97f7-c1a4c09c7c77",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        544,
        880
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fead0c79-b7a9-4da8-adc8-c68ea86041af",
              "name": "access_token",
              "type": "string",
              "value": "={{ $json['body.data'].access_token }}"
            },
            {
              "id": "98467cc1-4960-4291-a685-b7dd04f24211",
              "name": "name",
              "type": "string",
              "value": "={{ $json['body.data'].name }}"
            },
            {
              "id": "6b7b8c21-ef78-40ba-86df-0a7f46057bca",
              "name": "id",
              "type": "string",
              "value": "={{ $json['body.data'].id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fa84d8ed-511e-42b7-a954-a35bb5b70dd8",
      "name": "Upsert row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        736,
        880
      ],
      "parameters": {
        "columns": {
          "value": {
            "token": "={{ $json.access_token }}",
            "id_page": "={{ $json.id }}",
            "name_page": "={{ $json.name }}"
          },
          "schema": [
            {
              "id": "name_page",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "name_page",
              "defaultMatch": false
            },
            {
              "id": "id_page",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "id_page",
              "defaultMatch": false
            },
            {
              "id": "token",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "token",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyName": "id_page",
              "keyValue": "={{ $json.id }}"
            }
          ]
        },
        "matchType": "allConditions",
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "tmKVoWFoXqgiVHtI",
          "cachedResultUrl": "/projects/ZsXeoU4uGUhTbvTf/datatables/tmKVoWFoXqgiVHtI",
          "cachedResultName": "n8n"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "76b1d58f-41d6-4088-99e1-da2a3663116e",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        272,
        240
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months",
              "monthsInterval": 2
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "831a32d7-ea1a-4d5b-bd2e-e9e715e6d7a1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        176
      ],
      "parameters": {
        "color": 6,
        "width": 1072,
        "height": 288,
        "content": "## Step 1\n**Get  client_id,  client_secret** [here](https://developers.facebook.com/apps)\n\n**Get  user_access_token** [here](https://developers.facebook.com/tools/explorer/)\n\n**Get  app_scoped_user_idn** [here](https://developers.facebook.com/tools/debug/accesstoken/)"
      },
      "typeVersion": 1
    },
    {
      "id": "cfbc57a3-bfb2-4237-b7b0-88d339362931",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        512
      ],
      "parameters": {
        "color": 3,
        "width": 1072,
        "height": 288,
        "content": "## Step 2 \n**Get long lived facebook page token**"
      },
      "typeVersion": 1
    },
    {
      "id": "dddf5f0d-2cab-4b75-8cc4-ecbcd5e3cbcc",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        848
      ],
      "parameters": {
        "width": 1072,
        "height": 288,
        "content": "## Step 3 \n**Now the Facebook Page token has \n\nbeen renewed and will be stored in \n\nthe data tables. This information \n\nwill also be updated whenever you \n\nrun this workflow.**"
      },
      "typeVersion": 1
    },
    {
      "id": "9f3d0b85-8c02-4d78-9da8-f9ce98b189b2",
      "name": "Get long lived facebook user token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        304,
        560
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v23.0/oauth/access_token",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "grant_type",
              "value": "fb_exchange_token"
            },
            {
              "name": "client_id",
              "value": "={{ $json[' client_id'] }}"
            },
            {
              "name": "client_secret",
              "value": "={{ $json[' client_secret'] }}"
            },
            {
              "name": "fb_exchange_token",
              "value": "={{ $json.user_access_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "84e16f5c-6be3-4639-9d34-18cc057725e6",
      "name": "Get list facebook page",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        512,
        560
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v23.0/me/accounts",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "access_token",
              "value": "={{ $json.body.access_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4e898760-43cd-4d4f-a76c-555175fb2a27",
      "name": "Get long lived facebook page token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        560
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v23.0/{{ $('Set Parameter').item.json.app_scoped_user_id }}/accounts",
        "method": "=GET",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": " access_token",
              "value": "={{ $('Get long lived facebook user token').item.json.body.access_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4716bf4a-0d1b-4cc5-bf24-a54f4861c538",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        176
      ],
      "parameters": {
        "width": 544,
        "height": 976,
        "content": "# \ud83d\ude80 **About the Creator**: \n## This workflow is crafted by [**\u0110\u1ed7 Th\u00e0nh Nguy\u00ean**](https://hub.dothanhnguyen.com), \n### an automation architect and creator behind [**hub.dothanhnguyen.com**](https://hub.dothanhnguyen.com) \u2014 a space dedicated to smart workflows, content automation, and no-code productivity systems.\n\n## \ud83d\udca1 Passionate about connecting ideas with execution, Nguy\u00ean builds practical automations that bridge **Airtable, Telegram, n8n, and AI tools** into seamless ecosystems.\n\n# \ud83e\udde9 Deploy your own n8n instance via [**Tino.vn VPS**](https://tino.vn/vps-n8n?affid=388) \u2014 around **$65/year**, use code **VPSN8N** for up to **39% off** *(affiliate link)*.\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Upsert row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Parameter": {
      "main": [
        [
          {
            "node": "Get long lived facebook user token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert row(s)": {
      "main": [
        []
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Parameter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get list facebook page": {
      "main": [
        [
          {
            "node": "Get long lived facebook page token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get long lived facebook page token": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get long lived facebook user token": {
      "main": [
        [
          {
            "node": "Get list facebook page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

> Set up n8n self-hosted via Tino.vn VPS — use code VPSN8N for up to 39% off (affiliate link).

Source: https://n8n.io/workflows/10038/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Automatically surface and insert the three most relevant “Related articles” at the end of every Shopify blog post to boost session depth, SEO, and reader engagement.

HTTP Request, Data Table
AI & RAG

Who is this for? Event organizers losing 80% of form starters who never finish registration and want automated follow-up emails triggered by abandonment beacons. What problem is this workflow solving?

HTTP Request, Email Send, Data Table
AI & RAG

Automatically publish Lightroom photos to Instagram with short, human-sounding AI captions. This workflow pulls the next item from your Data Table queue, generates an on-brand caption from alt text +

Data Table, Anthropic, HTTP Request
AI & RAG

This template is perfect for TikTok creators, content marketers, and social media teams who want to turn viral comments into engaging short-form videos without manually scripting, recording, or editin

Data Table, HTTP Request, OpenAI +1
AI & RAG

Create a reusable “photos to post” queue from your Lightroom Cloud album—ideal for Lightroom-to-Instagram automation with n8n. It discovers new photos, stores clean metadata in a Data Table, and gener

HTTP Request, Anthropic, Data Table