Send Blog Post Emails Via RSS Feeds And Realtime Marketing Journeys

A lot of blogs I write are born from my own frustration or desire to automate something. For this one, I had often wished we had the ability to use an RSS feed to send out emails to Leads or Contacts in D365 using Customer Insights – Journeys. Out of the box there is no way. Although I have previously written about a way to do it, that used a Trigger which at some point becomes unmanageable or could be firing a LOT. Plus, it used a flow to find people in a segment to then push in to a Journey. I wanted to cut out the middle step and just go straight to a Journey with a segment of all people subscribe. I finally figured out a process that works AND I am using it for sending out my own blog posts via recurring journeys in the marketing app. Hang on tight, this is a lot but it gives you all the steps you need. Enjoy!

A couple of things to keep in mind as you read through and think about implementing this:

  • My blog uses WordPress, so some of the steps and screenshots are from that CMS. If you use something different and are not sure, please check with your web person first!
  • My blog has multiple categories which I explain how to set up for that scenario. However, if you have only one or no categories, that will cut down on some of the steps for you
  • My scenario assumes 1 blog post per day at most, or 1 blog post per category per day. If you are doing more, then sorry but that’s up to you to figure out the extra steps you might need if you want to include multiple posts in one email

Ok let’s get started!

Compliance Profile Topics

As mentioned above, if you only have one category you can skim through this, but make sure you have a Compliance Profile with a Purpose. Suggest you use Restrictive as the email enforcement model so you are only sending to people who have subscribed. If you have more than one category, log in to your website and make a note of the exact wording of these categories. We will need to make sure we have a corresponding Topic for each one linked to the Compliance Profile.

Click to view in detail

I have a Compliance Profile with a Purpose named Articles. This is where the Email Enforcement Model gets set to Restrictive.

Click to view in detail

Then we can add in the Topics. I have one that matches exactly the wording on the Category in WordPress.

Click to view in detail

Edit the Preference Centre to include all of the Topics for someone to opt in and out of, and a way to opt out of the overall Purpose to stop getting anything. Also make sure you create a Marketing form also including the Topics that you will add on your website for someone to subscribe in the first place!

Click to view in detail

Category Segments

Once your Compliance Profile is sorted with your Topics that match your Categories, you will need one Segment per Topic. Again, if you have no categories or only one, you just need one Segment. This is an example of one of mine. I have one for each of my Topics. Don’t try and rely on one as someone has the ability to opt in and out of different ones. Keep each Topic separate in a different Segment. Create the first one when save a copy, swap out the Topic and you are good! I always add in the first group so that I am only including people that are active and at least have something that ‘looks’ like an email address in that field. Publish all of your Segments. We will use these later in our Journeys.

Click to view in detail

Custom Blog Post Table

The way this process will work is to store information about the new blog posts published on my website within Dynamics 365. This needs a simple custom table. Most of these fields should be self explanatory. If you have one category, then you wouldn’t need the Blog Topic field which is a lookup to the Topic table. If you do not use featured images on your blogs, then not much point in the Blog Image either (I do use them and wanted to display the image dynamically on the top of my emails). The Blog Category Name should be the same as the Topic, but I added just in case there was ever a mismatch so I could review any discrepancies.

Click to view in detail

The one field maybe not so obvious is the one called New Post. This is a formula field. We need something in the system to determine if the blog post created is NEW and should be sent out, vs one from last week or last month. In all of my tests (LOTS OF TESTS!) I tried different things using the Created On date but either posts were not sent, or they were sent twice. This uses a simple formula to see if the Created On date is within the past 24 hours. If it is, the field will show Yes, otherwise No. We can then use this field later on to filter which blog to send out when the time is right.

Click to view in detail
If(
    DateDiff(ThisRecord.'Created On', Now(), TimeUnit.Hours) <= 24,
    true,
    false
)

Custom RSS Feed

You are doing well! Glad you’ve stuck with this. 🥰 This next part, you can decide if you even want or need. As mentioned above, I wanted to pull in the URL for my featured image, something that typically is used to display at the top of a blog post. I wanted to use this in my emails so each one was unique and tied in with the blog post. The following are all of the values that you can get back from the RSS Feed connector in Power Automate (which we will use to create the new Blog Post record in D365). There isn’t much we can use, but a standard feed passes the same link in to the Primary feed link and the Feed ID. I figured I could take advantage of that if I created my own custom RSS Feed instead. I also didn’t want the standard feed summary which is an excerpt from the blog, but I wanted the full first paragraph instead.

