8
n8n 中文网amn8n.com

通过iOS自动化的地理围栏学生活动跟踪器

中级

这是一个Miscellaneous领域的自动化工作流,包含 15 个节点。主要使用 If, Set, Webhook, EmailSend, HttpRequest 等节点。 使用iOS自动化、Google Sheets和邮件提醒跟踪学生到达情况

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "88ia1RcNZ7aDAGZP",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "通过 iOS 自动化的地理围栏学生活动跟踪器",
  "tags": [],
  "nodes": [
    {
      "id": "28447b9c-fdd0-4588-82e0-54d4d65c8ca9",
      "name": "位置更新 Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1600,
        -120
      ],
      "webhookId": "a2fdee89-88b4-4031-aec9-367de8d16ea7",
      "parameters": {
        "path": "student-location",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "a88c48d7-d3f5-4413-9ff6-b461cdbe1152",
      "name": "处理位置数据",
      "type": "n8n-nodes-base.set",
      "position": [
        -1380,
        -120
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "student_name",
              "value": "={{ $json.body.student_name }}"
            },
            {
              "name": "student_id",
              "value": "={{ $json.body.student_id }}"
            },
            {
              "name": "location_name",
              "value": "={{ $json.body.location_name }}"
            },
            {
              "name": "activity_type",
              "value": "={{ $json.body.activity_type }}"
            },
            {
              "name": "latitude",
              "value": "={{ $json.body.latitude }}"
            },
            {
              "name": "longitude",
              "value": "={{ $json.body.longitude }}"
            },
            {
              "name": "timestamp",
              "value": "={{ $now.format('yyyy-MM-dd HH:mm:ss') }}"
            },
            {
              "name": "date",
              "value": "={{ $now.format('yyyy-MM-dd') }}"
            },
            {
              "name": "time",
              "value": "={{ $now.format('HH:mm') }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "1f15187f-8602-4ba2-a3fb-7b5a8828c4cb",
      "name": "学生到达了吗?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1160,
        -120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false
          },
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.activity_type }}",
              "rightValue": "arrived"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "856b5882-61c2-451c-ab3f-8d2750ecc564",
      "name": "记录学校到达",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -940,
        -120
      ],
      "parameters": {
        "url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_SHEET_ID/values/Activities:append?valueInputOption=RAW",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleSheetsOAuth2Api"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "rgIk6EXVdPbmPYAl",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "30800230-2d9c-47c6-b972-13328eef51ff",
      "name": "在学校吗?",
      "type": "n8n-nodes-base.if",
      "position": [
        -720,
        -120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "caseSensitive": false
          },
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.location_name }}",
              "rightValue": "School Campus"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "be6abf64-49da-496d-9e83-132b4aafd92c",
      "name": "通知老师",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -500,
        -220
      ],
      "webhookId": "a1e93108-3bdc-4d9c-8143-9f75c6991d17",
      "parameters": {
        "options": {},
        "subject": "Student Arrival Alert",
        "toEmail": "teacher@google.com",
        "fromEmail": "admin@google.com"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "a9e2767f-fd26-40d2-8b01-d6b6dd07dd53",
      "name": "通知家长",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -500,
        -20
      ],
      "webhookId": "3b0dd9a5-a06a-434d-9971-b246acdd5f2f",
      "parameters": {
        "options": {},
        "subject": "Your Child's Location Update",
        "toEmail": "parent@google.com",
        "fromEmail": "admin@google.com"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8bf469fa-cb45-46f5-93e8-a31cec898dc8",
      "name": "成功响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -280,
        -120
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n  \"success\": true,\n  \"message\": \"Location updated for {{ $('Process Location Data').item.json.student_name }}\",\n  \"location\": \"{{ $('Process Location Data').item.json.location_name }}\",\n  \"time\": \"{{ $('Process Location Data').item.json.time }}\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "11654022-f76a-4c16-9572-83890d5feb53",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1640,
        -260
      ],
      "parameters": {
        "color": 6,
        "width": 180,
        "height": 320,
        "content": "当学生位置更新时通过 iOS 快捷方式触发"
      },
      "typeVersion": 1
    },
    {
      "id": "cb2c8940-f1d1-493e-949c-a98ffd13b723",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1400,
        -260
      ],
      "parameters": {
        "width": 180,
        "height": 320,
        "content": "提取坐标和元数据"
      },
      "typeVersion": 1
    },
    {
      "id": "5aff6f9d-a92a-4f9e-803b-4d948a848b50",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1180,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 180,
        "height": 320,
        "content": "检查学生是否进入学校区域"
      },
      "typeVersion": 1
    },
    {
      "id": "8d738c70-8bf6-4989-b18b-34c333a54d19",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -260
      ],
      "parameters": {
        "color": 3,
        "width": 180,
        "height": 320,
        "content": "将到达数据添加到 Google Sheet"
      },
      "typeVersion": 1
    },
    {
      "id": "efea3574-c4fc-44cd-a0bc-42d1bfc2c297",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        -260
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 320,
        "content": "在通知前双重检查地理围栏条件"
      },
      "typeVersion": 1
    },
    {
      "id": "2bc11c73-917f-4764-8838-f2f5747642bd",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -260
      ],
      "parameters": {
        "color": 4,
        "width": 180,
        "height": 320,
        "content": "返回 200 响应给触发设备"
      },
      "typeVersion": 1
    },
    {
      "id": "220a1498-beea-48b8-adc7-58b84b7e811a",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -400
      ],
      "parameters": {
        "width": 180,
        "height": 540,
        "content": "如果学生确认在学校则发送邮件"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "73bbead3-571c-45fb-87e8-19ed76748150",
  "connections": {
    "At School?": {
      "main": [
        [
          {
            "node": "Notify Teacher",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Parent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Parent": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Teacher": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Student Arrived?": {
      "main": [
        [
          {
            "node": "Log School Arrival",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Log School Arrival": {
      "main": [
        [
          {
            "node": "At School?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Location Data": {
      "main": [
        [
          {
            "node": "Student Arrived?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Location Update Webhook": {
      "main": [
        [
          {
            "node": "Process Location Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 杂项

需要付费吗?

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

工作流信息
难度等级
中级
节点数量15
分类1
节点类型7
难度说明

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

作者
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

外部链接
在 n8n.io 查看

分享此工作流