Skip to main content
Automate invoice collection from any vendor portal. This cookbook creates a workflow that takes in a vendor portal URL, logs in using saved credentials, finds order history, filters by date and finally downloads and emails the invoices as PDFs.

What you’ll build

A workflow that:
  1. Logs into a customer account portal
  2. Navigates to order history and filters by date
  3. Extracts order metadata from the page
  4. Downloads invoice PDFs for each order
  5. Parses invoice data from each PDF
  6. Emails a summary with PDFs attached

Prerequisites

Install the SDK:
pip install skyvern
Set your API key:
export SKYVERN_API_KEY="your-api-key"

Sample Vendor Portal

We’ll use Ember Roasters, a fake coffee retailer website created for agent automation testing. Change portal_url to use your vendor’s portal URL.
FieldValue
URLhttps://ember—roasters.vercel.app/
Login emaildemo@manicule.dev
Login passwordhelloworld
Ember Roasters, a demo coffee vendor portal

Step 1: Store credentials

Before defining the workflow, store the login email and password Skyvern will use. This keeps secrets out of your workflow definition and away from LLMs.
1

Open Credentials

Go to Credentials in the sidebar. Choose Password after clicking on + Add.Creating a password credential on Skyvern
2

Create a credential

Click Create Credential. Set the name to Vendor Portal, add login page URL, and enter the username (demo@manicule.dev) and password (helloworld). Click Save.Fill username and password to add a credential to Skyvern
3

Copy the credential ID

Copy the credential ID (here: cred_504291305450505900). You’ll use this when configuring the workflow.Fill username and password to add a credential to Skyvern

Step 2: Create a new workflow

1

Create the workflow

Go to WorkflowsCreate Workflow. Name it “Bulk Invoice Downloader”.Create a new workflow from Skyvern Dashboard
2

Configure the Start node

Click the Start node. Set Proxy Location to Residential.

Set parameters

Parameters are the inputs your workflow accepts. Defining them upfront lets you reuse the same workflow against different portals, date ranges, or recipients.
On the Start node, add the following parameters:
ParameterTypeNotes
portal_urlStringVendor portal login URL
start_dateStringFilter start date
end_dateStringFilter end date
recipient_emailStringEmail recipient for the summary
credentialsCredential IDSelect the credential you created in Step 1
Setting input parameters in a workflow in Skyvern
SMTP parameters are configured automatically by Skyvern Cloud. For self-hosted deployments, add them as AWS Secret parameters.

Step 3: Add workflow blocks

The workflow chains together several blocks to automate the full invoice collection process:
  1. Login block — Authenticates to the vendor portal using stored credentials
  2. Navigation block — Navigates to order history and applies date filters
  3. Extraction block — Extracts order metadata from the filtered results
  4. For loop + File download — Iterates over each order and downloads its invoice PDF
  5. For loop + File parser — Parses each downloaded PDF to extract structured data
  6. Send email — Sends a summary with PDFs attached to the recipient
In the Cloud UI, click the + button after the Start node to add blocks sequentially. For SDK users, add each block to the blocks array in your workflow definition file.

Login block

The login block authenticates using stored credentials. Skyvern injects the username/password directly into form fields without exposing them to the LLM.
Add a Login block. Configure it as follows:
  • URL: set to the portal_url parameter
  • Credential: Select the credentials parameter
  • Goal: “Log in using the provided credentials. Handle any cookie consent popups. COMPLETE when on the account dashboard or orders page.”
  • In Advanced Settings, enable Error Messages and add:
    • INVALID_CREDENTIALS: “Login failed - incorrect email or password”
    • ACCOUNT_LOCKED: “Account has been locked or suspended”
Adding a block in a workflow in Skyvern
Why error_code_mapping? It surfaces specific failures in your workflow output, so you can handle “wrong password” differently from “account locked.” Navigate to the orders page and apply the date filter.
Add a Navigation block. Configure it as follows:
  • URL: Leave empty (continues from the current page after login)
  • Parameter Keys: Select start_date and end_date
  • Goal: “Navigate to Order History or My Orders. Filter orders between start_date and end_date. Click the Filter button. COMPLETE when filtered results are visible.”

Extraction block

Extract order metadata from the filtered results. The data_schema tells Skyvern exactly what structure to return.
Add an Extraction block. Configure it as follows:
  • Goal: “Extract all visible orders: order ID, date, total amount, and status.”
  • Data Schema: Paste the following JSON schema:
{
  "orders": {
    "type": "array",
    "items": {
      "type": "object",
      "properties": {
        "order_id": { "type": "string", "description": "Unique identifier for the order" },
        "date": { "type": "string", "description": "Date when the order was placed" },
        "total": { "type": "number", "description": "Total amount for the order" },
        "status": { "type": "string", "description": "Current status of the order" }
      },
      "required": ["order_id", "date", "total", "status"]
    }
  }
}
The output is accessible as data_extraction_block_output.orders in subsequent blocks.

