# Turn signed SignWell contracts into draft Xero invoices

> The moment a customer signs, the invoice is drafted in Xero with the right amount and due date, and your finance channel gets the details.

- Workflow type: code
- Services: SignWell, Xero, Slack Bot
- Categories: Finance, Operations
- Published: 2026-08-09

## What it does

- Watches for contracts that reach fully signed status in SignWell and picks them up the moment signing finishes.
- Reads the signer, the company, the agreed amount, the plan, and the payment terms straight off the signed document.
- Adds the customer to Xero if they are new, then raises the invoice as a draft with the due date worked out from the payment terms on the contract.
- Posts the customer, amount, due date, and reference into your finance channel in Slack so someone can approve and send.

## What you'll need

- A SignWell account where your contracts get signed
- A Xero organisation you can raise invoices in
- A Slack workspace with a finance channel to post into
- A naming convention for contracts, so billable paperwork can be told apart from NDAs and other documents

## Prompt

When a customer signs a contract in SignWell, I want the invoice raised in Xero the same minute, instead of waiting for someone to notice the signed document and key it into the accounting system by hand. Build this as a code workflow: every step is a fixed mapping from signed document fields to invoice fields, with no matching ambiguity.

Trigger the workflow with a webhook on the SignWell document_completed event. That is the event SignWell fires once every signer has finished, and it carries the id of the completed document.

Before doing anything else, check the document name against a contract naming pattern and stop the run if it does not match. Only billable paperwork should ever reach Xero, so NDAs, consent forms, and other non billable documents are ignored. Default the pattern to names containing Contract, Service Agreement, MSA, or Order Form, case insensitive, and keep it in one clearly marked place at the top of the workflow so it is easy to edit.

For documents that pass the filter, call SignWell Get Document with the document id from the webhook payload. Read the signer name, signer email, and company from the recipients, and read the completed field values off the document: the agreed amount, the plan, the billing term, and the payment terms. Note that fields on a SignWell document is a two dimensional array with one inner array per file, so flatten across the files and match values by their field label or api id rather than assuming a flat structure or a fixed position.

Then set up the customer in Xero. Look the contact up first with List Contacts filtered on the signer email so a repeat customer is reused rather than duplicated, and only call Create Contacts when there is no match. Use the company name from the document as the contact name when there is one and fall back to the signer name, and set the signer name and email as the contact's primary person. Every Xero call needs the tenant id of the target organisation.

Raise the invoice with Create Invoices as an accounts receivable invoice in DRAFT status, never approved or sent, so a human approves it before it reaches the customer. Build the line item from the plan and the agreed amount read off the contract. Put the SignWell document id into the invoice reference field so finance can reconcile any invoice back to the exact signed contract later. Derive the due date from the payment terms field on the document rather than hardcoding it: read the terms, for example Net 15, Net 30, or Due on receipt, and add the matching number of days to the completion date, falling back to Net 30 only when the field is empty.

Finish by posting to the finance channel with Slack Bot Send a Message, showing the customer, the invoice amount, the due date, and the invoice reference, plus a note that the invoice is sitting in draft and needs approval.

If the agreed amount or the payment terms field is missing or cannot be parsed, do not guess. Skip the invoice and post a Slack message naming the document and the missing field so someone can finish it manually.

## How to customize

- Change which documents count as billable by editing the contract naming pattern, so NDAs and other paperwork stay out of your accounting system.
- Keep the approval step permanently, or let the invoice send itself once you trust the numbers.
- Point the notification at a different channel, or invoice out of QuickBooks Online instead of Xero if that is where your finance team works.

## Example output

New contract signed. Draft invoice ready for approval.

Customer: Northwind Logistics Ltd
Amount: $24,000.00
Due: 8 September 2026 (Net 30)
Reference: SignWell doc a1b2c3d4

Sitting in Xero as a draft, needs approval before it goes out.

## FAQ

### Will the invoice be sent to the customer automatically?

No. The invoice is created as a draft in Xero so someone on your team reviews and approves it before it goes out. If you would rather it send itself, that is a small change once you trust the numbers.

### What stops it invoicing for an NDA or other non billable document?

The workflow only runs for documents whose name matches your contract naming pattern. Anything else that gets signed, such as an NDA or a consent form, is ignored.

### How does it know when the invoice is due?

It reads the payment terms recorded on the signed contract, so Net 15 and Net 30 customers each get the right date instead of every invoice getting the same hardcoded one.

### What happens if the same customer signs more than one contract?

The customer is looked up in Xero first and reused if they already exist, so you do not end up with duplicate records. Each new contract still raises its own invoice.

### How do we match an invoice back to the contract it came from?

The signed document reference is written onto the invoice, so anyone in finance can trace an invoice back to the exact contract that was signed.

Use this prompt in General Input: https://www.generalinput.com/prompts/turn-signed-signwell-contracts-into-draft-xero-invoices