Extension mechanisms for newsletters for a headless CMS

Hi our website is at https://rose-ash.com/

It’s a node application sitting in front of ghost and using it as a headless CMS. So it’s mixing ghost content with other content and functionality that ghost knows nothing about.

We haven’t touched the core ghost code and don’t really want to unless we have to.

I want to put some of this non ghost content into the newsletters so I am starting to think about how they might be extensible in this way.

I hope that makes sense - does anyone have any ideas?

I wrote some custom code for one client that pulls events from Google Calendar and a weather API and creates a Ghost newsletter that includes this. It’s possible to fire off a Ghost newsletter via API - here’s some example code:

2 Likes

Thanks a lot for this! If I understand you rightly you were putting the external data into the post and then firing it off as a newsletter. That’s not what my app does. https://rose-ash.com/ Some of the data never gets into the posts at all. It;s displayed together with posts by the front end. Eg event dates. I think I am basically going to have to disable the newsletters that ghost sends out and implement my own newsletter sending system that does much the same as my front end in merging post data and other data from the app. A webhook would have been ideal that ghost calls when it is going to send a newsletter with the content and lets you modify it before it gets sent. However also because in my app posts and pages can have multiple events attached to them I really want to send out an email for each event on a scheduled basis. FWIU ghost will only send newsletters once per post and never for pages.

I think our use cases might be closer than you think. The 3rd party content wasn’t going into blog posts either, but it /was/ going into newsletter emails. (Remember that Ghost lets you publish & email, publish only, or email only.)

We opted to combine a variety of source content and then put that into Ghost because that simplified managing members (all 100% Ghost) and it allowed the client to send with her Ghost Pro account, rather than adding an extra email service.

You control when Ghost sends email, either by clicking “publish and email” or by choosing a scheduled time. There is a webhook for posts being scheduled, so you COULD catch that webhook with some cloud function, make modifications/additions to the content, and use the API to change what goes out, or to create new ‘post’ (set for email, not for website) objects to be sent as newsletters at scheduled times.

2 Likes

ah ok - good point! My plan is that when people book an event at a venue it will give them the option of associating a post with it which it will let them edit. So as long as I prevent them publishing it which I can do by keeping them as just a contributor - when they indicate it is ready I can publish it on the site but then make secondary newsletter only posts from it combined with the event information and send them out. That sounds pretty cool actually… I can keep a record of all the posts associated with the event - including emails sent. I can do the same with automated social media posts.

1 Like