公共模板 - 提取联系信息
这是一个Document Extraction、AI Summarization领域的自动化工作流,包含 9 个节点。主要使用 Code、Webhook、Agent、RespondToWebhook、LmChatOpenAi 等节点。 使用GPT-4将非结构化联系数据转换为JSON以便系统集成
- •HTTP Webhook 端点(n8n 会自动生成)
- •OpenAI API Key
{
"id": "Q94SsUmoQurlkhBF",
"meta": {
"instanceId": "5fca925b7f5fee37b74ba655b45ab0489e585d45c16d619a3e83393dbcbcc868",
"templateCredsSetupCompleted": true
},
"name": "公共模板 - 提取联系信息",
"tags": [],
"nodes": [
{
"id": "d5432499-566f-4829-9aa7-dc74ce6f2275",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-176,
0
],
"webhookId": "262381d7-e1a0-4123-9c78-be3487872a5d",
"parameters": {
"path": "contact_data_converter",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "fc8b683a-2069-4823-8220-d7eb3592e42f",
"name": "响应 Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
928,
0
],
"parameters": {
"options": {}
},
"typeVersion": 1.3
},
{
"id": "7af49992-dbe3-4034-adc9-ca1b8fd523da",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
112,
0
],
"parameters": {
"text": "=Extract the following fields from the input text. Follow these rules strictly:\n\n**EXTRACTION RULES:**\n1. Only extract information that is explicitly stated in the text\n2. Do not infer, guess, or make assumptions\n3. If a field is missing, ambiguous, or uncertain, leave it as an empty string \"\"\n4. Extract information exactly as written (preserve original formatting for addresses, phone numbers, etc.)\n5. For names: only extract if clearly identified as a person's name (not just any name in the text)\n6. For company names: look for business names, organization names, or company identifiers\n\n**FIELD DEFINITIONS:**\n- **company_name**: Business or organization name\n- **tel**: Phone/telephone number (any format)\n- **fax**: Fax number (any format)\n- **email**: Email address\n- **first_name**: Person's first/given name\n- **last_name**: Person's last/family name\n- **address**: Street address or mailing address\n- **zipcode**: Postal/ZIP code\n- **city**: City name\n- **country**: Country name\n- **website**: Website URL or domain\n\n**OUTPUT FORMAT:**\nReturn only valid JSON with exactly these keys (no additional text or explanation):\n\n{\n \"company_name\": \"\",\n \"tel\": \"\",\n \"fax\": \"\",\n \"email\": \"\",\n \"first_name\": \"\",\n \"last_name\": \"\",\n \"address\": \"\",\n \"zipcode\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"website\": \"\"\n}\n\n**INPUT TEXT:**\n{{ $json.body.prompt }}\n\n\n",
"options": {},
"promptType": "define"
},
"typeVersion": 2.1
},
{
"id": "dfe113b0-8259-4432-a672-7b8f2b29c250",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
608,
0
],
"parameters": {
"jsCode": "return items.map(item => {\n let jsonStr = item.json.output;\n jsonStr = jsonStr.replace(/^```json\\n?/, '').replace(/\\n?```$/, '');\n \n try {\n const parsed = JSON.parse(jsonStr);\n return {\n json: {\n output: parsed\n }\n };\n } catch (error) {\n throw new Error('Invalid JSON string: ' + error.message);\n }\n});\n"
},
"typeVersion": 2
},
{
"id": "857a4ac8-0dc8-4e11-b5f2-b5c64868b121",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
112,
272
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-nano",
"cachedResultName": "gpt-4.1-nano"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "",
"name": ""
}
},
"typeVersion": 1.2
},
{
"id": "0a79b2ec-67f9-4e4d-9303-d3e34f9bfd3d",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
-304
],
"parameters": {
"width": 480,
"height": 480,
"content": "## 联系数据转换器 – 非结构化文本到 JSON 用于系统集成"
},
"typeVersion": 1
},
{
"id": "50fc716f-d92c-4a52-91ee-6ced006dda1e",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-272,
-192
],
"parameters": {
"color": 4,
"width": 288,
"height": 368,
"content": "此 webhook 作为工作流的入口点。"
},
"typeVersion": 1
},
{
"id": "485ce0f8-4259-4419-8fe6-8ce70fcbb0f6",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-304
],
"parameters": {
"color": 4,
"width": 336,
"height": 480,
"content": "此节点使用 AI 代理从非结构化输入文本中提取结构化的联系信息。"
},
"typeVersion": 1
},
{
"id": "08d1216e-fe9b-48d7-863f-30cafcb82936",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-304
],
"parameters": {
"color": 4,
"width": 352,
"height": 480,
"content": "此节点处理来自 AI 代理的原始输出,并确保它是有效的 JSON 对象。"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "f7d4d1c1-58e3-473a-8c17-10f73ce81e49",
"connections": {
"Code": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于Document Extraction、AI Summarization等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Frankie Wong
@frankiewongWith over 10 years of experience in customizing open-source platforms like Dolibarr, WordPress, OpenCart and Shopify, I now specialize in building powerful and practical workflow automations and AI agents using n8n. Whether you're looking to save time, streamline operations, or integrate AI into your business processes, I create ready-to-use n8n templates designed to make automation easy. Based in Birmingham, UK
分享此工作流