How to Automate Macro Data Workflows with n8n banner image

Implementation

How-To Guides

How to Automate Macro Data Workflows with n8n

Build automated macro data pipelines in n8n — fetch FXMacroData indicators on a schedule, filter by release calendar events, and route results to Slack, Google Sheets, or any webhook — all without writing server infrastructure.

n8n is a self-hostable, open-source workflow automation platform that lets you connect APIs, databases, and SaaS tools through a visual node editor — no backend infrastructure required. For macro data workflows, n8n is a natural fit: pull indicator readings on a schedule, filter by upcoming release calendar events, and push results to Slack, Google Sheets, a database, or any downstream webhook — all configured visually and running 24/7 without a dedicated server process. This guide walks through building a complete FXMacroData automation workflow in n8n from scratch.

What you will build

  • A scheduled workflow — runs every weekday morning and fetches the latest macro indicators for a currency pair
  • An HTTP Request node pipeline — calls the FXMacroData announcements endpoint and parses the JSON response
  • A release-calendar pre-alert branch — detects upcoming high-impact events and sends an early warning to Slack or Discord
  • A Google Sheets logging branch — appends each new reading to a spreadsheet for historical tracking
  • A conditional filter — only fires downstream actions when a value has changed since the last run

Prerequisites

  • n8n instancen8n.io cloud account (free tier works) or self-hosted via npx n8n / Docker
  • FXMacroData API key — sign up at /subscribe; many USD indicators are publicly accessible without a key
  • Slack or Discord webhook URL (optional) — for notification steps; you can skip these and use the Google Sheets branch only
  • Google Sheets OAuth connection (optional) — configure via n8n's built-in Google credentials if you want spreadsheet logging

Step 1 — Start n8n and create a blank workflow

The quickest way to run n8n locally is with npx. If you prefer Docker or the cloud version, the node configuration is identical — skip ahead to creating the workflow.

# Local quick-start (Node.js 18+ required)
npx n8n

# Or with Docker
docker run -it --rm \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  n8nio/n8n

Open http://localhost:5678 in your browser, create an account, and click + New workflow from the left sidebar. You will see a blank canvas — this is where the pipeline lives.

Store your API key as an n8n credential so it is never embedded in node configurations. In n8n, go to Settings → Credentials → Add credential → HTTP Header Auth and save your key:

Name:  FXMacroData API Key
Header Name: (leave blank — we use query params)
Value: YOUR_FXMACRODATA_API_KEY

You will reference this stored credential in the HTTP Request node in the next step.


Step 2 — Add a Schedule Trigger node

A Schedule Trigger node fires the workflow at a defined interval. For macro data workflows, a daily trigger 30 minutes before the London open (07:30 UTC) ensures fresh readings are available before the first high-liquidity session of the day.

Click the + button on the canvas and search for Schedule Trigger. Configure it as follows:

// Schedule Trigger — node settings

Trigger interval: Custom (cron)

Cron expression: 30 7 * * 1-5

// Runs Mon–Fri at 07:30 UTC

For testing, switch the trigger to Manual temporarily — this lets you run the full workflow from the canvas with a single click without waiting for the schedule.

Tip: use the release calendar to refine your schedule

Rather than polling every day, you can pre-fetch this week's upcoming releases from the release calendar endpoint on Monday morning and use an n8n IF node to skip the fetch step on days with no scheduled announcements. This pattern is shown in Step 5 below.


Step 3 — Configure the HTTP Request node for FXMacroData

