Skip to content

Autonomous newsletter builder tool for Listmonk and Ghost Blog CMS. This GoLang App compiles a newsletter from an RSS feed and posts it to Listmonk via API to create the new campaign.

License

Notifications You must be signed in to change notification settings

chaddyc/auto-newsletter-listmonk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Newsletter builder/compiler software for Ghost Blog CMS and Listmonk Newsletter Manager. This Blog Article display the steps how this software was developed and examples of how it works.

Table of Contents

About

This is a newsletter builder tool for Ghost CMS and Listmonk. This software allows you to compile a newsletter via Ghost CMS RSS Feed and creates your newsletter campaign in Listmonk via API with one command and can be executed manually or autonomously via the methods below.

How To Run This Software

This software tool can be utilized via the Docker CLI, GitHub Actions or by creating an Ansible Playbook.

Docker CLI:

Create a folder and call it auto-listmonk-newsletter and cd to the directory. Create a .env file and add the following vars in the .env, add your values and save it:

# Listmonk Env Vars

LISTMONK_API=
USER=
PASSWORD=
FROM_EMAIL=
TEMPLATE_ID=
LISTS=

# RSS Feed Env Vars

RSS_FEED=
HEADER_MESSAGE=
FOOTER_MESSAGE=

Run the following command to execute the docker container which will then build out the container and run the go binary once and remove the container once done.

docker run --rm --name auto-listmonk --env-file .env chaddyc/auto-listmonk-newsletter:latest

To automate this process you can set up a cron job or you can build an ansible playbook like in the next method.

Ansible:

In progress...

Github Actions:

The first step is to create a GitHub Secret in the repository that you are going to utilize to run a workflow for this tool. Call the secret ENV_FILE and add your env vars values and save the secret. Add the following workflow below under .github/workflows/campaign.yml.

ENV_FILE secret template to be added under Github Actions secrets for your repository.(See sample.env)

# Listmonk Env Vars

LISTMONK_API=
USER=
PASSWORD=
FROM_EMAIL=
TEMPLATE_ID=
LISTS=

# RSS Feed Env Vars

RSS_FEED=
HEADER_MESSAGE=
FOOTER_MESSAGE=

This workflow should be executed manually in the Github Actions tab whenever you want to compile your latest 5 articles links into a newsletter campaign for Listmonk.

name: Create Listmonk Campaign

on:
  workflow_dispatch

jobs:
  campaign:
    runs-on: ubuntu-latest
    steps:
    - name: Create .env
      run: echo "${{ secrets.ENV_FILE }}" > .env

    - name: Docker run
      run: docker run --rm --name auto-listmonk --env-file .env chaddyc/auto-listmonk-newsletter:latest

This workflow below will execute every Sunday and create a campaign in Listmonk with the latest 5 articles.

name: Create Listmonk Campaign

on:
  schedule:
    # Runs every Sunday at 18:30
    - cron: '5 19 * * Sun'

jobs:
  campaign:
    runs-on: ubuntu-latest
    steps:
    - name: Create .env
      run: echo "${{ secrets.ENV_FILE }}" > .env

    - name: Docker run
      run: docker run --rm --name auto-listmonk --env-file .env chaddyc/auto-listmonk-newsletter:latest

Contributors

Chad
Chad Crouch

How To Contribute

Contact me via Twitter

License

For license information, please see LICENSE

About

Autonomous newsletter builder tool for Listmonk and Ghost Blog CMS. This GoLang App compiles a newsletter from an RSS feed and posts it to Listmonk via API to create the new campaign.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published