DEV Community

Cover image for Avoid logging into Listmonk for Campaign Previews. Use this hack instead
Ganesh Kumar
Ganesh Kumar

Posted on

Avoid logging into Listmonk for Campaign Previews. Use this hack instead

How I Added Discord Preview Feature to Our Listmonk Campaign? How do we schedule weekly emails? How to receive email Preview in the Discord server?

The Hurdle

We have set up a system of doing a mini-research every week. Each one of the team members takes up a mini-unknown area.

We learn about the area, create a solution, and if it's good then transform it into a blog so that others may benefit from it.

We wanted to keep the data with us. So, We set up a blogging platform using Ghost Blog

As the quality of the content got a little better people started recognizing and subscribing to our blog.

Once we had 50+ subscribers it was evident that we needed to set up a newsletter system.

Ghost came with a newsletter setup, but we had to pay for MailChimp to use that hence we set up a self-hosted email manager Listmonk on our own.

We had to spend a week coming up with a sync system for migrating subscribers.

We set up a sync system and migrated all the Ghost subscribers to Listmonk subscribers so that we can make an automated scheduled newsletter every week.

Scheduling Newsletter

We wanted a scheduled newsletter for every Monday, as the writing would be finished by Sunday.

We thought of making it automated so it does not depend on manually sending it and made use of a Cron job for automation.

We have one more newsletter called 365 Reasons which will be sent throughout the year.

The script is fully automated, but we prefer to do a quality check before a campaign sends emails to dozens of recipients.

We should not send spam or corrupted emails, it is wasting a person's time. Logging in every time would consume our precious time.

Since this is a daily chore, we wanted to make it easy on ourselves

Listmonk didn't have an integrated solution to this, so we came up with our idea i.e. Sending a snapshot of the HTML before sending the newsletter.

How I Implemented a Preview

Listmonk doesn't come with template, so we are using Jinja template for rendering the post, we fetch the last week's posts from our blog. Render the post using a template.

In the end, we have an HTML Posted to the Listmonk server. We fetch the scheduled Email and take a screenshot of it.

I used Pyppeteer library to get a screenshot of the HTML before sending it.

Continue reading how to send snapshot to discord

Top comments (0)