About SendInvoice
Use this to email invoices to customers. The email ("headers" and "content") are customized with template tokens. If tokens are not specified in the call, parameters are pulled from the Default Email Template.
Note: the API cannot change the Default Email Template. Edits to the template MUST be made on the Bill.com UI. (Settings > Overview > Receivables > Email Templates).
Email tokens
Use tokens (exactly as shown) to dynamically populate information in the email body. When sent, tokens are replaced with data.
Field | Description |
{:Customer.Name:} | Replaced with the name of the customer the invoice is sent to. |
{:Invoice.Number:} | Replaced with the number on the invoice. |
{:Invoice.AmountDue:} | Replace with the amount that is dues. |
{:Invoice.DueDate:} | Replaced with the invoice due date. |
{:Link_Pay_Invoice:} | Replaced with the URL of your company’s Bill.com Customer Portal. |
For example, in the email "body" you can enter:
"Hello {:Customer.Name:}, your invoice {:Invoice.Number:} is
due on {:Invoice.DueDate:}"
When sent, the {:Customer.Name:}
, {:Invoice.Number:}
, and {:Invoice.DueDate:}
are replaced with the respective values as described above.
Note: "headers" and "content" must be provided with the call, even if empty.
The "body" content MUST also include "subject" content, and vice versa. If neither are provided, Subject line and Body text is pulled from the Default Email Template.
If a customer contact object does not exist for the email address, a new customer contact object is created.
If linked to the customer on Bill.com network, provide their inbox email address (ends in "@bill.com"). The eInvoice is sent there - and to other email addresses (if specified).
Example
Request
<API_URL_EndPoint>/SendInvoice.json
data={
"invoiceId" : "00e01PFOZHWHGAEFJ2xr",
"headers" : {
"fromUserId" : "00601UDOKWTNBENN2jg8",
"toEmailAddresses" : [ "email1@domain.com", "email2@domain2.com" ],
"ccMe" : true,
"subject" : "Hello friend! Your invoice #: {:Invoice.Number:} is due in 10 days!"
},
"content" : {
"body" : "Hi {:Customer.Name:},\n\nTo pay your invoice online and view your account history, log in below:\n{:Link_Pay_Invoice:}\n\nPlease remit payment at your earliest convenience.\n\nThank you for your business,\nMyOrgName \n\n----------------\nInvoice Summary:\n\nInvoice #: {:Invoice.Number:}\nAmount Due: {:Invoice.AmountDue:}\nDue Date: {:Invoice.DueDate:}\n"
}
}
Response
{
"response_status" : 0,
"response_message" : "Success",
"response_data" : {
}
}
Resources
Parameters
Field Name | Description | Required? |
---|---|---|
invoiceId | The system generated Invoice ID of the invoice that needs to be emailed to the customer | Yes |
fromUserId | The system generated User ID of the user who is sending this invoice. Will be user's email from login. If not provided, user in Default Email Template is used. | No |
toEmailAddresses | Array of email addresses to send the invoice. If provided, invoice goes to these addresses. If not provided, invoice is sent to the customer contact email(s). | No |
ccMe | CC to sender. User receives CC (not user in fromUserId). | No |
subject | Subject line. Tokens not allowed. | No |
body | Body. Must be single String. Can use tokens. For forced line break, use \n |
No |