Be able to email approved invoices via the API
We have just released the ability to mark an invoice as sent through the API (http://blog.xero.com/2012/10/developer-update-mark-as-sent-through-api/). We hope that this, in addition to the ability to retrieve a PDF copy of an invoice will allow most developers to do the email part themselves.
Work is underway within Xero to provide more flexibility around the emailing of invoices, templates and being able to set a sender address other than the current user. Until this has been done and we can then expose it via the API, we will not be providing the ability to email invoices from Xero via the API.
We have recently added support for email templates in Xero ( see http://help.xero.com/#EmailTemplates ). The next stage of work is to let users set a sender address which our team is working on now. Once that is in place we'll look to add support for triggering the sending of invoices via the API. After that we'll consider adding support for other documents.
If and when you get to this feature, please don't forget about Statements. Just like some users will want to use the API to send invoices, some will want to use it to send statements
Matt Beedle commented
Any idea when this functionality will be ready?
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
David Yonan commented
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.
David Yonan commented
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.