Repository navigation
Spooldoc 0.4.0: email and webhooks #131
ronistrom
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Spooldoc 0.4.0 is out. A job can now send each document by email, to the address printed on it, through your own mail server or a Microsoft 365 mailbox. It can also post each document, with its data and its files, to a program of your own as a signed webhook call. Settings has number, date and currency formats for templates and emails. Nothing breaks: the upgrade is a pull and a restart.
What changed
Email destination. An email destination sends one email per document: each invoice to the customer on it, each delivery note to the address printed in it. The job's destination step sets To, Cc, Bcc, Reply-To, the subject and the message with the same
{d.pg.field}tags as the templates, and picks the files to attach, PDF by default. Beside the fields, a preview shows the email of one page group, with Previous and Next through the rest. A new email destination sends every email to your own address until you empty Send all email to, so you can try a job before any customer gets an email. Email has the details.SMTP or Microsoft 365. Settings, under Mail server, sends through an SMTP server or through a Microsoft 365 mailbox with Microsoft Graph. With Microsoft 365, Spooldoc signs in as an app registered in Microsoft Entra ID, with no user password. Microsoft 365 is turning off SMTP sign-in with a password by default, so use this one when your mail is there. Mail server has the steps to register the app and to limit it to the one mailbox it sends from. Send test email sends one to you and, when it fails, says what to check.
Webhook destination. A webhook destination posts one call per document to a URL: each invoice, with its data and its PDF, to the program that books it. Each call is JSON, signed the Standard Webhooks way, so the receiver can check that it comes from Spooldoc. The destination step shows the call of one page group as a run would make it, and Send test posts it now and shows the receiver's answer. While a test URL is set, every call goes there instead. Webhook has the body and how to check the signature.
Every email and call in the job log. A run lists each email or call with its status, and a failed one opens to the reason. When one document fails, the others are still sent. Then the run fails with "Sent 5 of 6 emails" and the first reason, and the spooled file is not held, moved or deleted. After you fix the cause, Retry sends only what was not sent yet. Job log has the details.
Formats. Settings has a number format, a date format and a currency for the whole app. Every render passes them to Carbone, so
formatN,formatCandformatDin a template follow them, and email fields take the same formatters. With1.234,56and EUR,{d.pg.total:formatC(2)}prints1.234,50 €. The defaults print what 0.3 printed. Formats has the choices.All changes are in the release notes.
Upgrading
Take a
pg_dump, then pullghcr.io/strom-capital/spooldoc:0.4.0and start it. The server applies the new migrations. Nothing else needs you: jobs, templates and destinations from 0.3 open and run as before.To send email, fill in Mail server in Settings first. A mail server or a webhook receiver with a certificate from your own certificate authority needs
NODE_EXTRA_CA_CERTS; see Certificates.Tell us
Questions go to Q&A, ideas to Ideas, bugs to the issues. We most want to hear about a mail server or a receiver that refuses Spooldoc, and about an error that does not say what to do. Replace real host, user, address and library names before you paste it.
All reactions