8
n8n 中文网amn8n.com

使用 GST Insights API 和 Google Docs 生成自动化 GST 报告

中级

这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 Code, GoogleDocs, FormTrigger, HttpRequest 等节点。 使用 GST Insights API 和 Google Docs 生成自动化 GST 报告

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "65d335f8-a299-4dda-878e-523d5db7f3a5",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "20d3359d-25fd-4fa7-9ede-cad51d411309",
      "parameters": {
        "options": {},
        "formTitle": "GST Insight ",
        "formFields": {
          "values": [
            {
              "fieldLabel": "GST/PAN No",
              "requiredField": true
            }
          ]
        },
        "formDescription": "GST Insight"
      },
      "typeVersion": 2.2
    },
    {
      "id": "0cdb7cf1-7871-47fa-9992-526fd53ac990",
      "name": "Google文档",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        760,
        0
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $json.docContent }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "",
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "5a8d9986-1029-4592-9170-745e767ad0a9",
      "name": "重新格式化",
      "type": "n8n-nodes-base.code",
      "position": [
        460,
        0
      ],
      "parameters": {
        "jsCode": "// Data from input (assuming it's in $input.first().json)\nconst data = $input.first().json;\n\n// Prepare the data to populate the Word document\nconst companyDetails = [\n  { label: \"Company Name\", value: data.company_name },\n  { label: \"GST Number\", value: data.gst_number },\n  { label: \"State\", value: data.state },\n  { label: \"GST Code\", value: data.gst_details.stjCd },\n  { label: \"GST Type\", value: data.gst_details.dty },\n  { label: \"GST Location\", value: data.gst_details.stj },\n  { label: \"GSTIN\", value: data.gst_details.gstin },\n  { label: \"Status\", value: data.sts },\n  { label: \"Trade Name\", value: data.tradeNam },\n  { label: \"Supplier Address\", value: `${data.gst_details.adadr[0].addr.bnm}, ${data.gst_details.adadr[0].addr.loc}, ${data.gst_details.adadr[0].addr.st}, ${data.gst_details.adadr[0].addr.pncd}` },\n  { label: \"Private Address\", value: `${data.gst_details.pradr.addr.bnm}, ${data.gst_details.pradr.addr.loc}, ${data.gst_details.pradr.addr.st}, ${data.gst_details.pradr.addr.pncd}` },\n  { label: \"GST Update Date\", value: data.gst_details.lstupdt },\n  { label: \"Company Type\", value: data.gst_details.ctb },\n  { label: \"GST Registration Date\", value: data.gst_details.rgdt },\n  { label: \"E-invoice Status\", value: data.gst_details.einvoiceStatus }\n];\n\n// Create plain text formatted content\nlet docContent = `Company GST Details\\n\\n`;\n\n// Add each detail as plain text\ncompanyDetails.forEach(detail => {\n  docContent += `${detail.label}: ${detail.value}\\n`;\n});\n\n// Return content to output\nreturn [\n  {\n    json: {\n      docContent: docContent\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "b40b3b18-b6c4-4a62-83bc-7235326a2fcb",
      "name": "GST洞察",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        0
      ],
      "parameters": {
        "url": "https://gst-insights.p.rapidapi.com/index.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "pan",
              "value": "={{ $json[\"GST/PAN No\"] }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "gst-insights.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bb87bba0-52bc-4f5e-83d4-ef5bd0be6eac",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -780,
        -300
      ],
      "parameters": {
        "width": 540,
        "height": 740,
        "content": "## 流程概览:**GST数据集成与文档更新**"
      },
      "typeVersion": 1
    },
    {
      "id": "45989229-75e9-4868-87d1-d1f3ff7b2d80",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -180
      ],
      "parameters": {
        "height": 340,
        "content": "当用户提交GST/PAN表格时,此节点会触发工作流。"
      },
      "typeVersion": 1
    },
    {
      "id": "5d290097-7b44-4caf-a9e9-b1d2ccb95e4a",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -180
      ],
      "parameters": {
        "height": 340,
        "content": "向GST洞察API发送POST请求,根据提交的PAN检索GST详细信息。"
      },
      "typeVersion": 1
    },
    {
      "id": "9887c8a9-5b14-4868-bd68-a3d0748814a0",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        420,
        -180
      ],
      "parameters": {
        "height": 340,
        "content": "将API获取的数据重新格式化为纯文本格式以便插入文档。"
      },
      "typeVersion": 1
    },
    {
      "id": "4cc29dcf-a0bc-47d8-89bd-638d1ac39a41",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -180
      ],
      "parameters": {
        "height": 340,
        "content": "将API获取的数据重新格式化为纯文本格式以便插入文档。"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Reformat": {
      "main": [
        [
          {
            "node": "Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GST Insights": {
      "main": [
        [
          {
            "node": "Reformat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "GST Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 文档提取, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流