Create invoice and ASN records from incoming cXML
When a supplier sends a cXML invoice or ship notice, the raw file is saved to Drive and a matching row is logged in your invoice table, with ASN paperwork generated.
Install it
Set up this Zap for me, read how here: https://zapier.sh/zapier/awesome-zaps/create-invoice-and-asn-records-from-incoming-c-xml/
Paste into Claude, ChatGPT, Cursor or any agent.
- Category
- Finance · Accounts payable
- Author
- Zapier
- Source
- zapier/awesome-zaps, folder zaps/create-invoice-and-asn-records-from-incoming-c-xml
Set it up with the CLI
- Add it. Copies the folder into
zaps/create-invoice-and-asn-records-from-incoming-c-xml/. Outside a project, it makes one first.npx zap-pack add awesome-zaps/create-invoice-and-asn-records-from-incoming-c-xml - Fill in the values in
config.ts, and in any other file the list marks. Replace each one as its comment and SKILL.md say. - Deploy it. Asks for any value still left, signs you in to Zapier if you aren't, then publishes it to your account.
npx zap-pack deploy create-invoice-and-asn-records-from-incoming-c-xml - Check it. Its recent runs, with status and errors.
npx zap-pack logs create-invoice-and-asn-records-from-incoming-c-xml
zaps/create-invoice-and-asn-records-from-incoming-c-xml/
- README.mdWhat it does, for people
- SKILL.mdHow an agent sets it up: what to ask you, and how to test it
- config.tsIts settings 4 to fill in
- connections/google-drive.tsThe
google-driveaccount it uses - connections/pdffiller.tsThe
pdffilleraccount it uses - connections/xero.tsThe
xeroaccount it uses - connections/zapier-tables.tsThe
zapier-tablesaccount it uses - triggers/hook-raw.tsWhat starts it:
webhookhook_raw - workflow.tsThe code; each
ctx.stepis a step in the Zap
Agents: add --yes to any command so it never prompts. When it needs an answer only the user can give, it stops and names the flag that supplies it.
SKILL.md
View MarkdownWhat it does
- Trigger: a raw cXML packet arrives at a Webhooks by Zapier catch hook (
webhook,hook_raw). - Code reads the message type from the root element (
InvoiceDetailRequestis Invoice,ShipNoticeRequestis ASN,ConfirmationRequestis POAck) and pulls the order reference, the invoice or confirmation ID, the first amount, and the tax and ship-to cities. - Google Drive saves the raw XML as a new file in your folder, named with the message type, order reference and a timestamp.
- Zapier Tables looks for a row with the same order reference and invoice ID. If there is none, it creates one with the file link.
- Xero looks up the invoice by ID for Invoice messages.
- pdfFiller downloads your ASN template for ASN messages. POAck messages stop after the table row.
The Zap never creates invoices in Xero, and it leaves a matched table row unchanged.
Ask the user
Each REPLACE_… value is set per person. Resolve names to IDs with the user's own connections; don't ask them to paste an ID you can look up.
| Setting | What goes there |
|---|---|
DRIVE_FOLDER_ID |
The Google Drive folder where each raw cXML file is saved, named by the user and looked up with their Google Drive connection |
TABLE_ID |
The Zapier Table with one row per invoice or ASN. It needs these fields: order_reference, invoice_id, message_type, amount (number), tax_city, ship_city, file_link |
XERO_ORGANIZATION |
The Xero organization that holds the invoices, by name or ID |
ASN_TEMPLATE_ID |
The pdfFiller document ID of the ASN PDF template |
Also review the defaults with them: a matched row is left unchanged, and a POAck (order confirmation) is only logged to the table.
Build it
If you can run shell commands, set it up with zap-pack: run npx zap-pack add awesome-zaps/create-invoice-and-asn-records-from-incoming-c-xml, replace each REPLACE_… value as this file says, then run npx zap-pack deploy create-invoice-and-asn-records-from-incoming-c-xml, which signs the user in to Zapier when it gets there. Otherwise build with Zapier MCP, as the steps below say. No Zapier MCP tools? Read https://docs.zapier.com/mcp/get-started/quickstart.md and follow the page for the app you are running in to get the user connected, then continue with this build.
- Accounts: bind
google-driveto the Google Drive connection for the account that owns the invoice folder,zapier-tablesto the Zapier Tables connection that owns the invoice table,xeroto the Xero connection for the organization that holds the invoices, andpdffillerto a pdfFiller connection that can see the ASN template. Webhooks by Zapier needs no connection. - Source: publish
workflow.tsandconfig.ts, with eachREPLACE_…replaced by the user's answer.triggers/hook-raw.tsandconnections/are settings, not code: set the workflow's trigger and connection bindings from them. The trigger file names the app by its slug; for the trigger'sselected_api, callsearch_triggerswith that slug, find the row whosekeyis the trigger'sevent, and use<app_key>@<app_version>from it. - Build guide: load Zapier's build guide with
get_zapier_skill("zapier:build-workflows")and follow it to create, test and publish the workflow. - Fields: inspect each action's fields with the user's connections and sample the trigger, if it has one, before the first test run, and fix any key in
workflow.tsthat doesn't match.
Test it
Run it once as a draft test with this sample as its input, after the connections are bound. Use only a test invoice, named with [install-test]:
<cXML payloadID="[install-test]-1" timestamp="2026-10-29T10:00:00-07:00">
<Request>
<InvoiceDetailRequest>
<InvoiceDetailRequestHeader invoiceID="[install-test]-INV-1001" invoiceDate="2026-10-29T10:00:00-07:00" purpose="standard" operation="new">
<InvoiceDetailOrderInfo><OrderReference orderID="[install-test]-PO-5001"/></InvoiceDetailOrderInfo>
<InvoiceDetailSummary><NetAmount><Money currency="USD">100.00</Money></NetAmount></InvoiceDetailSummary>
<Tax><Money currency="USD">8.00</Money><TaxDetail><TaxLocation><City>Austin</City></TaxLocation></TaxDetail></Tax>
<ShipTo><Address><City>Denver</City></Address></ShipTo>
</InvoiceDetailRequestHeader>
</InvoiceDetailRequest>
</Request>
</cXML>
Check that one new row appears in the table with message_type Invoice, order_reference and invoice_id set, amount 100.00, and the file link filled. Check that one raw file appears in the Drive folder with the test invoice's XML. If run-status tools aren't available, check the result in Zapier Tables and Google Drive directly. Ask the user to delete the test row and file, not the agent.
Notes
- For unmatched orders, extend the Zap to look up the order in Zoho CRM and email sales or procurement.
- To look up regional tax rates for the tax city, extend the Xero step.
- The spec's Sub-Zap is built as steps in the same workflow, not a separate workflow.
- pdfFiller's download action returns the blank template and does not fill it from the cXML, so the ASN PDF will not contain the shipment data until a fill step is added.
- The first
Moneyvalue in the file is used as the amount, which can be a line item rather than the invoice total. - Never commit real Drive, Table, Xero or pdfFiller IDs.