Download invoices block

Iterate over each order and click its “Download Invoice” button. continue_on_failure: true ensures one failed download doesn’t stop the entire workflow.
Add a For Loop block. Set the Loop Variable to data_extraction_block_output.orders. Enable Continue on Failure and Next Loop on Failure.Inside the loop, add a File Download block:
  • Goal: “Find order (current order ID). Click Download Invoice. COMPLETE when the PDF download starts.”
  • Download Suffix: invoice_(order_id).pdf
Key pattern: Inside a loop, current_value gives you the current item being iterated over.

Parse invoices block

Use file_url_parser to extract structured data from each downloaded PDF.
Add another For Loop block. Set the Loop Variable to data_extraction_block_output.orders. Enable Continue on Failure and Next Loop on Failure.Inside the loop, add a File URL Parser block:
  • File URL: SKYVERN_DOWNLOAD_DIRECTORY/invoice_(order_id).pdf
  • File Type: PDF
  • JSON Schema: Paste the following:
{
  "type": "object",
  "properties": {
    "invoice_id": { "type": "string", "description": "Unique identifier for the invoice" },
    "amount": { "type": "number", "description": "Total amount of the invoice" },
    "date": { "type": "string", "description": "Date of the invoice, typically in YYYY-MM-DD format" }
  },
  "required": ["invoice_id", "amount", "date"]
}
The output is accessible as for_2_block_output in subsequent blocks.

Email block

Send a summary email with PDFs attached.
Add a Send Email block. Configure it as follows:
  • Sender: hello@skyvern.com
  • Recipients: set to the recipient_email parameter
  • Subject: “Ember Roasters Invoices from (start_date) to (end_date)”
  • Body: set to the for_2_block_output variable
  • File Attachments: SKYVERN_DOWNLOAD_DIRECTORY

Complete workflow

Here’s a summary of the complete workflow you’ve built in the visual editor:
1

Create the workflow

Go to Workflows and click Create Workflow. Name it “Bulk Invoice Downloader.” On the Start node, set Proxy Location to Residential and add the parameters: portal_url, start_date, end_date, recipient_email, and credentials.
2

Block 1: Login

Add a Login block. Set URL to the portal_url parameter. Select the credentials parameter. Set the goal: “Log in using the provided credentials. Handle any cookie consent popups. COMPLETE when on the account dashboard or orders page.” In Advanced Settings, add error messages for INVALID_CREDENTIALS and ACCOUNT_LOCKED.
3

Block 2: Navigation — filter orders

Add a Navigation block. Leave URL empty (continues from login). Add start_date and end_date as parameter keys. Set the goal: “Navigate to Order History or My Orders. Filter orders between start_date and end_date. Click the Filter button. COMPLETE when filtered results are visible.”
4

Block 3: Extraction — order metadata

Add an Extraction block. Set the goal: “Extract all visible orders: order ID, date, total amount, and status.” Paste the orders JSON schema into Data Schema.
5

Block 4: For Loop — download invoices

Add a For Loop block. Set Loop Variable to data_extraction_block_output.orders. Enable Continue on Failure and Next Loop on Failure. Inside the loop, add a File Download block with goal: “Find order (current order ID). Click Download Invoice. COMPLETE when the PDF download starts.” Set Download Suffix to invoice_(order_id).pdf.
6

Block 5: For Loop — parse invoices

Add another For Loop block with the same loop variable. Inside the loop, add a File URL Parser block. Set File URL to SKYVERN_DOWNLOAD_DIRECTORY/invoice_(order_id).pdf, File Type to PDF, and paste the invoice JSON schema.
7

Block 6: Send Email

Add a Send Email block. Set Sender to hello@skyvern.com, Recipients to the recipient_email parameter, Subject to “Ember Roasters Invoices from (start_date) to (end_date)”, Body to for_2_block_output, and File Attachments to SKYVERN_DOWNLOAD_DIRECTORY.

Step 4: Run and monitor

Create the workflow from your definition file and execute it.
1

Run the workflow

Click Run in the workflow editor. Fill in the parameters:
  • portal_url: https://ember--roasters.vercel.app/
  • start_date: 2025-01-01
  • end_date: 2025-01-31
  • recipient_email: Your email address
  • credentials: Select the Vendor Portal credential
2

Monitor the run

Watch the run in real time. Each block shows its status as it executes. The browser recording is available after the run completes.

Resources

Workflow Blocks Reference

Complete parameter reference for all block types

Credential Management

Securely store and use login credentials

File Operations

Download, parse, and upload files in workflows

Error Handling

Handle failures and retries in production