Add an HTTP Request node after the Schedule Trigger (click the + on the trigger's output connector and search for HTTP Request). This node makes the API call to FXMacroData and returns the JSON response directly into the workflow.

Configure the node with these settings:

// HTTP Request node — Fetch latest EUR policy rate

Method: GET

URL: https://fxmacrodata.com/api/v1/announcements/eur/policy_rate

Authentication: None (we pass the key as a query param below)

Query Parameters:

api_key = YOUR_API_KEY

Response Format: JSON

n8n's HTTP Request node has a dedicated Query Parameters table — add one row:

Name:  api_key
Value: {{ $credentials.fxmacrodataApiKey.value }}
       (or paste your key directly for quick testing)

Click Execute node to verify the response. You should see output similar to:

{
  "currency": "EUR",
  "indicator": "policy_rate",
  "date": "2025-06-12",
  "val": 3.40,
  "prior": 3.65,
  "announcement_datetime": "2025-06-12T13:15:00Z"
}

The announcement_datetime field gives you second-level precision on when this value was officially published — use it as the deduplication key so your workflow never double-alerts on the same release.

Fetching multiple indicators in one workflow

To pull several indicators (e.g. policy rate, CPI, and unemployment for the same currency), add parallel HTTP Request nodes after the trigger — one per endpoint — and merge their outputs with a Merge node set to Combine mode before the transform step.


Step 4 — Parse and transform the response with a Code node

Add a Code node after the HTTP Request node to extract the fields you care about and enrich the payload. n8n's Code node runs JavaScript and has full access to the previous node's output via $input.all().

// Code node: parse FXMacroData announcement response
const items = $input.all();

return items.map(item => {
  const d = item.json;

  // Determine direction relative to prior value
  const direction =
    d.val > d.prior ? "↑ Hawkish signal" :
    d.val < d.prior ? "↓ Dovish signal"  : "→ Unchanged";

  const surpriseText =
    d.consensus != null
      ? `Consensus was ${d.consensus}; actual ${d.val > d.consensus ? "beat" : "missed"}.`
      : "";

  return {
    json: {
      currency:              d.currency,
      indicator:             d.indicator,
      value:                 d.val,
      prior:                 d.prior,
      direction,
      surprise:              surpriseText,
      announcement_datetime: d.announcement_datetime,
      summary: `${d.currency.toUpperCase()} ${d.indicator.replace(/_/g, " ")}: ` +
               `${d.val} (prior ${d.prior}) — ${direction}`
    }
  };
});

This produces a clean, enriched object for each item. The summary field is ready to paste directly into a Slack message or spreadsheet row.


Step 5 — Add a conditional filter with an IF node

You only want to fire downstream actions when the release is genuinely new — not if the API returns the same announcement_datetime you already processed in a previous run. Add an IF node after the Code node.

Use n8n's Static Data (accessible via the Code node's $getWorkflowStaticData helper) to persist the last-seen announcement_datetime between runs:

// Code node: deduplication guard — place before the IF node
const staticData = $getWorkflowStaticData("global");

return $input.all().map(item => {
  const ts = item.json.announcement_datetime;
  const isNew = ts !== staticData.lastSeen;

  // Update state only if this is a new release
  if (isNew) {
    staticData.lastSeen = ts;
  }

  return { json: { ...item.json, isNew } };
});

Then configure the IF node:

// IF node — only proceed when the release is new

Condition: {{ $json.isNew }} is equal to true

// True branch → notify / log

// False branch → stop / NoOp

Connect a NoOp node to the False branch so the workflow exits cleanly without errors on days when no new release has printed.


Step 6 — Send notifications to Slack or Discord

Connect the IF node's True output to a Slack node (or an HTTP Request node targeting a Discord webhook URL). Configure the message body to use the enriched fields from the Code node:

// Slack node settings

Resource: Message

Operation: Send

Channel: #macro-alerts

Text:

📊 *New macro release*

{{ $json.summary }}

{{ $json.surprise }}

Published: {{ $json.announcement_datetime }}

For Discord, use an HTTP Request node with method POST and the Discord webhook URL, with the body set to:

{
  "content": "📊 **New macro release**\n{{ $json.summary }}\n{{ $json.surprise }}\nPublished: {{ $json.announcement_datetime }}"
}

Set Body Content Type to JSON and the node will handle serialisation automatically.


Step 7 — Log releases to Google Sheets

Parallel to the Slack notification, add a Google Sheets node to keep a permanent historical log. Connect it to the same True branch output of the IF node (n8n allows multiple nodes to receive the same output).

Configure the Google Sheets node:

// Google Sheets node settings

Resource: Sheet within Document

Operation: Append or Update Row

Spreadsheet: (select your Google Sheet)

Sheet: macro_log

Columns to map:

announcement_datetime → {{ $json.announcement_datetime }}

currency → {{ $json.currency }}

indicator → {{ $json.indicator }}

value → {{ $json.value }}

prior → {{ $json.prior }}

direction → {{ $json.direction }}

You will need to set up Google OAuth credentials in n8n under Settings → Credentials → Google Sheets OAuth2 API before this node can authenticate. Follow n8n's built-in credential setup guide — it takes about two minutes.


Step 8 — Add a release calendar pre-alert branch

A powerful pattern unique to FXMacroData is using the release calendar endpoint to fire advance warnings before a high-impact print — giving your team time to prepare positions before the number hits.

Add a second HTTP Request node connected directly to the Schedule Trigger (in parallel with the announcements fetch). Configure it to pull upcoming releases for the current week:

Method: GET
URL:    https://fxmacrodata.com/api/v1/calendar/eur
Params: api_key=YOUR_API_KEY

Follow this with a Code node that filters for events happening within the next 60 minutes:

// Code node: filter calendar events due within the next hour
const nowMs  = Date.now();
const oneHrMs = 60 * 60 * 1000;

