Skip to main content

Overview

This n8n workflow demonstrates how to integrate Skop’s document extraction API into your automation pipelines. The workflow scrapes documents from websites, processes the results, and automatically uploads them to Google Drive. n8n Workflow Diagram

What This Workflow Does

  1. Input Collection: Accepts user inputs for website URL, search prompt, API key, and scraping parameters
  2. Job Creation: Creates a scraping job using the Skop API
  3. Status Monitoring: Polls the job status until completion with automatic retry logic
  4. Document Processing: Extracts individual documents from the results
  5. File Download: Downloads each document from the source URLs
  6. Cloud Storage: Uploads documents to Google Drive with organized naming

Getting Started with n8n

n8n is an open-source workflow automation tool that lets you connect different services and APIs.

Prerequisites

Installation

  1. Copy the workflow JSON below and import it into your n8n instance
  2. Configure your credentials and API keys
  3. Customize the workflow for your specific needs

n8n Workflow JSON

Copy and paste this JSON into n8n to import the complete workflow:

Workflow Configuration

Required Changes

Before running the workflow, you’ll need to update these key components:

1. API Key Configuration

2. Google Drive Setup

In the “Upload to Google Drive” node, update:
  • Folder ID: Replace YOUR_FOLDER_ID_HERE with your target Google Drive folder ID
  • Credentials: Configure your Google Drive OAuth2 credentials in n8n

3. Timing Adjustments

Modify wait times based on your typical job duration:
  • Initial Wait: Currently set to 2 minutes (node: “Wait for Processing”)
  • Retry Wait: Currently set to 10 seconds (node: “Wait and Retry”)

Node Breakdown

How the Code Works

1. Job Creation Flow

The workflow starts by collecting inputs and making a POST request to the Skop API:

2. Status Polling Logic

The workflow implements a polling pattern to check job completion:

3. Document Processing

A custom JavaScript function splits the document array for individual processing:

4. File Download and Storage

Each document is downloaded and uploaded to Google Drive with proper naming:

Customization Options

Error Handling

Add error handling nodes to manage API failures:
  • HTTP status code checks
  • Retry limits for failed downloads
  • Email notifications for workflow failures

Advanced Features

Extend the workflow with additional functionality:
  • Document Analysis: Add OCR or text extraction nodes
  • Content Filtering: Filter documents by size, date, or content
  • Multi-Destination Upload: Save to multiple cloud storage services
  • Slack Notifications: Send completion alerts to team channels

Scheduling

Set up automatic execution:
  • Cron Triggers: Run daily/weekly document collection
  • Webhook Triggers: Trigger from external systems
  • Manual Execution: Run on-demand from n8n interface

Best Practices

  1. API Key Security: Store API keys in n8n’s credential system, never hardcode them
  2. Rate Limiting: Add delays between API calls to respect rate limits
  3. Error Recovery: Implement proper error handling and retry logic
  4. Monitoring: Set up notifications for workflow failures
  5. Testing: Test with smaller document sets before production use

Troubleshooting

Common Issues

Job Never Completes
  • Increase timeout values in wait nodes
  • Check if the website is accessible
  • Verify your prompt is specific enough
Google Drive Upload Fails
  • Confirm Google Drive credentials are properly configured
  • Check folder permissions and folder ID validity
  • Ensure sufficient storage space
Download Errors
  • Some documents may require specific headers or authentication
  • Add retry logic for failed downloads
  • Check document URL accessibility

Support Resources