How to send multiple emails (daily digest) based on select-multiple fields

Hello everyone,

I’m new to Mautic and I’m stuck. I run a job board at remoteafrica.io and I am attempting to migrate away from my current campaign provider.

Use case:
My users can subscribe to multiple job categories and I would like to send out emails for each subscribed category. My previous workflow was to send data with a template ID and a list of users.

Moving to Mautic, I have built a form that allows me to set up a contact field using select multiple, so each contact has a comma-separated field value.

My questions are:

  1. how do I build an email template for each category to be sent to a contact? That is 3 different emails (subscribed categories) to one contact.

  2. Will I need to create a campaign for each job category?

  3. Most concerning, how do I build an email with data(rss/json)? I have come across the RSS feed plugin and twig template but I am still confused is there a way to build out a list without converting my JSON to RSS?

  4. Is it possible to build a template on a server and send it through Mautic?

Thanks in advance for taking the time to respond.

1 Like

Hi,
instead of writing it down how it can be done, here is a video, that covers just that:

Addition:
Now you can push in the whole Twigtemplate with an API call, so you can create your daily digest programatically every day.

Thanks @joeyk,

Thanks for putting out awesome videos on Youtube they really helped getting me onboard.

I previously came across your videos but I couldn’t figure out how to build dynamic content, that is step 2 in the video. I got confused on the generated code bit.

Also a little difference, In your video, the movie recommendations are in one email. For my use case, it will be a different email for each movie type.

But from what I understood, correct me if I’m wrong, I generate the HTML code from my backend (I have this already in the builder), translate it to twig, then post the twig code into Mautic? Doesnt this makes the data in the email stale no?

Please point me in the right direction on how to “push in the whole Twigtemplate with an API call”.

From my research using POST /emails/new, I can create post but it’s static, this will mean I’ll this week I’ll create an email, send it to a user segment with POST /emails/ID/send, delete the email, and repeat the following week.

I am thinking alternatively, I’ll have a campaign for each category. Add the users accordingly and use the Mautic RSS API to pull content to the email.

Hi,
You can do it 2 ways:

  1. Create a huge twig block where you include all content. IF commands would decide which block to show based on interest (tag or custom field). You don’t need to rewrite the code in twig, you can use the same html just wrap it between twig IF commands.

  2. You can send a separate email for every topic. You can do this with the RSS plugin as well if you want to. I created a course or you can figure it out yourself.

Regards:
Joey

1 Like

Hi @joeyk,

Thanks for the answers. I got the twig-plugin and it has been working great.

The next thing, is it possible to send twig data through Mautic API (Post /emails/id/contact/id/send/) the email/id has a twig template. Is it possible to send the twig values via the API?

Thanks

Hi,

The twig template is not user specific. But you can always populate a custom field of a user with content, so you can push in {twigtemplate=2} for example.

I’d like to take the opportunity to brag a little bit. We sponsored the feature of API on twig templates last year, so that is also possible :slight_smile:

You can send / modify a twigtemplates via API calls. See last line of the description:

“Twig templates support standard API operation GET/POST/PUT/PATCH/DELETE.”

Awesome.

I thought as much with the custom_field. I go something working.
I update the contact from the server, keeping track of which campaign is currently running in a different field.

I have one bottleneck at the moment, for this to work I have to update all the contacts before the campaign starts. My current workaround is to add all subscribers to a company during a campaign which allows them to inherit a companies information. This way I can just update internal company info once.

My issue however is that I can’t access the company’s attributes in twig. I can access contact.company(the name) but not its properties (contact.company_custom_field).


Also is there a way to get the regular tokens in the twig? like {subject} {leadIdentifier} {contactfield:firstname} etc?

Is there a way to do this?

I’m not sure. Try to write to the developer.