return $input.all().flatMap(item => {
  const events = Array.isArray(item.json) ? item.json : [item.json];

  return events
    .filter(ev => {
      const evMs = new Date(ev.release_datetime).getTime();
      return evMs > nowMs && evMs <= nowMs + oneHrMs;
    })
    .map(ev => ({
      json: {
        currency:         ev.currency,
        indicator:        ev.indicator,
        release_datetime: ev.release_datetime,
        alert: `⏰ *Upcoming release in <1 hour*\n` +
               `${ev.currency.toUpperCase()} ${ev.indicator.replace(/_/g, " ")}\n` +
               `Scheduled: ${ev.release_datetime}`
      }
    }));
});

Connect the output to a Slack node (or Discord HTTP Request) that sends the alert field to your #macro-alerts channel. When no events are due within an hour, the filtered array is empty and n8n simply produces no output — no action is taken.

Using expression mode for dynamic currency

To make the workflow generic across multiple currencies, replace the hardcoded eur in the URL with an n8n expression. Create a Set node at the top of your workflow to define a currency variable, then reference it in both HTTP Request nodes:

https://fxmacrodata.com/api/v1/announcements/{{ $vars.currency }}/policy_rate?api_key=YOUR_API_KEY

You can then run the same workflow template for any of the 14 supported currencies simply by changing the variable value.


Step 9 — Activate and monitor the workflow

Once you have tested each node individually using the Execute node button, run the full workflow end-to-end by clicking Execute Workflow in the toolbar. Check the execution log for any errors — n8n's visual debugger highlights which node failed and shows the exact input/output at that step.

To put the workflow into production, toggle the Active switch in the top-right corner. n8n will now run the workflow automatically on the cron schedule you defined in Step 2.

Monitoring checklist

  • Execution history — visible in the left sidebar under Executions; shows success/failure per run
  • Error workflow — configure a separate error-handling workflow in Settings → Error Workflow to get notified if any node throws an exception
  • Retry on fail — enable this in HTTP Request node settings to automatically retry transient network errors
  • Execution data pruning — set a retention window (e.g. 30 days) in n8n settings to avoid unbounded disk usage on self-hosted instances

Step 10 — Extend to additional indicators and currencies

The pipeline you have built targets a single indicator for a single currency. Extending it to a broader macro coverage set is straightforward because n8n's visual branching maps directly to the FXMacroData URL structure. Each endpoint follows the same pattern:

https://fxmacrodata.com/api/v1/announcements/{currency}/{indicator}?api_key=YOUR_API_KEY

To fetch multiple indicators in one workflow run, add a SplitInBatches node after the trigger and feed it a list of { currency, indicator } pairs. Each iteration fires one HTTP Request. The pattern below fetches three EUR readings in sequence:

// Set node: define the indicator list
// Add this as a "Set" node at the top, outputting a single item
// with a field named "indicators"

const indicators = [
  { currency: "eur", indicator: "policy_rate" },
  { currency: "eur", indicator: "inflation" },
  { currency: "eur", indicator: "unemployment" }
];

return [{ json: { indicators } }];

Then add a Split Out node to expand the array into individual items, and connect those items to the HTTP Request node. In the HTTP Request URL, reference the current item's fields:

URL: https://fxmacrodata.com/api/v1/announcements/{{ $json.currency }}/{{ $json.indicator }}
Params: api_key=YOUR_API_KEY

This single-template pattern keeps the workflow compact regardless of how many indicators you track. You can explore the full indicator catalogue for any currency at /api-data-docs — the same {currency}/{indicator} path structure applies throughout.

Importing the complete workflow as JSON

n8n lets you export any workflow as a JSON file and share it. After building your workflow, click ⋮ Menu → Download to export a portable .json file. Teammates can import it instantly via + New Workflow → Import from file, add their own API key credential, and activate it — the entire pipeline transfers in seconds.


Summary

You now have a fully automated macro data pipeline running in n8n that:

  • Triggers on a weekday cron schedule (or on demand)
  • Fetches the latest FXMacroData indicator via HTTP Request with query-parameter authentication
  • Parses and enriches the JSON response with directional signals in a Code node
  • Deduplicates against the last-seen announcement_datetime to prevent double-alerts
  • Sends Slack or Discord notifications when a new release prints
  • Appends every new reading to a Google Sheets log for historical analysis
  • Fires advance calendar alerts up to an hour before scheduled high-impact events

From here, natural next steps include adding more currencies to the indicator list, connecting the Sheets log to a Looker Studio dashboard for visualisation, or integrating with a trading platform webhook to trigger order alerts directly on fresh releases. The same n8n HTTP Request pattern works for every FXMacroData endpoint — explore the full API documentation to discover the complete indicator catalogue and start building your own macro intelligence layer.