N
n8n Store
Workflow Market
Summarize Text with RapidAPI and Log Results to Google Sheets

Summarize Text with RapidAPI and Log Results to Google Sheets

by evoortsolutions0 views

説明

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.ifn8n-nodes-base.setn8n-nodes-base.waitn8n-nodes-base.waitn8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNote
Price無料
Views0
最終更新11/28/2025
workflow.json
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752"
  },
  "nodes": [
    {
      "id": "e13b8f01-08cd-4b3d-adf6-516e119072a0",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -360,
        -40
      ],
      "webhookId": "ab29cc7f-74d7-41cf-9e85-a269f63237f2",
      "parameters": {
        "options": {},
        "formTitle": "Text Summerizer",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Title",
              "placeholder": "Enter title here",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Content",
              "placeholder": " Lorem ipsum dolor sit amet consectetur...",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Mode",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Paragraph"
                  },
                  {
                    "option": "Bullet"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Length",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Short"
                  },
                  {
                    "option": "Medium"
                  },
                  {
                    "option": "Long"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a6776021-3f9a-4b85-ae36-c1ead5801c91",
      "name": "Mapping",
      "type": "n8n-nodes-base.set",
      "position": [
        -140,
        -40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "787925a1-0ab8-4125-9e69-6603affcde26",
              "name": "Mode",
              "type": "string",
              "value": "={{ $json.Mode.toLowerCase() }}"
            },
            {
              "id": "829bcccd-540e-49b8-bf06-275f541ce06e",
              "name": "Length",
              "type": "string",
              "value": "={{ \n            $json.Length === 'Short' ? 1 : \n            $json.Length === 'Medium' ? 2 : \n            $json.Length === 'Long' ? 3 : \n            $json.Length \n          }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "73f4a1b6-ab7c-4c97-a9cc-463fb37601c3",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        140,
        -40
      ],
      "parameters": {
        "url": "https://text-summarizer-ai.p.rapidapi.com/text-summarizer.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={{ $json.Content }}"
            },
            {
              "name": "mode",
              "value": "={{ $json.Mode }}"
            },
            {
              "name": "length",
              "value": "={{ $json.Length }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "text-summarizer-ai.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8ead6257-5eba-4194-ba23-461a8e43b7c1",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        500,
        -260
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1dbef07d-c374-4d83-8410-e7f330b5debe",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.summary }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f46e4239-2fb0-4546-9b93-5708157a2e41",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1140,
        -280
      ],
      "parameters": {
        "columns": {
          "value": {
            "Mode": "={{ $('On form submission').item.json.Mode }}",
            "Title": "={{ $('On form submission').item.json.Title }}",
            "Length": "={{ $('On form submission').item.json.Length }}",
            "Summary": "={{ $json.summary }}",
            "Generated date": "={{ $('On form submission').item.json.submittedAt }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Length",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Length",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generated date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Generated date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a560e102-bc4d-418f-80c1-9546b3be37e9",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        740,
        -340
      ],
      "webhookId": "2949f8d2-5f08-45d1-a491-070cb768718f",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b296c61b-7144-4db0-955d-a945f7dcbdc0",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1560,
        60
      ],
      "parameters": {
        "columns": {
          "value": {
            "Mode": "={{ $('On form submission').item.json.Mode }}",
            "Title": "={{ $('On form submission').item.json.Title }}",
            "Length": "={{ $('On form submission').item.json.Length }}",
            "Summary": "=Error occured. Please Try later",
            "Generated date": "={{ $('On form submission').item.json.submittedAt }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mode",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Length",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Length",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Generated date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Generated date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Title"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "8d01bee9-1037-4d16-a1df-6d5fa56bb498",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        880,
        60
      ],
      "webhookId": "daf80dbc-1b65-4b25-a00f-10fdc7fc8af1",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "9c0f5f35-ef11-45a8-9d8a-81f724a8a8e1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1420,
        -540
      ],
      "parameters": {
        "width": 720,
        "height": 1380,
        "content": "# Text Summarizer\n\nThis workflow allows users to input a block of text via a web form and receive a summarized version of that text using a third-party API. The result is then recorded in Google Sheets—success or failure.\n\n---\n\n## 📌 Overview\n\n| Feature               | Description                                   |\n|----------------------|-----------------------------------------------|\n| **Form Inputs**       | Title, Content, Mode (Paragraph/Bullet), Length (Short/Medium/Long) |\n| **Summarization API** | RapidAPI Text Summarizer                      |\n| **Output**            | Google Sheets (Success or Error Logging)     |\n\n---\n\n## 🧩 Node Descriptions (Single-line)\n\n| Node Name            | Description                                                       |\n|----------------------|-------------------------------------------------------------------|\n| **On form submission** | Triggers the workflow when the user submits the text summarization form. |\n| **Mapping**            | Formats the input data to match the API requirements.             |\n| **HTTP Request**       | Sends the text, mode, and length to the external summarization API. |\n| **If**                 | Checks if a valid summary was returned from the API.              |\n| **Wait**               | Adds a short delay before storing successful summaries.           |\n| **Google Sheets**      | Logs successful summaries to a Google Sheet.                      |\n| **Wait1**              | Adds a short delay before storing error information.              |\n| **Google Sheets1**     | Logs an error message to the Google Sheet if summarization fails. |\n\n---\n\n## 🔄 Workflow Logic\n\n1. **User fills out a form** with the Title, Content, Mode, and Length.\n2. The **formTrigger node** starts the workflow and captures the inputs.\n3. The **Mapping node** transforms inputs:\n   - `Mode` to lowercase.\n   - `Length` to a number (1 = Short, 2 = Medium, 3 = Long).\n4. The transformed data is sent via **HTTP Request** to a summarization API.\n5. The **If node** checks if a `summary` was returned.\n6. If successful:\n   - Wait briefly (`Wait`).\n   - Log the summary to **Google Sheets**.\n7. If failed:\n   - Wait briefly (`Wait1`).\n   - Log the error message to **Google Sheets1**.\n\n---\n\n## ✅ Benefits\n\n- Automates summarization using AI.\n- Keeps structured logs in Google Sheets.\n- Handles success and failure cases gracefully.\n- Easy to customize for different use cases.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5755da22-4505-4150-a47a-1fa8e6966253",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -280
      ],
      "parameters": {
        "height": 440,
        "content": "### 1. **On form submission**\n- **Purpose:** Acts as the trigger node for the workflow.\n- **Function:** Presents a form to the user with fields like `Title`, `Content`, `Mode` (Paragraph or Bullet), and `Length` (Short, Medium, Long). The workflow starts once the form is submitted.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "65a0720f-f654-4c68-abc7-c3404c8ee40d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -280
      ],
      "parameters": {
        "height": 440,
        "content": "### 2. **Mapping**\n- **Purpose:** Prepares and transforms input data for the API.\n- **Function:** Converts `Mode` to lowercase and maps `Length` to numeric values (`Short` → 1, `Medium` → 2, `Long` → 3). Also retains all original fields for downstream usage.\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "457c1715-76a2-404c-bad8-311432a130f4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -280
      ],
      "parameters": {
        "height": 440,
        "content": "### 3. **HTTP Request**\n- **Purpose:** Sends a request to the Text Summarizer API.\n- **Function:** Performs a `POST` request using the `multipart/form-data` format to the external API on RapidAPI. It includes the user-submitted text, mode, and length. Headers are added for authentication.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9d719cdb-5382-42bd-81fe-2e4e8435f5da",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -500
      ],
      "parameters": {
        "height": 420,
        "content": "\n### 4. **If**\n- **Purpose:** Decision point based on API response.\n- **Function:** Checks whether the API returned a `summary` field with non-empty content. If yes, the workflow proceeds with the success path; otherwise, it triggers the failure path.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c083b712-b06a-4aa4-a35d-2266ae0c8d4c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -520
      ],
      "parameters": {
        "height": 300,
        "content": "### 5. **Wait** (Success Path)\n- **Purpose:** Adds a pause before writing to the sheet (optional).\n- **Function:** Ensures proper data timing before updating the spreadsheet. May help in debugging or sequencing.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "60c471fd-4e59-4318-9e84-4a8b27cbf059",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -560
      ],
      "parameters": {
        "height": 440,
        "content": "### 6. **Google Sheets** (Success Path)\n- **Purpose:** Logs successful summary data.\n- **Function:** Appends or updates a row in a connected Google Sheet with the summary, title, selected mode, length, and the form submission date.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7ca7a3c2-82f9-4404-a554-fef3be31cabe",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -120
      ],
      "parameters": {
        "height": 340,
        "content": "### 7. **Wait1** (Error Path)\n- **Purpose:** Adds a pause before writing to the sheet on error.\n- **Function:** Similar to the first wait node but used on the failure path to ensure consistency.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b7e262ce-ea85-473c-9677-31102bed30cd",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1480,
        -180
      ],
      "parameters": {
        "height": 380,
        "content": "### 8. **Google Sheets1** (Error Path)\n- **Purpose:** Logs an error message to the spreadsheet.\n- **Function:** Appends or updates the Google Sheet with the same user data, but sets the summary as `\"Error occurred. Please try later\"` to notify of a failed API response.\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mapping": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流