{
  "nodes": [
    {
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1650,
        300
      ],
      "parameters": {
        "table": "Pokemon",
        "operation": "list",
        "additionalOptions": {}
      },
      "typeVersion": 1
    },
    {
      "name": "Redis",
      "type": "n8n-nodes-base.redis",
      "position": [
        600,
        600
      ],
      "parameters": {
        "key": "={{$json[\"apiKey\"]}}",
        "ttl": 3600,
        "expire": true,
        "operation": "incr"
      },
      "typeVersion": 1
    },
    {
      "name": "Redis1",
      "type": "n8n-nodes-base.redis",
      "position": [
        1200,
        450
      ],
      "parameters": {
        "key": "={{$json[\"apiKey\"]}}",
        "operation": "incr"
      },
      "typeVersion": 1
    },
    {
      "name": "Set1",
      "type": "n8n-nodes-base.set",
      "position": [
        1600,
        550
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "message",
              "value": "You exceeded your limit"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "name": "Webhook1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        200,
        600
      ],
      "parameters": {
        "path": "a3167ed7-98d2-422c-bfe2-e3ba599d19f1",
        "options": {},
        "responseMode": "lastNode",
        "authentication": "headerAuth"
      },
      "typeVersion": 1
    },
    {
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        1900,
        300
      ],
      "parameters": {
        "functionCode": " const limit = `Limit consumed: `+ $node['Redis1'].json[$node[\"Set2\"].json[\"apiKey\"]];\n return [\n  {\n    json: {\n      message:limit,\n      body: items.map(item => {\n        const name= item.json.fields.name\n        const url= item.json.fields.url\n        return {name,url}\n      })\n    }\n  }\n]\n"
      },
      "typeVersion": 1
    },
    {
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        600
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "apiKey",
              "value": "={{$json[\"headers\"][\"x-api-key\"] +'-'+ new Date().getHours() +'-'+ new Date().getMinutes()}}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "name": "Set2",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        450
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "apiKey",
              "value": "={{$node['Webhook1'].json[\"headers\"][\"x-api-key\"] +'-'+ new Date().getHours()}}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "name": "Set3",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        700
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "message",
              "value": "You exceeded your limit"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1
    },
    {
      "name": "Per hour",
      "type": "n8n-nodes-base.if",
      "position": [
        1400,
        450
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[$node[\"Set2\"].json[\"apiKey\"]]}}",
              "value2": 60
            }
          ],
          "string": []
        }
      },
      "typeVersion": 1
    },
    {
      "name": "Per minute",
      "type": "n8n-nodes-base.if",
      "position": [
        800,
        600
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[$node[\"Set\"].json[\"apiKey\"]]}}",
              "value2": 10,
              "operation": "smallerEqual"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "76b88f4b-4f17-5d69-9d03-3d3ca1242d1a",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# list airtable and incr redis and webhook\n\n## Purpose and structure\nThis folder contains the **list airtable and incr redis and webhook** workflow. Its executable nodes use `airtable`, `function`, `if`, `redis`, `set`, `webhook`. 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\nWebhook1\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/Webhook/0099_Webhook_Airtable_Automate_Webhook.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "Redis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set2": {
      "main": [
        [
          {
            "node": "Redis1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis": {
      "main": [
        [
          {
            "node": "Per minute",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis1": {
      "main": [
        [
          {
            "node": "Per hour",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Per hour": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook1": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Per minute": {
      "main": [
        [
          {
            "node": "Set2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
