Unable to get the campaign rotation in EmailSubscriber

I would like to add some unique user tokens to an email, depending on which instance of the campaign is started. Much like a form submission campaign trigger, but without the form. I think the rotation field in the database is essential for this.

So in order to do that, I can link my specific data in a separate entity to the campaign, lead and rotation. Listen for the mautic.email_on_send event, and add the required tokens. But I can’t use the rotation in my subscriber, because the rotation is unknown at this point. I think it would make sense for the event’s source field to include the rotation, but I’m not sure if I can just add it to the array without interfering with Mautic core functionality.

If this is the way to go, I can create a PR with the necessary changes, if I’m completely wrong, please let me know :slight_smile:

Hello @markmgc and Welcome!

I’m not sure I understand your business use case.
Can you explain and give us more context?

Pierre

Hey @pierre_a.

I’m trying to achieve a transactional mail setup, in which the same template is being reused for an order confirmation. The confirmation should show a different image with every order, and I want to resend a reminder of the order after a week. I have to differentiate between 2 orders of the same user in the same period, which is why I think I need the rotation in the email_on_send event.

Do you think I need to approach this differently? Thanks for your time

Hello @markmgc,

Today Mautic is not designed to send transactional emails on its own.
What you can do is create your emails outside of Mautic and send them using the Mautic API (please see Mautic Developer Documentation).

Pierre

1 Like

Hello, we are doing this and also using similar approach with abandoned carts. Mautic is great in managing transactional emails with dynamic content.

Make custom fields for all dynamic data, or use json to store it in one field.
Push in data via API
Add the custom field token in the template emails even as image url or whatever data you need.
You can use the Twig Templates plugin (https://mtcextendee.com/marketplace/twig-templates-for-mautic/) to process complicated logics, parse through json, etc.

It’s working perfectly.

Let me know if you have more questions.
Joey

2 Likes

Thanks, I was trying to circumvent that pattern by having a custom token query my actual API for the current data, but it seems that’s not possible at the moment.

How do you know if an abandoned cart is still abandoned? Do you always synchronize all carts to mautic?

What ecommerce app do you use?

It’s not really an ecommerce system but it’s a laravel application. Integrating with that system shouldn’t be an issue at all. The issue I’m having is that a customer could have multiple orders at the same time and I need to distinguish between them (this is where it’s different from an abandoned cart I suppose, because you normally can’t have multiple carts).

I could create a workaround by accumulating all the orders and send out the reminder once, but that isn’t ideal. An ‘order’ is really a submission in an online contest, so I want to send a reminder after 1 week to have the users share their submission on social media.

Here you have a one to many relation, where the new 4.3 update, the Custom Objects can help.
It’s coming out next week, you can already check the beta version once you update Mautic.
I can’t give you a full walkthrough, but I believe it could be a solution.
I’ll create a video about custom objects soon, and post it here.
Until then here are the docs:

J

Hi @joeyk . This gives Mautic a lot of power! I never used this option, and seems to be great! But pretty “techie”! :slight_smile:

Yeah, it’s another concept we have to learn. But I think some examples will help us to wrap our head around it.

1 Like

Ready for making a new course about this? Stil lenjoying the last i did about templates!!!

Rgds,
Julio

That does look like a direction to solve my issue, I’ll look into it, thanks @joeyk!