Repository navigation
Add Attachments To Invoice Emails - #70
Merged
Merged
Conversation
EmailPayload gains an attachments array of a new EmailAttachmentPayload, and invoice send-email takes a repeatable --attachment. The to examples use a bare address, since FreeAgent refuses a named recipient. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FreeAgent takes an
attachmentsarray onsend_email, but the spec didn't declare it, so an invoice could only be emailed bare. The spec now declares it andinvoice send-emailtakes--attachment.--attachment <path>attaches a pdf, png, jpg, jpeg or gif file of up to 5MB. It can be repeated, as the API takes several files.toexamples now use a bare address. FreeAgent refuses theName <address>form the docs' example (and the spec's) used.EmailPayloadis shared with estimates and credit notes, which take the sameattachmentsarray per the docs. Their spec gains the field, but onlyinvoice send-emailhas the option. No endpoint is added, somake coverageis unchanged.What The Sandbox Showed
Probed under the pinned
X-Api-Version: 2026-09-01only. Every successful call sends real mail, so this was a one-off probe with no integration test. One email was sent, toprobe@example.comwithemail_to_sender: false; every other call was refused before sending. All four probe invoices were deleted.attachmentsis read. A PDF plus a PNG in one send was a 200 with an empty body, and the invoice moved from Draft to Open.fromtherefore probes attachments without sending mail.data,file_nameandcontent_typemust all be present. Leaving one out is a 422 that names an undocumented alternative,file_idon its own, which wasn't tried.content_typeis ignored, as on expenses:image/pngare refused, and PNG bytes sent asapplication/pdfpass..txtand.csvare accepted. The CLI keeps its pdf, png, jpg, jpeg and gif check.fromis a 422from must be a verified email address.tois a 422to is not a valid email address.Code
EmailAttachmentPayloadwithdata,file_nameandcontent_type, all three required.EmailPayloadgainsattachments, an array of it.InvoiceSendEmailCommandreads each--attachmentthroughAttachmentFileand sends noattachmentskey when none is given, so existing sends are unchanged.Tests
AttachmentFileErrorandsendInvoiceEmailis never called..txtfile and a missing path each exit 64.🤖 Generated with Claude Code