{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ca1112b6-2db9-4182-b3a4-011eac63ab34",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -900,
        640
      ],
      "parameters": {
        "options": {},
        "formTitle": "Slideshare Downloader",
        "formFields": {
          "values": [
            {
              "fieldLabel": "URL",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Slideshare Downloader"
      },
      "typeVersion": 2.2
    },
    {
      "id": "e8db4cdb-3b2b-4919-b880-6e8ae74dae35",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -380,
        660
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bcc58e3d-9609-4ec3-adb9-bc6098205818",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": 200
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "862e0e4a-b985-4ea6-a0a5-38867127354c",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -40,
        900
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "00c8a3f1-75d9-4cee-b9d3-4e165900493b",
      "name": "Google Drive Set Permission",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        440,
        360
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "resource": "file",
        "operation": "share",
        "permissionsUi": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "8aaa5749-e46c-4c45-be76-dd9ccb60b2ab",
      "name": "Upload To Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        140,
        360
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1d0c1eb4-abc0-48ff-99a9-4b561bd0e732",
      "name": "Google Sheets Append Row",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        440,
        900
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "cb7d10f9-a481-41d3-bbbb-fd0776479681",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        360
      ],
      "parameters": {
        "height": 500,
        "content": "## \ud83d\udfe2 **1. On form submission**\n- **Purpose:** Acts as the trigger for the workflow.  \n- **Functionality:** Displays a form with a single field (`URL`) where users can enter the  slideshare link.  \n- **Output:** Passes the entered URL to the next node for processing."
      },
      "typeVersion": 1
    },
    {
      "id": "bdc9b56b-d0a4-417b-b62f-a85eb0513667",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        360
      ],
      "parameters": {
        "height": 500,
        "content": "## \ud83c\udf10 **2. SlideShare Downloader**\n- **Purpose:** Fetch downloadable slideshare link.  \n- **Functionality:** Sends a `POST` request to **RapidAPI Slideshare Downloader Pro API**, passing the URL from the form.  \n- **Output:** Receives a JSON response containing downloadable pdf link.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2d70f2ec-5afb-44e0-bc9a-2363e220c488",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        360
      ],
      "parameters": {
        "height": 500,
        "content": "## \ud83d\udd0d **3. If**\n- **Purpose:** Check for API errors.  \n- **Functionality:** Evaluates if the response contains an `status` field.  \n- **Output:** \n  - \u2705 **True Path:** Proceeds to download the pdf.  \n  - \u274c **False Path:** Goes to error handling (Wait + Sheets logging).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "134e5d6d-3985-4ec7-af1a-3b853957d671",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        120
      ],
      "parameters": {
        "height": 440,
        "content": "## \u2b07\ufe0f **4. Download pdf**\n- **Purpose:** Download the pdffile.  \n- **Functionality:** Uses the media URL from the previous API response to download the pdf file.  \n- **Output:** Stores the raw pdf binary for upload.\n\n-"
      },
      "typeVersion": 1
    },
    {
      "id": "6f609d65-ca98-4a09-8cb3-67fc15489faa",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        120
      ],
      "parameters": {
        "height": 400,
        "content": "## \u2601\ufe0f **5. Upload To Google Drive**\n- **Purpose:** Store pdfin Google Drive.  \n- **Functionality:** Uploads the downloaded pdf into the specified Drive folder.  \n- **Output:** Returns a file ID for the uploaded file.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e55bf6b2-69ff-4454-a27c-6e758dd16835",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        120
      ],
      "parameters": {
        "height": 380,
        "content": "## \ud83d\udd11 **6. Google Drive Set Permission**\n- **Purpose:** Make the file publicly accessible.  \n- **Functionality:** Sets file permissions to `Anyone with the link can view`.  \n- **Output:** Provides a sharable `webViewLink`.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "31788160-dcd4-436e-95a9-5c1de255e329",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        660
      ],
      "parameters": {
        "height": 360,
        "content": "## \u23f1\ufe0f **8. Wait**\n- **Purpose:** Delay before logging failures.  \n- **Functionality:** Pauses workflow execution to avoid instant sheet logging when API errors occur.  \n- **Output:** Prevents rapid consecutive writes to Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "209f58a8-b1c1-443c-9d55-d878c0749645",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        540
      ],
      "parameters": {
        "height": 480,
        "content": "## \ud83d\udcd1 **9. Google Sheets Append Row**\n- **Purpose:** Log failed conversions.  \n- **Functionality:** Appends a row with:\n  - `URL` \u2192 Original Slideshare link  \n  - `Drive_URL` \u2192 `N/A` (indicating download failure)  \n- **Output:** Tracks failed attempts separately.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b5fd3005-1840-4e4e-b167-1d32da24b5e2",
      "name": "Slideshare downloader",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -680,
        640
      ],
      "parameters": {
        "url": "https://slideshare-downloader-pro.p.rapidapi.com/slideshare.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $json.URL }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "slideshare-downloader-pro.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3b57d69b-ddd1-4874-a1ce-3b2b1f681910",
      "name": "Download Pdf",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -120,
        380
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "0ad5e3c5-7398-4f6e-b599-b5f8ee3ce1b3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1980,
        260
      ],
      "parameters": {
        "width": 960,
        "height": 960,
        "content": "# Slideshare Downloader Automation\n\n## Description:\nThis workflow automates the process of downloading Slideshare presentations and uploading them to Google Drive. \n\n### Steps:\n1. **On Form Submission**: \n   - Displays a form where users enter the Slideshare URL.\n   \n2. **Slideshare Downloader**:\n   - Fetches the download link for the Slideshare presentation using the RapidAPI Slideshare Downloader Pro API.\n   \n3. **If**:\n   - Checks if the API response is successful (status 200).\n     - **True Path**: Continues to download the PDF.\n     - **False Path**: Waits before logging the error and adds the details to Google Sheets.\n   \n4. **Download PDF**:\n   - Downloads the PDF file using the media URL provided by the Slideshare API response.\n   \n5. **Upload to Google Drive**:\n   - Uploads the downloaded PDF file to Google Drive in the specified folder.\n   \n6. **Google Drive Set Permission**:\n   - Sets the file's sharing permissions to \"Anyone with the link can view\", making it publicly accessible.\n\n7. **Wait**:\n   - Pauses the workflow for a specified duration to avoid rapid consecutive writes in case of errors.\n   \n8. **Google Sheets Append Row**:\n   - Logs failed conversion attempts in Google Sheets, including the original URL and an \"N/A\" for the failed file.\n\n---\n\n### Features:\n- **Error Handling**: If the API request fails, the error is logged and managed through a delay to prevent multiple rapid entries in the logs.\n- **Google Drive Integration**: Ensures the downloaded presentations are safely stored and easily accessible.\n- **Google Sheets Logging**: Tracks failed attempts for later review.\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Download Pdf",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets Append Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Pdf": {
      "main": [
        [
          {
            "node": "Upload To Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Slideshare downloader",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slideshare downloader": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload To Google Drive": {
      "main": [
        [
          {
            "node": "Google Drive Set Permission",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}