task to push templates to Postmark
Closed this issue · 5 comments
I'd like to tag a release, push my templates into Postmark, and then run a local hook to update my configuration database with the template IDs. I'm working on a first pass but wanted to open discussion on requirements if anyone has thoughts.
Awesome idea, @hybernaut. I can't think of anything that I would change regarding the workflow you proposed. It sounds solid.
Do you have a plan for distributing this? I suggest that template management is a separate npm package that's configurable from our Gruntfile.js, similar to grunt-postmark and grunt-spamcheck. That way MailMason's responsibility is minimal.
Alternatively, we could even integrate this into grunt-postmark since template management is related to sending test emails. You'd be able to reuse the existing server tokens and subject line fields there as well. Difficult to tell whether this could get messy or not.
Our postmark.js package is a good place to start. It should provide you with some readily available methods for making template requests to our API - https://wildbit.github.io/postmark.js/Client.html#getTemplate. Can't wait to see what you come up with. Let me know if you have any questions.
Thanks, @derekrushforth. I've got a simplistic createTemplate grunt task implemented here:
I'd like to get editTempate (update) working as well, but haven't figured out where the templateIDs will come from. It might make sense to move this to a separate grunt plugin.
One other question I've been thinking about is deploy environments--we have 5 ranging from production down to developer-local. It appears that templates are scoped to a server (at least the template API takes a server token) so maybe the best practice will be a separate postmark server for each environment. Does that make sense?
This looks like a great start. I'll get back to you with feedback. Thanks @hybernaut.
It appears that templates are scoped to a server (at least the template API takes a server token)
That's correct.
so maybe the best practice will be a separate postmark server for each environment. Does that make sense?
I would say one for production and one for staging & local is sufficient for most setups. From there it really depends on how you guys test and what your team's preference is.
Added template and layout pushing to Postmark in v1.0.0.