Whats the best way to run an automation when a blog post goes live? We schedule our posts so we are unsure of the best way to approach this issue. There is no "When Blog Post Goes Live" API event.
Whats the best way to run an automation when a blog post goes live? We schedule our posts so we are unsure of the best way to approach this issue. There is no "When Blog Post Goes Live" API event.
Have you had a look at `BlogPost.BeforeUpdate` ? You may then be able to check things such as context_v2_automationTrigger.Arguments.IsPostEnabled and context_v2_automationTrigger.Arguments.PublishedDate in the automation.
We use these kinds of checks when blogs are posted on the element14 Community to synchronise the actual publish date with the current date when a blog post is published from draft, as otherwise the blog publish date ends up being when the draft was first created, but these properties may help steer you towards acting on the blog's intended publish date to know when it's published.
So you're talking when you publish it but the publish date is set in the future? Depending on how fast you want to notify people, you could have a job that runs every hour and looks for posts with publish dates/times that were within the last hour or so. Could get a little tricky if your job does not execute right on time.
But you could query the blogposts, sort by date, and as soon as you find a publish date that is out of bounds, just exit the loop. You could even set an extended attribute on the post to flag if the automation executed on the post to avoid it being hit twice.
This is an interesting idea. I didn't think the post going live would trigger the BeforeUpdate event. Is context_v2_automationTrigger.Arguments.IsPostEnabled set to true when the post is published?
Thats a good idea! We could set a flag when the blog notifications have been sent out so we don't over notify as well.
We use these kinds of checks when blogs are posted on the element14 Community to synchronise the actual publish date with the current date when a blog post is published from draft, as otherwise the blog publish date ends up being when the draft was first created,
That's an awesome idea, thanks for mentioning this, Christopher G. Stanton! That situation is a common struggle for members who are not as familiar with posting blogs, this is a great idea to alleviate that issue.
Stephen Vicino That's how we're able to compare and check it, yes.
Thank you! We ended up going with Luke R Davidson 's solution and it worked well because it runs every 5 mins to check for newly posted blogs.
Excellent!