TWIG and MJML - RSS Parse Cheat sheet

Hey team

Following up on the thread
I have a few different types of RSS feeds which I need to build for.

I am currently sticking with Logicify/mautic-advanced-templates-bundle

How do people approach grouped elements?
Need to extract the URL of the media against the item

Broadly be keen to see if we can assemble a bit of a cheat sheet for handling these different XML/JSON feed structures with each being different

I have this XML item below

<item>
		<title>Article Title</title>
		<link>https://domain.com/interviews/xyz</link>
		
		<dc:creator><![CDATA[Author Name]]></dc:creator>
		<pubDate>Mon, 07 Aug 2023 03:41:24 +0000</pubDate>
				<category><![CDATA[Interviews]]></category>
		<guid isPermaLink="false">https://domain.com/interviews/xyz</guid>
					<description><![CDATA[Description body goes here and there ... <a href="https://domain.com/interviews/xyz/">Read&nbsp;More</a>]]></description>
		<media:content type="image/jpeg" medium="image" url="http://domain.com/wp-content/uploads/2023/08/photo.jpg" width="300" height="161">
	<media:credit>Author Name</media:credit>
	<media:title>Media Title</media:title>
	<media:text>Media Description.</media:text>
</media:content>
<enclosure type="image/jpeg" length="13795" url="https://domain.com/wp-content/uploads/2023/08/photo.jpg" />
	</item>

@joeyk

HEy @tornmarketing have you checked out RSS to Email plugin ? Maybe if can be used as a base for extending to JSON or different XML formats: GitHub - ChrisRAoW/mautic-rss-to-email-bundle: Mautic plugin to send emails from RSS

I have followed that one since conception but it is lacking a bit of depth with what we can do.
Logicify has a bit more scope for future tasks I plan to do with woocommerce

Both use simplexml and TWIG
My question would be more broadly the approach when we play with these grouped elements as the struggle is for both plugins and they both should approach the twig and simplexml the same.

twig have a dump function (https://twig.symfony.com/doc/3.x/functions/dump.html), which you can use to debug and see the attributes of the variable you are trying to use.

so you can create a test e-mail with the tag {{ dump(item) }} for example to see how the data is organized inside.

I have not played with twig inside mautic yet (still didn’t have the opportunity, but I am definitely interested)

but my experience with tokens inside mautic is that the token remain intacted if mautic itself don’t recognize it.
What I have used in the past is the ElasticEmail Service feature, it also have their own token/script tags which also can pull data from an rss and even html page. unfortunately not all my customers use ElasticEmail and I could not find another SMTP service with a similar feature. elasticEmail tokens uses single and sometime double brackets ({} or {{}}) and mautic forwarded those tokens with no issue, while processing the tokens mautic recognize it.
it can be very useful, take a look: How to use merge fields | Elastic Email Help Center

I am curious about this plugin, do you know if it renders the rss feed by the time you build the e-mail or when it sends?
for example, if I write

{feed url="mycustomFeed.com?forCustomer={contactfield=email}"}

would each contact load its own data/url?

I shall play! thanks mate

There is the ability to pass through the contacts segment to the rss, so I would assume* that it would allow you to pass through a contacts email.

One thing I did a while back was I modified the email helper so I could attach an external PDF remotely.
What I discovered tho, was it played funny with the email batches, which defaults to 100.
Something to be mindful as you test is to check the email batching

1 Like

I’m using the content.optimizer fork. As far as I know the batch issue is solved there.
Moreover you can use local files now for generating the rss.

Hey mate

Are you using an middleware to clean up, reassemble and/or combine RSS feeds?

Alot of the feeds I have lack images and the tags vary - looking at potentially setting up a basic wordpress to import the blog articles with all the meta and then reassemble the RSS with clean/optimised and more importantly standardise the XML/JSON feeds.

Was hoping https://feedly.com/ but they dont offer a RSS output from what I could see

Hoping I could find something off the shelf before I go through all the effort of building something new

I’m too lazy, so I often parse and reformat the xml to prepare for the plugin to consume it according to its picky taste.

Especially with the Content Optimizer plugin it is useful. You can define segment Tag which allows Mautic to display the content to that specific segment.