8
n8n 中文网amn8n.com

通过Webhook进行IP地理位置查询

中级

这是一个Building Blocks, IT Ops领域的自动化工作流,包含 6 个节点。主要使用 Webhook, HttpRequest, RespondToWebhook 等节点。 通过Webhook使用IP-API.com查询IP地理位置详情

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "9Ua1Wqenubbi6OkW",
  "meta": {
    "instanceId": "1777696fb9fddfee653e70940936c2b1e28ba1f1bde53b7182fbd6eb01988706"
  },
  "name": "IP Geolocation Lookup via Webhook",
  "tags": [],
  "nodes": [
    {
      "id": "03bd8d64-8336-4c15-8ed3-af3144ee1113",
      "name": "Note for Webhook Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        80
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "This node listens for incoming POST requests. It expects a JSON body with an 'ip' property containing the IP address you want to look up (e.g., {\"ip\": \"8.8.8.8\"}). You can easily adjust the webhook path to suit your needs."
      },
      "typeVersion": 1
    },
    {
      "id": "7fefa097-190c-4b86-9fbc-d110e6d913b9",
      "name": "Note for IP Lookup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        60
      ],
      "parameters": {
        "color": 2,
        "width": 260,
        "height": 300,
        "content": "This node makes an HTTP GET request to the IP-API.com service to get detailed geolocation information for the IP address provided by the webhook. The API returns data like country, city, region, ISP, and more."
      },
      "typeVersion": 1
    },
    {
      "id": "46964ab7-7845-4b39-92f9-9011a1484fa3",
      "name": "Note for Webhook Response",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        40
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "height": 340,
        "content": "This node sends the full geolocation data received from IP-API.com back to the original caller of the webhook. This data can be directly consumed or further processed (e.g., logged, filtered, used in conditional logic) before being returned."
      },
      "typeVersion": 1
    },
    {
      "id": "0b4b792d-30fa-4f55-b96c-b9b88da026f0",
      "name": "Get IP Geolocation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        840,
        220
      ],
      "parameters": {
        "url": "=http://ip-api.com/json/{{ $json.body.ip }}",
        "method": "=GET",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "a6c774ad-9aa6-4b0b-8644-5966d7242907",
      "name": "Receive IP Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        440,
        220
      ],
      "webhookId": "76cf0099-b4e9-4446-a355-9fa85b72365d-unique-id",
      "parameters": {
        "path": "ip-lookup",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "ee2b27c2-a96f-432f-b950-fff3a8dab462",
      "name": "Respond with Geolocation Data",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1200,
        220
      ],
      "parameters": {
        "options": {},
        "respondWith": "allIncomingItems"
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "97ad1608-6a06-4b47-9faa-ee5c120232fc",
  "connections": {
    "0b4b792d-30fa-4f55-b96c-b9b88da026f0": {
      "main": [
        [
          {
            "node": "ee2b27c2-a96f-432f-b950-fff3a8dab462",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a6c774ad-9aa6-4b0b-8644-5966d7242907": {
      "main": [
        [
          {
            "node": "0b4b792d-30fa-4f55-b96c-b9b88da026f0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 构建模块, IT 运维

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量6
分类2
节点类型4
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
ist00dent

ist00dent

@ist00dent

I’m a dedicated automation engineer passionate about no-code and low-code solutions. I design and implement robust n8n workflows—integrating APIs, databases, and messaging—to eliminate manual tasks and accelerate delivery. Leveraging Python and C#, I build scalable, adaptable automations that empower teams to focus on high-value work.

外部链接
在 n8n.io 查看

分享此工作流

分类

分类: 34