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.
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.
Example output
What does this prompt do?
- 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 do I need to use this?
- 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
How can I customize it?
- 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.
FAQs
Will the invoice be sent to the customer automatically?
What stops it invoicing for an NDA or other non billable document?
How does it know when the invoice is due?
What happens if the same customer signs more than one contract?
How do we match an invoice back to the contract it came from?
Related templates
When someone leaves, we check which shared passwords they used in their final months and post a ranked rotation list to your security channel.
Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.
Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.
Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.
Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.
When you merge a fix in GitHub, this agent checks the matching dead-letter queue, replays the failed messages, and reports back on the pull request and in Slack.
Stop retyping signed contracts into your accounting system.
Every signed contract becomes a draft invoice with the right amount, due date, and reference before anyone has to notice it.