Interface

Blueprint

Slack message

Prerequisites
Before building this agent, you need to set up a Slack webhook to send the invoice data to a Slack channel. Follow the instructions in the Slack documentation to set up a webhook. The general steps are:- Go to Slack API and create a new app
- Select “From scratch” and provide a name for your app
- Choose the Slack workspace where you want to build the agent
- Navigate to “Incoming Webhooks” in the left sidebar of the new app and activate webhooks
- Click “Add New Webhook to Workspace” and select the channel where invoices should be posted. You might need administrator permissions to add a webhook to a channel, depending on your Slack workspace settings.
- Copy the webhook URL - you’ll need this for the HTTP request block. The webhook URL will look like:
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Agent overview
This agent processes invoices through the following steps:- User uploads a PDF invoice file
- File is uploaded to Writer Cloud storage
- PDF content is extracted and parsed
- AI extracts structured invoice data such as vendor, amounts, line items.
- Formatted invoice summary is sent to Slack
Build the UI
The agent’s UI contains a file input for uploading invoices and a submit button.
1
Add a file input
Drag a File Input block to the canvas. In the block’s configuration menu, update the following:
- Label:
Invoice
- Allowed file types:
.pdf
- Link variable under Binding:
invoice
invoice
state variable.2
Add a button to submit the request
Drag a Button block to the canvas. In the block’s configuration menu, update the following:
- Label:
Submit
Build the blueprint
The logic of the blueprint is as follows:- The UI Trigger block starts the agent when the user clicks the submit button
- The Add files to Writer Cloud block uploads the invoice file to cloud storage
- The Parse PDF block extracts text content from the uploaded file
- The Structured Output block processes the PDF text and extracts invoice data as JSON
- The HTTP Request block sends the structured data to Slack

1
Add a UI Trigger block
Drag a UI Trigger block to the canvas. In the block’s configuration menu, update the following:
- Component Id: select the Submit button from the dropdown
- Trigger:
wf-click
2
Add an Add files to Writer Cloud block
Drag an Add files to Writer Cloud block to the canvas. In the block’s configuration menu, update the following:
- Files:
@{invoice}
invoice
state variable to Writer Cloud storage.3
Add a Parse PDF block
Drag a Parse PDF tool block to the canvas. In the block’s configuration menu, update the following:
- File:
@{result.0.id}
4
Add a Structured Output block
Drag a Structured Output block to the canvas. In the block’s configuration menu, update the following:This processes the PDF text and extracts structured invoice data according to the JSON schema. The AI will identify and extract the relevant information from the invoice text.
- Prompt:
- Input:
@{result}
- Model:
Palmyra X5
- JSON Schema: The following is an example JSON schema for the structured output. You can use this as a starting point, or create your own schema based on the invoice format you’d like to extract.
5
Add an HTTP Request block to send to Slack
Drag an HTTP Request block to the canvas. In the block’s configuration menu, update the following:This sends a formatted message to Slack with the key invoice details. The message uses Slack’s block kit format to create a structured, readable invoice summary.
- Method:
POST
- URL: Your Slack webhook URL
- Body:
Preview the agent
Navigate to the Preview tab to test the agent. Upload a PDF invoice and click the Process Invoice button. The agent will upload the file, extract the invoice data, and send a summary to your configured Slack channel. You can see the agent’s progress in the Logs tab, including the extracted JSON data and the Slack API response. You should see a message in the Slack channel with the invoice data.
Add tool calling for invoice validation
You can enhance this agent by adding tool calling to validate invoices and flag potential issues. Here are some ways to extend the functionality:- Check for missing required fields like tax ID or payment terms
- Compare against previous invoices from the same vendor to detect price discrepancies
- Validate amounts against purchase orders and company spending policies
- Flag duplicate invoice numbers or unusual payment terms
- Verify vendor details against your approved vendor list
- Add a tool calling block after the structured output to analyze the extracted data
- Configure validation rules and checks in your custom Python code
- Update the Slack message to include any validation warnings or approvals
- Optionally trigger different workflows based on the validation results