Documentation Index
Fetch the complete documentation index at: https://mintlify.com/GabJS10/ScrappingSiigoCorprecam/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure you have:- Node.js 18.x or higher
- npm or pnpm package manager
- Siigo Nube account credentials with access to Corprecam (NIT 900142913) and/or Reciclemos (NIT 901328575)
- Ngrok authentication token (get one at ngrok.com)
- Access to the Corprecam administrative API endpoints
Installation
Configure Environment Variables
Create a
.env file in the project root with the following configuration:.env
The database credentials are used by the PHP backend API endpoints. If you’re only testing the scraper functionality, you can use placeholder values.
Test the Scraper
Once the server is running, test it with a purchase order:Using curl
Using Postman
Set Request Body
Choose “raw” format and enter:Replace
12345 with a valid purchase order code from your Corprecam system.What Happens Behind the Scenes
When you POST to/scrapping, the system:
-
Fetches Purchase Order Data from the Corprecam PHP backend:
-
Transforms Data into a structured format:
-
Executes Playwright Automation for each company with items:
- Returns Success Response after all documents are created.
Understanding the Response Flow
Successful Execution
Error Scenarios
If the scraper encounters errors (e.g., invalid credentials, network issues, or Siigo UI changes), the process will retry operations automatically using theretryUntilSuccess utility.
Check the server console logs for detailed execution information. Each major step logs progress messages.
Configuration Details
Port Configuration
The server listens on port 3000 by default. Change it in.env:
Document Type Code
The scraper uses document type code25470 for Documento Soporte. This is defined in main.ts:6:
Warehouse and Payment Accounts
Configured inmain.ts:8-11:
Note the spaces in the strings. These match the exact text in Siigo’s dropdown menus.
Company NITs
- Corprecam: 900142913
- Reciclemos: 901328575
main.ts:25 and main.ts:38.
Remote Access via Ngrok
The server automatically creates a public URL when it starts:setNgrok() function.
Next Steps
API Reference
Learn about request/response formats
Configuration
Customize warehouse, accounts, and document types
Troubleshooting
Debug common issues
Architecture
Understand the system design
Development Mode
Thenpm run dev command uses Node’s --watch flag for automatic reload on file changes:
.ts file and the server restarts automatically.
Verifying Installation
After starting the server, verify:- Server logs show
Server running on port 3000 - No error messages about missing dependencies
- Ngrok connection established (check Ngrok dashboard)
- Test request to
/scrappingopens Firefox window