{
  "name": "Weekly Palanor readings to Google Sheets (HTTP Request)",
  "nodes": [
    {
      "id": "c3f0c6c2-1d0e-4c55-9b1a-000000000001",
      "name": "Every Monday 8:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      }
    },
    {
      "id": "c3f0c6c2-1d0e-4c55-9b1a-000000000002",
      "name": "Signals to read",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        240,
        0
      ],
      "parameters": {
        "jsCode": "// The signals to read each week. Find slugs at palanor.com/signals or with GET /v1/search.\nreturn ['fred_unemployment', 'fred_jobless'].map((slug) => ({ json: { slug } }));"
      }
    },
    {
      "id": "c3f0c6c2-1d0e-4c55-9b1a-000000000003",
      "name": "Read the signal",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        0
      ],
      "parameters": {
        "url": "=https://api.palanor.com/v1/signals/{{ encodeURIComponent($json.slug) }}?history=1",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "options": {}
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "",
          "name": "Palanor API key (Bearer)"
        }
      }
    },
    {
      "id": "c3f0c6c2-1d0e-4c55-9b1a-000000000004",
      "name": "One row per signal",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        720,
        0
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "s1",
              "name": "Signal",
              "value": "={{ $json.data.name }}",
              "type": "string"
            },
            {
              "id": "s2",
              "name": "Date",
              "value": "={{ $json.data.latest.observed_at }}",
              "type": "string"
            },
            {
              "id": "s3",
              "name": "Value",
              "value": "={{ $json.data.latest.value }}",
              "type": "number"
            },
            {
              "id": "s4",
              "name": "Where it stands",
              "value": "={{ ($json.data.context?.read || []).join(' ') }}",
              "type": "string"
            },
            {
              "id": "s5",
              "name": "Source",
              "value": "={{ $json.data.provenance.attribution || $json.data.provenance.publisher }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "c3f0c6c2-1d0e-4c55-9b1a-000000000005",
      "name": "Append to the sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        960,
        0
      ],
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Palanor"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      }
    }
  ],
  "connections": {
    "Every Monday 8:00": {
      "main": [
        [
          {
            "node": "Signals to read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Signals to read": {
      "main": [
        [
          {
            "node": "Read the signal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read the signal": {
      "main": [
        [
          {
            "node": "One row per signal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One row per signal": {
      "main": [
        [
          {
            "node": "Append to the sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false,
    "palanor": "No community node needed. Make a Bearer Auth credential holding your Palanor Pro or Enterprise key. Only signals whose source allows redistribution are served; keep the Source column with the numbers."
  },
  "pinData": {}
}
