{
  "name": "Get Long Lived Facebook User or Page Access Token",
  "nodes": [
    {
      "id": "2a5077ad-89ee-4659-93a9-e01bcceba0ad",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        480,
        280
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e2c7ce4c-fbf9-4552-8a9e-5b41d72c8921",
      "name": "Get Long Lived FB User Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1000,
        280
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v20.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": "4e898760-43cd-4d4f-a76c-555175fb2a27",
      "name": "Get Long Lived FB Page Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1280,
        280
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v20.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": "={{ $json.body.access_token }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6ac48498-014f-4721-9629-acd3bd1329e7",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -87.08653868552273
      ],
      "parameters": {
        "width": 260.14166686078653,
        "height": 552.0076928452548,
        "content": "## Set Required Facebook Parameter \n- client_id\n- client_secret\n- user_access_token\n- app-scoped-user-id (optional)\n\n## according to this doc\n https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/"
      },
      "typeVersion": 1
    },
    {
      "id": "11a68266-f7ec-4c56-9327-c4fd0e4478f6",
      "name": "Set Parameter",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b1f6b8a1-dc25-4b1e-9aa3-0c0e452ae2de",
              "name": " client_id",
              "type": "string",
              "value": "xxxx"
            },
            {
              "id": "9a63879a-c359-49ad-9fec-19c9e4c78dd6",
              "name": " client_secret",
              "type": "string",
              "value": "REPLACE_WITH__CLIENT_SECRET"
            },
            {
              "id": "6971a841-ed5e-4d96-bdab-1eaec2d51ccc",
              "name": "user_access_token",
              "type": "string",
              "value": "REPLACE_WITH_USER_ACCESS_TOKEN"
            },
            {
              "id": "c75d5e50-62ea-4ee0-bfaa-5f79cf4d147e",
              "name": "app_scoped_user_id",
              "type": "string",
              "value": "uuuuuu"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3c78c0de-a3b3-5013-ab87-ec0d8959dd6b",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        -87.08653868552273
      ],
      "parameters": {
        "content": "# Get Long Lived Facebook User or Page Access Token\n\n## Purpose and structure\nThis folder contains the **Get Long Lived Facebook User or Page Access Token** workflow. Its executable nodes use `httpRequest`, `manualTrigger`, `set`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nWhen clicking ‘Test workflow’\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Manual/1884_Manual_Stickynote_Import_Webhook.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Set Parameter": {
      "main": [
        [
          {
            "node": "Get Long Lived FB User Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Long Lived FB User Token": {
      "main": [
        [
          {
            "node": "Get Long Lived FB Page Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Parameter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
