Create and Email an Invoice with Xero
Overview
This article explains how to create and email an invoice when a Kintone record is added using
Zapier
and
Xero
.
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:
- When a record is created in Kintone, it triggers Zapier to retrieve the information from the record.
- Xero then creates an invoice based on the information received from the Kintone record.
- Zapier triggers Xero to send the invoice to the client's email address.
- 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:
- Kintone
Users & System Administrators
permission
-
A Xero account
with access to create and send invoices
-
A Zapier account
that allows multi-step Zaps and premium Apps (refer to Zapier's Plans & Pricing
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 | ||
| 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
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
-
Log in to Zapier and click the + Create button on the top left, then choose Zaps to start the Zap setup.
-
Give the Zap a descriptive name, such as "Create and Email Invoices with Xero".
Set Up the Kintone Trigger
-
Click the "1. Select the event that starts your Zap".
-
In the search box, type in Kintone and select Kintone App.
-
Select New Record as the Trigger Event.
-
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, enterexample) - 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.
- Subdomain: Your Kintone subdomain (e.g., if your Kintone URL is
-
After finishing the setup, click Continue.
-
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
-
Click Add step or the + button to add a new step.
-
In the search box, type in Xero and select the Xero App.
-
Select Create Sales Invoice as the Action Event.
-
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.
-
Click Continue after connecting your Xero account.
-
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
-
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
-
Click Add step or the + button to add another step.
-
In the search box, type in Xero and select the Xero App again.
-
Select Send Sales Invoice by Email as the Action event and click Continue.
-
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. -
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
-
Click Add step or the + button to add a final action.
-
In the search box, type in Kintone and select the Kintone App.
-
Select Update Record by Record ID as the Action event and click Continue.
-
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. -
Click Continue and then Test step. If successful, the Kintone record will be updated with the invoice URL and status.
-
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.
-
Navigate to your Kintone App and create a new record.
-
Save the record. This will trigger the Zap workflow.
-
Check the Zap history in Zapier to confirm all steps ran successfully.
-
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