{
  "name": "ApogeoAPI \u2014 Normalize CRM deal value to USD using live FX",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "new-deal",
        "responseMode": "onReceived"
      },
      "name": "Webhook (new CRM deal)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.body.currency }}",
              "operation": "equal",
              "value2": "USD"
            }
          ]
        }
      },
      "name": "Already in USD?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "resource": "exchangeRate",
        "operation": "get",
        "currency": "={{ $node['Webhook (new CRM deal)'].json.body.currency }}"
      },
      "name": "ApogeoAPI: get FX rate",
      "type": "n8n-nodes-apogeoapi.apogeoapi",
      "typeVersion": 1,
      "position": [
        680,
        380
      ],
      "credentials": {
        "apogeoApiCredentials": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "valueUSD",
              "value": "={{ Math.round( ($node['Webhook (new CRM deal)'].json.body.amount / $json.usdRate) * 100 ) / 100 }}"
            }
          ],
          "string": [
            {
              "name": "originalCurrency",
              "value": "={{ $node['Webhook (new CRM deal)'].json.body.currency }}"
            },
            {
              "name": "rateUsedAt",
              "value": "={{ $json.lastUpdated }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Compute USD value",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        900,
        380
      ]
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "valueUSD",
              "value": "={{ $node['Webhook (new CRM deal)'].json.body.amount }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Pass through (USD)",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        680,
        220
      ]
    }
  ],
  "connections": {
    "Webhook (new CRM deal)": {
      "main": [
        [
          {
            "node": "Already in USD?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Already in USD?": {
      "main": [
        [
          {
            "node": "Pass through (USD)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ApogeoAPI: get FX rate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ApogeoAPI: get FX rate": {
      "main": [
        [
          {
            "node": "Compute USD value",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "staticData": null,
  "meta": {
    "templateCreatedBy": "ApogeoAPI",
    "description": "When a CRM deal is created (HubSpot, Salesforce, Pipedrive etc.) in any currency, fetches the live USD exchange rate from ApogeoAPI and computes the USD-normalized amount. Useful for unified pipeline reporting across regions. The IF branch skips the FX call when the deal is already in USD.",
    "useCases": [
      "Sales ops: unified MRR/ARR reporting in USD",
      "Finance: real-time USD valuation of multi-currency pipeline",
      "Reporting: consistent currency for dashboards"
    ]
  }
}