Create and Email an Invoice with Xero

Contents

Overview

This article explains how to create and email an invoice when a Kintone record is added using Zapier (External link) and Xero (External link) .

What is Xero

Xero is a cloud-based accounting software platform that lets users create invoices and manage payroll, expenses, and financial reporting.

General Flow

The general flow of the operation is as follows:

  1. When a record is created in Kintone, it triggers Zapier to retrieve the information from the record.
  2. Xero then creates an invoice based on the information received from the Kintone record.
  3. Zapier triggers Xero to send the invoice to the client's email address.
  4. After the invoice is sent, it updates the Kintone record with the invoice URL and changes the status to Waiting for Payment.

Required Environments

In addition to a Kintone environment, the following will also need to be prepared:

  1. Kintone Users & System Administrators (External link) permission
  2. A Xero account (External link) with access to create and send invoices
  3. A Zapier account (External link) that allows multi-step Zaps and premium Apps (refer to Zapier's Plans & Pricing (External link) page for details)

Initial Setup

This section describes building a Kintone App and the required settings before integrating with Xero.

Create a sample App

First, create a new Kintone App.
Set the fields in the sample App as follows.

Field Type Field Name Field Code Notes
Record number Record number Record_number
Text Client Name Client_name
Text Client Email Address Email
Number Total Value Total_value
Link Invoice URL Invoice_url
Date and time Due Date Due_date
Attachment Attachment attachment Optional
Drop-down Status Status_payment Add 3 options: "Add new customer", "Waiting for payment", "Completed" and set "Add new customer" as the default value

The form should look like the following:

Generate API Token

Follow the steps in the following article to generate an API token.
Generating API Tokens (External link)

Make sure to check Edit Records and take note of the API token, as it is needed for the integration in the later steps.

Create Sample Data

Create sample data to debug and test the scenario.

  • Client Name: Enter a customer name
  • Client Email Address: Enter a valid email address (use your own email for testing)
  • Total Value: Enter an amount (e.g., 10000000)
  • Due Date: Select a future date
  • Status: Should default to "Add new customer"

Set Up the Integration

This section explains how to create a workflow from when a record is created in Kintone until an invoice is created and the record is updated.

Create a Zap

  1. Log in to Zapier and click the + Create button on the top left, then choose Zaps to start the Zap setup.

  2. Give the Zap a descriptive name, such as "Create and Email Invoices with Xero".

Set Up the Kintone Trigger

  1. Click the "1. Select the event that starts your Zap".

  2. In the search box, type in Kintone and select Kintone App.

  3. Select New Record as the Trigger Event.

  4. Connect your account. In the Account settings, if the appropriate Kintone account is already linked, select that account from the dropdown. If not, click Connect a new account.
    Fill in the authentication details:

    • Subdomain: Your Kintone subdomain (e.g., if your Kintone URL is example.kintone.com, enter example)
    • App ID: The App ID of the Kintone App created earlier
    • API Token: The API token generated in the Generating API token section
    • Domain: The domain, choose "kintone.com"

    Click Yes, Continue to Kintone.

  5. After finishing the setup, click Continue.

  6. Click Test trigger to verify the connection to Kintone. If successful, Zapier will retrieve a sample record from your Kintone App. Select one record, then click Continue with selected record.

Create the Invoice in Xero

  1. Click Add step or the + button to add a new step.

  2. In the search box, type in Xero and select the Xero App.

  3. Select Create Sales Invoice as the Action Event.

  4. In the Account settings, if the appropriate Xero account is already linked, select that account. If not, click Connect a new account and follow the authentication process to connect your Xero account.

  5. Click Continue after connecting your Xero account.

  6. In the Configure settings, map the fields as follows:

    Field Name Field Value
    Organization Your organization name in Xero.
    Contact Name Select Client Name from the Kintone record data.
    Email Address Select Email from the Kintone record data.
    Date Select Created Datetime from the Kintone record data.
    Due Date Select Due Date from the Kintone record data.
    Line Items Add a line item with:
    • Description: "Invoice from Kintone" or customize as needed
    • Quantity: 1
    • Unit Amount: Select Total Value from the Kintone record data
    • Account Code: Select the appropriate revenue account from Xero
  7. Click Continue and then Test step to create a test invoice in Xero. If successful, an invoice will be created in Xero.

Send the Invoice via Email

  1. Click Add step or the + button to add another step.

  2. In the search box, type in Xero and select the Xero App again.

  3. Select Send Sales Invoice by Email as the Action event and click Continue.

  4. In the Configure settings, map the fields as follows:

    Field Name Field Value
    Organization Your organization name in Xero.
    Invoice ID Select the Invoice ID from the previous step.

  5. Click Continue and then Test step to send a test email. If successful, the invoice will be emailed to the address specified.

Update the Kintone record

  1. Click Add step or the + button to add a final action.

  2. In the search box, type in Kintone and select the Kintone App.

  3. Select Update Record by Record ID as the Action event and click Continue.

  4. In the Configure settings, map the fields as follows:

    Field Name Field Value
    Record ID Select Record Number or ID from the initial Kintone trigger event.
    Status_payment Select Waiting for payment from the dropdown options.
    Invoice_url Select Online Invoice Url from the "Create Invoice" step.

  5. Click Continue and then Test step. If successful, the Kintone record will be updated with the invoice URL and status.

  6. Click Publish to turn on the Zap.

Test the Flow

Now, test that the above workflow is triggered when a record is added in the Kintone App.

  1. Navigate to your Kintone App and create a new record.

  2. Save the record. This will trigger the Zap workflow.

  3. Check the Zap history in Zapier to confirm all steps ran successfully.

  4. Verify the following:

    • An invoice was created in your Xero account
    • An email was sent to the client's email address with the invoice
    • The Kintone record was updated with:
      • The invoice URL in the Invoice URL field
      • The status changed to Waiting for Payment