Click to view in detail

This one, DEFINITELY consult with someone who knows what they are doing when it comes to editing files in your WordPress theme. These changes need to be added to the functions.php file. This is a file that if you mess it up, YOU CAN BRING DOWN YOUR ENTIRE WEBSITE. It should be done by someone who has access to the server who can revert the changes quickly if needed. You’ve been warned! First, the following should be included in the file which adds a new function to create a custom feed. I called mine realtime-rss.

function init_rss_feed_custom() {
    add_feed('realtime-rss', 'add_rss_feed_custom');
}
add_action('init', 'init_rss_feed_custom');

Then we need another function that defines what is going to go in to that custom rss feed. You can see where I am pulling in the featured image, the category, and the first paragraph from the blog post.

function add_rss_feed_custom ( ) {
  header('Content-Type: application/rss+xml; charset=UTF-8');
  ?>
<rss version="2.0"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
        <?php do_action('rss2_ns'); ?>>
<channel>
        <title><?php bloginfo_rss('name'); ?> - Custom RSS Feed</title>
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php bloginfo_rss('url') ?></link>
        <description><?php bloginfo_rss('description') ?></description>
	<copyright> © 2020 - <?php echo date('Y'); ?>  || All rights reserved.</copyright>
        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
        <language><?php echo get_option('rss_language'); ?></language>
        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
        <?php do_action('rss2_head'); ?>
<?php while(have_posts()) : the_post(); ?>
    <item>
        <title><?php the_title_rss(); ?></title>
		<?php 
        // Featured image URL
        $featured_image_url = get_the_post_thumbnail_url(get_the_ID(), 'full') ?: ''; 
        ?>
        <link><?php echo esc_url($featured_image_url); ?></link>
        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
        <dc:creator><?php the_author(); ?></dc:creator>
	 
        <guid isPermaLink="true"><?php the_permalink_rss(); ?></guid>
        <category><?php $category = get_the_category(); echo $category[0]->cat_name; ?></category>

        <?php 
        // First paragraph for description
        $content = apply_filters('the_content', get_the_content());
        preg_match('/<p.*?>(.*?)</p>/i', $content, $matches);
        $first_paragraph = $matches[1] ?? strip_tags($content); 
        ?>

        <description><![CDATA[<?php echo $first_paragraph; ?>]]></description>
        <content:encoded><![CDATA[<?php echo $first_paragraph; ?>]]></content:encoded>
        <?php rss_enclosure(); ?>
        <?php do_action('rss2_item'); ?>
    </item>
<?php endwhile; ?>

</channel>
</rss>
  <?php

}

One thing that can be forgotten is after updating the functions.php file, go to the permalink page in the settings of WordPress and just click Save Changes (don’t change anything on this page). This will force an update that then generates that new custom rss feed link for you.

Click to view in detail

The link to the custom rss feed will be your main website url followed by whatever you added in the first function added to the functions.php file. So in my case realtime-rss. It should show a list of all your posts then you can be happy it’s working. Your fun here is done. And welcome to the world of WordPress development! 🚀

Click to view in detail

Power Automate Flow

Now that we have a custom rss feed (or just use your standard one if you prefer) we can create a flow in Power Automate. Use the RSS Connector and add in the URL for your feed, and pick PublishDate as the option.

Click to view in detail

Now we need to do a List rows action from the Dataverse connector to find a Topic with the same name as the Category. This is where, if you use more than one Category it might be a bit more challenging. The categories are sent through the RSS Feed connector as a string array. I am going to filter the Topics to find one where the name equals the first category found in the array.

msdynmkt_name eq '@{first(triggerOutputs()?['body/categories'])}'
Click to view in detail

Once I have that. I am then using the Add a row action from the Dataverse connector to add this new blog in to D365. You can see where what I am populating pretty clearly, but the Blog Category Name (if you are using this) is the expression used above for the first category which would be a string. The Blog Topic is a lookup to the Topic record so needs to be set with the name of the Topics table then the GUID of the Topic that was found in the step above.

