Skip to content

Xero ​

Records the received bill with its PDF, finds a contact or invoice, issues a sales invoice and has it sent.

The Xero node acts on the organisation of a Xero connection. Pick a Resource — Contact, Sales invoice, Bill — then an Operation.

ResourceOperations
ContactCreate · Update · Get · Search
Sales invoiceCreate · Get · Search · Attach a file · Get the PDF · Send via Xero
BillCreate (with the email attachment) · Get · Search · Attach · Get the PDF

At a glance ​

  • Type: xero.api · version 1
  • Category: Data
  • Kind: Step — one stage of a run
  • Effect: Writes outside (external_write) — writes outside Loop & Roll; described instead of performed during a test run
  • Needs a carrier email: No
  • Connection: Xero
  • Inputs: main
  • Outputs: main
The ports of “Xero”: what comes in on the left, what goes out on the rightInput: main. Outputs: main. An error output appears when its failure setting is “Follow the Error output”. It needs a Xero connection.Xeroxero.apimainmainerror · only with “Follow the Error output”Connection: Xero
The ports of “Xero”: what comes in on the left, what goes out on the right

Connection ​

This node needs a Xero connection.

Parameters ​

connection ​

Xero connection — The Xero connection to use. Create it once in Connections; its key never appears in the workflow.

  • Type: Connection (credential)
  • Required: Yes
  • Default: "" (empty)

resource ​

Resource

  • Type: One choice (options)
  • Required: Yes
  • Default: bill
  • Options:
    • contact — Contact
    • invoice — Sales invoice: What you bill (ACCREC).
    • bill — Bill: What you are billed (ACCPAY) — the invoice received by email.

operation ​

Operation

  • Type: One choice (options)
  • Required: Yes
  • Default: create
  • Options:
    • create — Create
    • update — Update (contact)
    • get — Get
    • search — Search
    • attach — Attach a file: Uploads a file of the run to the invoice.
    • pdf — Get the PDF: The invoice PDF, added to the run’s files for sending by email.
    • email — Send via Xero (sales invoice): Xero emails the approved invoice to the contact’s address.

recordId ​

Xero ID — The ContactID or InvoiceID (a GUID), as an earlier step returns it.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 36 characters at most
  • Example: {{ data.api_1.id }}
  • Shown when: (resource is one of contact and operation is one of update, get) or (resource is one of invoice, bill and operation is one of get, attach, pdf, email)
  • Expressions: {{ }} accepted

contactName ​

Contact name — Required on creation: the company or person name.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 255 characters at most
  • Shown when: resource is one of contact and operation is one of create, update
  • Expressions: {{ }} accepted

email ​

Email address

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 255 characters at most
  • Shown when: resource is one of contact and operation is one of create, update
  • Expressions: {{ }} accepted

firstName ​

First name

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 255 characters at most
  • Shown when: resource is one of contact and operation is one of create, update
  • Expressions: {{ }} accepted

lastName ​

Last name

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 255 characters at most
  • Shown when: resource is one of contact and operation is one of create, update
  • Expressions: {{ }} accepted

contactId ​

Contact (ContactID) — The customer (sales invoice) or supplier (bill).

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 36 characters at most
  • Example: {{ data.search_1.first.ContactID }}
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

reference ​

Reference — Bill: the number of the received invoice. Sales invoice: your reference.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 255 characters at most
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

date ​

Date (YYYY-MM-DD)

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 10 characters at most
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

dueDate ​

Due date (YYYY-MM-DD)

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 10 characters at most
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

lineDescription ​

Line description

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 4000 characters at most
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

unitAmount ​

Unit amount — A number, decimal point (1250.50). Tax exclusive or inclusive per the organisation’s setting.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 30 characters at most
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

quantity ​

Quantity

  • Type: Number (number)
  • Required: No
  • Default: 1
  • At least 0
  • Shown when: resource is one of invoice, bill and operation is one of create

accountCode ​

Account code — The Xero chart-of-accounts code (200 sales, 400 purchases…).

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 10 characters at most
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

linesJson ​

Lines as JSON (advanced) — An array of Xero line items (Description, Quantity, UnitAmount, AccountCode, TaxType). Replaces the line above.

  • Type: Long text (text)
  • Required: No
  • Default: "" (empty)
  • 20000 characters at most
  • Shown when: resource is one of invoice, bill and operation is one of create
  • Expressions: {{ }} accepted

status ​

Status

  • Type: One choice (options)
  • Required: No
  • Default: DRAFT
  • Options:
    • DRAFT — Draft
    • SUBMITTED — Awaiting approval
    • AUTHORISED — Approved
  • Shown when: resource is one of invoice, bill and operation is one of create

attachmentPosition ​

Attachment (position) — When creating a bill, or for “Attach”: an email attachment (1 for the first one) or a file added by a step. 0 = none.

  • Type: Number (number)
  • Required: No
  • Default: 0
  • Whole number, from 0 to 2000000
  • Shown when: (resource is one of bill and operation is one of create) or (resource is one of invoice, bill and operation is one of attach)

searchTerm ​

Search for — Contact: name, first name, last name, number or email address. Invoice: number or reference.

  • Type: Text (string)
  • Required: No
  • Default: "" (empty)
  • 255 characters at most
  • Example: {{ email.from.email }}
  • Shown when: resource is one of contact, invoice, bill and operation is one of search
  • Expressions: {{ }} accepted

limit ​

Maximum count

  • Type: Number (number)
  • Required: No
  • Default: 20
  • Whole number, from 1 to 100
  • Shown when: resource is one of contact, invoice, bill and operation is one of search

Outputs ​

  • main — Taken once the Xero call has succeeded, whatever the operation. An error answer from Xero fails the step instead.

Data produced ​

What this node adds to the run data, and how to read it in an expression. <step> stands for the step key: the node name turned into an identifier (see Data and expressions).

  • {{ data.<step>.id }} — string. The Xero ID (ContactID or InvoiceID) created, read or targeted.
  • {{ data.<step>.number }} — string. Create an invoice: its number.
  • {{ data.<step>.invoice }} — object. Create, Get an invoice: the invoice as Xero returns it.
  • {{ data.<step>.contact }} — object. Contact: the saved or read contact.
  • {{ data.<step>.first }} — object. Search: the first item found, or null. records, count and found complete it.
  • {{ data.<step>.attachmentPosition }} — number. Get the PDF: the PDF’s position in the run’s files, to cite in a Compose node.

Example ​

A firm receives its suppliers’ invoices by email. After an Extract node reading supplier, number, date and amount:

resource            bill
operation           create
contactId           {{ data.search_1.first.ContactID }}
reference           {{ data.extract.number }}
date                {{ data.extract.date }}
lineDescription     {{ data.extract.subject }}
unitAmount          {{ data.extract.amount }}
accountCode         400
attachmentPosition  1

The bill is created as a draft in Xero, with the email’s PDF attached.

Tips ​

  • Dates as YYYY-MM-DD; amounts with a decimal point or comma.
  • Several lines: Lines as JSON replaces the single line.
  • Status: Draft by default; “Send via Xero” needs an approved invoice.
  • IDs: a ContactID or InvoiceID is a 36-character identifier; any other value is refused before any call.
  • Test runs: reads are real, writes are described.

Loop & Roll — the workflow builder for email.