8
n8n 한국어amn8n.com

Facebook 및 Instagram 갱신 토큰

중급

이것은자동화 워크플로우로, 13개의 노드를 포함합니다.주로 If, Set, DataTable, HttpRequest, ManualTrigger 등의 노드를 사용하며. Graph API 및 데이터 스토리지를 사용한 Meta 토큰 자동 갱신

사전 요구사항
  • 대상 API의 인증 정보가 필요할 수 있음

카테고리

-
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "QRfOs6S3QrhslSFD",
  "meta": {
    "instanceId": "8e9162e70be518ca153a70a16d8785f5bfc6523821e135712fb7ef93fe97a5dd"
  },
  "name": "Facebook & Instagram Renovation Token",
  "tags": [],
  "nodes": [
    {
      "id": "56b6e307-f5e0-405e-9e1e-eb8e2d49b518",
      "name": "스케줄 트리거",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -304,
        -80
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 10,
              "triggerAtHour": 21
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3a4de69d-c1d8-4e83-b3bb-25e6ff1c3cd3",
      "name": "작업 없음",
      "type": "n8n-nodes-base.noOp",
      "position": [
        400,
        160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ed641ba7-01ec-4baa-bf2e-5cac217a7709",
      "name": "토큰 만료 날짜 가져오기",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -32,
        0
      ],
      "parameters": {
        "limit": 1,
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "TcHt9QIGMyCs1qIB",
          "cachedResultUrl": "/projects/XqoBcIeUrbWmIJt8/datatables/TcHt9QIGMyCs1qIB",
          "cachedResultName": "Meta credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ebfac905-851e-42db-b4d4-5c2a67987b46",
      "name": "갱신 필요?",
      "type": "n8n-nodes-base.if",
      "position": [
        176,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e62d1e04-38f2-454f-9301-6b6b896a9e5a",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ new Date($json.expires_at) <= new Date(Date.now() + 15*24*60*60*1000) }}",
              "rightValue": "={{ 10 }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1da184df-364e-4c52-844a-f368480ad132",
      "name": "ID 및 토큰 전달",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        -16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1d09ed8a-2288-42db-b355-63e9b0354cbb",
              "name": "record_id",
              "type": "number",
              "value": "={{ $json.id }}"
            },
            {
              "id": "25975e2f-4375-41d4-b9cb-97ac0cec134b",
              "name": "current_token",
              "type": "string",
              "value": "={{ $json.token }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "42726ba6-dbab-4cdc-893e-92c299c0fe96",
      "name": "사용자 교환",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        672,
        -16
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v20.0/oauth/access_token",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "form-urlencoded",
        "bodyParameters": {
          "parameters": [
            {
              "name": "grant_type",
              "value": "fb_exchange_token"
            },
            {
              "name": "client_id"
            },
            {
              "name": "client_secret"
            },
            {
              "name": "fb_exchange_token",
              "value": "={{$json.current_token}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2e570311-fc11-408c-956a-f66a246aa5e1",
      "name": "새 만료일 계산",
      "type": "n8n-nodes-base.set",
      "position": [
        960,
        -16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6be317cc-adac-45eb-a36d-0440c0fbac1c",
              "name": "token",
              "type": "string",
              "value": "={{ $json.access_token }}"
            },
            {
              "id": "5d6562df-c638-4245-b967-c02e2617fab5",
              "name": "expired_at",
              "type": "string",
              "value": "={{ new Date(Date.now() + ($json.expires_in)*1000).toISOString() }}"
            },
            {
              "id": "3268497e-4040-4486-bde1-b65caf5141df",
              "name": "record_id",
              "type": "string",
              "value": "={{ $node[\"Carry ID & Token\"].json.record_id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "97cbffa5-4305-42da-bafe-26a5f06df25a",
      "name": "레코드 업데이트",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1168,
        -16
      ],
      "parameters": {
        "columns": {
          "value": {
            "token": "={{$json.token}}",
            "expires_at": "={{$json.expired_at}}"
          },
          "schema": [
            {
              "id": "token",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "token",
              "defaultMatch": false
            },
            {
              "id": "expires_at",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "expires_at",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyValue": "={{$json.record_id}}"
            }
          ]
        },
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "TcHt9QIGMyCs1qIB",
          "cachedResultUrl": "/projects/XqoBcIeUrbWmIJt8/datatables/TcHt9QIGMyCs1qIB",
          "cachedResultName": "Meta credencial"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e477c855-2431-4507-a8bb-8f108ab5a973",
      "name": "스티커 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -240
      ],
      "parameters": {
        "width": 288,
        "height": 480,
        "content": "* Right now the cron runs every 10 days to avoid consuming too much n8n credits. Feel free to change it. If you change it change also the logic in the \"Needs renewal?\" node.\n* For now Facebook gives token with 60 days expiration "
      },
      "typeVersion": 1
    },
    {
      "id": "9e8f62b4-187d-43eb-a40b-baa555c01eb6",
      "name": "스티커 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 256,
        "height": 480,
        "content": "## Data tables\n* This workflow is using the new Data tables feature\n* Create a DataTable called \"Meta credential\" with the following fields:\n** Token - your Access Token (string)\n** expires_at - expiration date of your token (datetime)"
      },
      "typeVersion": 1
    },
    {
      "id": "6afeba73-f1f4-436d-a3a4-811cc6d841de",
      "name": "스티커 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -256
      ],
      "parameters": {
        "color": 5,
        "width": 272,
        "height": 496,
        "content": "## Generate new tokens\n* If tokens has less than 15 days before expiring it generates a new one \n* In this node you need to update the following fields: \n** client_id: this is your AppID you got when creating your credential \n** client_secret: this is your AppSecret"
      },
      "typeVersion": 1
    },
    {
      "id": "fef64b9c-a077-4278-9187-db0743ca7692",
      "name": "스티커 노트3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -256
      ],
      "parameters": {
        "color": 2,
        "width": 448,
        "height": 496,
        "content": "## Setting new expiration date and updating data table \n* It format the date from unix to datetime \n* It updates the row in the Data table"
      },
      "typeVersion": 1
    },
    {
      "id": "2e41d7ee-aae9-4083-bdd0-4252fc764dd9",
      "name": "워크플로 실행 시",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -304,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "7be243a3-0f7d-4039-990a-613e2a856002",
  "connections": {
    "42726ba6-dbab-4cdc-893e-92c299c0fe96": {
      "main": [
        [
          {
            "node": "2e570311-fc11-408c-956a-f66a246aa5e1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ebfac905-851e-42db-b4d4-5c2a67987b46": {
      "main": [
        [
          {
            "node": "1da184df-364e-4c52-844a-f368480ad132",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3a4de69d-c1d8-4e83-b3bb-25e6ff1c3cd3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1da184df-364e-4c52-844a-f368480ad132": {
      "main": [
        [
          {
            "node": "42726ba6-dbab-4cdc-893e-92c299c0fe96",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "56b6e307-f5e0-405e-9e1e-eb8e2d49b518": {
      "main": [
        [
          {
            "node": "ed641ba7-01ec-4baa-bf2e-5cac217a7709",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2e570311-fc11-408c-956a-f66a246aa5e1": {
      "main": [
        [
          {
            "node": "97cbffa5-4305-42da-bafe-26a5f06df25a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ed641ba7-01ec-4baa-bf2e-5cac217a7709": {
      "main": [
        [
          {
            "node": "ebfac905-851e-42db-b4d4-5c2a67987b46",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2e41d7ee-aae9-4083-bdd0-4252fc764dd9": {
      "main": [
        [
          {
            "node": "ed641ba7-01ec-4baa-bf2e-5cac217a7709",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

중급

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
중급
노드 수13
카테고리-
노드 유형8
난이도 설명

일정 경험을 가진 사용자를 위한 6-15개 노드의 중간 복잡도 워크플로우

저자
Geoffroy

Geoffroy

@jojoq42

Just a simple guy discovering the power of AI

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34