msdynmkt_topics(@{first(outputs('Find_Topic')?['body/value'])?['msdynmkt_topicid']})
Click to view in detail

Once you publish a new blog post on the website, the new blog post seems to be getting created within 30 minutes or so after that. You can see the New Post column which is updated automatically to Yes for the new post.

Click to view in detail

Custom Email Showing Blog Post

OK we are ALMOST there, just a few more pieces, I promise. 🥳 Now we need to have an email to send out that includes the new blog post. If you do not have more than 1 category for your blog post, just one is fine. If you do use categories, you will need one per category/topic so I suggest creating most of this as a template first. You will need to add a List. The list will be of Blog Posts which you will get to via Contact, then through to the Owning Business Unit, then find the Blog Posts table. You will need to add in all of the columns that you add to the Blog Posts table and want to use. Suggest setting the Max amount of items to 1. Again, if you publish more than one blog with the same category in a day and want to display multiple on one email you could, you just need to figure out what the formatting of that email looks like. Once you have the list, click on Add list filter.

Click to view in detail

If you are not using Topics, ignore that part, otherwise, be sure to filter with the Topic this email is for. Then add in the New Post field and filter where it equals Yes. Click Done.

Click to view in detail

Now click Save & copy and you will get this code generated for you. Copy this and paste it somewhere.

Click to view in detail

Just because the code is generated as you see it above, that doesn’t mean it needs to stay in that format. Below you can see where I have used the Blog Subject in the email subject, and then used other fields in different places. What you DO need to have is the {{#each BlogPosts}} at the start of using any of the values, then end it with {{/each}} like you see in the subject. Then same with the body of the email. The very top of the email starts that way, then the end of the each is all the way down at the bottom in the footer so that I can display the category name right at the bottom in the unsubscribe area. The button for READ MORE is a URL button but has {{BlogPosts.BlogURL}} on it to pull dynamically.

Click to view in detail

The image at the top also is set dynamically from a value in the list we created.

Click to view in detail

Do the same with one email per Topic, save and publish them. I am sure you will do this, but perhaps just created one to start with, with a test Journey with yourself in a segment so you can make sure all of this works for making it live for every single one for real contacts. I took about 3 weeks testing all of this before launching it live for real subscribers!

Create One Or More Journeys

Now we need at least one Journey, or one per Topic if you have more than one category. Start your Journey with a Segment and pick one that relates to one of your Categories/Topics. I think this is also the second time ever I have set up a repeating journey. This should repeat every day.

Click to view in detail

Then add in an attribute branch as the next step.

Click to view in detail

On the first branch, we are going to check if there is a new post, one where New Post equals Yes for the same Topic. In the Make condition on attribute, go through from Contact to Owning Business Unit then Blog Posts then click on Blog Topic and then the blue option which gives you a lookup to pick the exact Topic.

Click to view in detail

We also need to filter things further. You can see a note below under Filter record that says If multiple records are returned, only one will be selected. Define condition(s) to select one record. This is what we need to do. Otherwise it could end up sending out an old post or incorrect post for a different Topic/Category. You can then filter to show New Post = Yes. Perhaps I am over cautious, but I also add in the Blog Topic again JUST IN CASE. Might be overkill, but I want to be sure I am only sending out those new posts. You might have other conditions you want to use, but this gives you the option. Also set the Order by to Created On Descending so it would find the most recent one first. Again, could be overkill, but just in case I forget and have multiple New Posts, this would kick in.

Click to view in detail

Now I add in the Email to the Journey. The Other branch should be empty.

Click to view in detail

Once it starts running each day, the attribute check will see if there is a new blog to go out. If there is, the segment members will go down the left path and send the email. If not, they will go down the right path and exit out without an email.

Click to view in detail

Be sure to set up one Journey per Topic. Then sit back and wait for your blogs to go out. The finished result? A lovely easy to read email about a new post with a link to read it all, the featured image displayed at the top. Perfection 😍

Click to view in detail

Original Post http://meganvwalker.com/send-blog-post-emails-via-rss-feeds-and-realtime-marketing-journeys/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
October 2025
MTWTFSS
   1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31   
« Sep   Nov »
Follow
Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...