Be able to email approved invoices via the API
The functionality to send sales invoices via email is now open to all apps.
Check out the docs here: https://developer.xero.com/documentation/api/invoices#email
There’s more functionality we could add around emailing but I’m going to close this request. Please feel free to create new specific requests for any additional email functionality you’d like to see going forward.
Peter Wake commented
Just to say that this would be a really useful feature :)
Is this board still active?
Hi Xero - this has been hanging around as a request for a year now - is there any hope of this being addressed?
I would be perfectly happy to generate an email myself after grabbing the invoice details from the API. The problem is, I can't use the API to mark the SentToContact field as true - for some weird reason, it's been made read-only in the API.
As as interim solution, simply letting us set SentToContact would be sufficient. And because we're sending the email ourselves, we can set our own email From address and message.
I think the SentToContact change should be a priority. Further down the track, it would be nice to send emails directly from Xero's API, but that can come later.
However, here's what I'd need in order for that to be useful...
- The FROM address must be able to be set with the invoice branding.
- Same with the email message. There's no point in allowing different branded invoices if they all end up coming from the same address with the same message.
- It would be useful to be able to add multiple recipient emails to an invoice contact. For example, I frequently send one company's invoice to 3 people. But it's not the end of the world if it can't be done.
As I say, the priority should be allowing SentToContact to be set via API. Once that's done, at least we'd have the basic funcionality in place.
Egor Pervuninski commented
#fail automation just got harder
This. To Accounts Payable too.
Sounds like an assumption problem, Evan.
Xero team, any update on this? I'm about to code in this functionality but I won't do it if there's a release imminent.
Nathan Dunn commented
With the API having the ability to download the PDF, being able to email it yourself is not that hard. The only component Xero is missing is the ability to mark the invoice as sent.
All the functionality that has been mentioned could be easily done in a third party system, not necessarily in Xero.
Warren Strong commented
Here’s my 2 cents :)
Recipient (To Address): Allowing only the email in the existing contact is fine. Maybe expand this in future to somehow incorporate multiple addresses, or a cc list within an organisation. But for the now, just the email in the contact is a good starting point.
From (or sender): From a mail point of view, the from and the sender are technically two different things. Regardless, the limitation of emails being sent from the logged in user is...well...limiting. I remember a while ago, I used my personal email to log into my works Xero; the email was something like email@example.com. Without realising, I started sending customer’s invoices. Was not a good look!
If the design around the sender/from is too hard to change, then what about in Xero being able to set your own organisation wide reply to, and return path headers. This way, replies and bounces can be sent back to an appropriate mailbox.
You can also create something along the lines of what most email marking software does (the likes of mail chimp, news berry etc); where you, through a means of authentication, can designate an address to be the sending address. Usually using DNS/SPF rules or similar. Or DKIM’s if your watch still says 2004 on it.
Putting the above in context with the xero api; you could create ‘sender profiles’ which are assigned a unique id (like invoices or contacts); and when a ‘send the invoice to customer’ end point is requested, the sender profile ID is specified.
@Mark: Sorry if I wasn't clear, but we cannot provide functionality that is not in the Xero application already, hence my point on the sender address not being a generic one until that is available within the application.
It is possible to download a PDF version of an invoice right now via the API and email it yourself: see the comment on PDF in our documentation: http://blog.xero.com/developer/api/invoices/
Mark Seemann commented
When emailing an invoice, it is better to specify a from address as usually it will be a generic "accounts@xxxxx" or "finance@xxxxx" or failing that, the ability to download a pdf invoice by specifying one of the templates would
allow us to email it ourselves. Either way, please give us something - soon, this is critical functionality for us
Doh, it was supposed to say
As an interim solution this is fine. Down the track it would be good if we could create our own template and load in [customerName] or [bodyContent] or [whatever] for example it would be great, but again, so long as it is fairly generic that is A-OK with me.
Good news this is back on the radar. My thoughts are as follows
[quote]As you may be aware, emailing an invoice from within Xero sets the "from" address as the current user (person sending the invoice). If sent via the API, this would have to be the person that created or authenticated the API connection.[/quote]
I don't have any problem with this, but I have a small company. It would be great if you could specify a From Name and From Address at an organisational level.
[quote]Secondly, Xero does not have any default message or message templates, so this would need to be set each time. This message body cannot include HTML etc - plaintext only.[/quote]
As an interim solution this is fine. Down the track it would be good if we could create our own template and load in <messageBody /> for example it would be great, but again, so long as it is fairly generic that is A-OK with me.
[quote]Thirdly, the "to" address: at the moment this is automatically populated with the contact email of the invoice contact, but there is also the option to specify other email addresses also. We would not be comfortable allowing any email address to be specified programmatically via the API - would only being able to send to the invoice contact be sufficient.[/quote]
Being albe to send to multiple people in an organisation would be good. It would be nice if we could specify multiple recipients in an organisation.
[quote]I would appreciate your thoughts on this and also, any insights into how you would see yourself using this functionality would really improve our understanding of your needs - we have previously assumed that it would be just as easy for you to generate an email yourself after retrieving the invoice details via the API, so I would love to understand your needs better.[quote]
Basically I would like to be able to have someone sign up on my site, automatically create a customer account in Xero via the api. Then my application creates an invoice whenever a transatction occurs and then send the invoice automatically. The invoice and pricing is populated from items in my database (I don't have corresponding items in Xero so that level of integration doesn't apply to me) so it is a fairly straight forward process.
My application handles all of the transactions, and apart from counting my riches, and responding to customers requests, I don't want to have any other involvement in the purchasing process.
Thanks heaps and I really look forward to this long overdue feature being launched.
Thanks for the feedback on this so far.
I am doing some work to better understand how you would like this to work.
As you may be aware, emailing an invoice from within Xero sets the "from" address as the current user (person sending the invoice). If sent via the API, this would have to be the person that created or authenticated the API connection.
Secondly, Xero does not have any default message or message templates, so this would need to be set each time. This message body cannot include HTML etc - plaintext only.
Thirdly, the "to" address: at the moment this is automatically populated with the contact email of the invoice contact, but there is also the option to specify other email addresses also. We would not be comfortable allowing any email address to be specified programmatically via the API - would only being able to send to the invoice contact be sufficient.
I would appreciate your thoughts on this and also, any insights into how you would see yourself using this functionality would really improve our understanding of your needs - we have previously assumed that it would be just as easy for you to generate an email yourself after retrieving the invoice details via the API, so I would love to understand your needs better.
Mark Seemann commented
please add this asap to the API
also need this functionality added to the API
I'm about to add this functionality to my add-on for Xero for any Xero org to use see www.click-2-post.com (it got renamed).
With the new Auto-Send Rules (not in the existing product yet) you will be able to automatically send Invoices and Credit notes to the Contact concerned either via email and/or via post (for supported countries).
This will work for any invoice created within Xero (repeating or not) or any invoice created through the API. Polling and sending of invoices will initially be done once a day, but if there's demand the polling frequency could be increased.
You will also be able to have different email templates based on either a group of contacts or by matching against item codes in the invoice.
If you're interested in finding out more let me know my email address is rperfect at click-2-post dot com.
Duncan Bascombe commented
Any Update on this functionality???
It can't possibly be that difficult to implement. You already do it through the interface, so why would it be so difficult to trigger the same process through the API.
How many votes is it gonna take before you start on this one Xero? You strung us along for ages with us having the impression of being able to "approve and send invoices via the API" then you drop this doozie on us.
Please make it a priority!