Automation for creating Newsletter

I would like to use the Ghost Admin API to help automate the creating of newsletters. I am trying to recreate the email content editor card and bookmark cards. I was able to have some luck with the bookmarks card and no luck with the email card. I looked through the documentation but could not find anything on the syntax. Is there any documentation that has the syntax you could use in the post.add api call?

How are you currently creating posts via the API? Are you using HTML with ?source=html or directly using the lexical source format?

Email content cards can’t be created using HTML so you’d need to use lexical. Two options there for seeing what to send

  1. Create content via the editor and use the browser’s network tools to inspect what gets sent when saving (the Admin interface uses the API so everything done there can be done via the API)
  2. Create content using the editor demo at https://koenig.ghost.org and view the “JSON output” (note that this won’t make external embed or bookmark requests so you’ll only get demo content but the data shape is what matters here)

Both approaches will let you see the underlying shape of content that’s saved in the lexical field so you can re-create it yourself programatically.

3 Likes