Automation rule: performing an action when a blog post is published with a specific label
Asked by Jared Lumpe:

I'm trying to set up an automation rule to send an MS teams message when a blog post with the "announcement" label is published in a specific Confluence space. I have set up the rule to use the "label=announcement" CQL condition, but it is not triggering when it is supposed to.

Here is a screenshot showing how I have the rule set up:

![image.png](/t5/image/serverpage/image-id/305330i6D95D924CBC85848/image-size/large?v=v2&px=999 "image.png")

You can see here I added some logging actions to verify that the problem is not with the MS teams message action. Note that I clicked "validate query" on the CQL query condition and it says "Valid query. 2 contents found." Clicking this link shows two existing blog posts that match my intended criteria.

This is an entry in the audit log for a blog post which should have triggered the message but did not:

![image.png](/t5/image/serverpage/image-id/305329iA69F1C03F390C34A/image-size/large?v=v2&px=999 "image.png")

The log shows the following condition evaluated in the IF block:

```
(id = 33947802 AND label=announcement) AND space in ("BIOIN")
```

If I use this exact query to do a CQL search using the REST API I get the expected single result which is the blog post that triggered the action.


Answers:
author: Shawn Doyle - ReleaseTEAM
body: Looks like you validated the IF is being triggered and the Audit log is being updated. I would look for some evidence that Confluence tried to send the message to Teams.

I would verify that the Teams connection is configured correctly and test it outside of an automation. I'd also move the audit log (or add a second one) to after the Teams call.

comments: author: Jared Lumpe
body: If you look at the audit log, it displays the message "Blot post is **not** an announcement" which comes from the log action in the "else" block. Unless I've structured the if/else wrong I think this means I'm not hitting the message action. I have also verified the Teams webhook is working independently.


author: Shawn Doyle - ReleaseTEAM
body: Ah, I mis read this statement "This is an entry in the audit log for a blog post which should have triggered the message but did not" to mean the logging step you added had triggered.

Then, I agree it's your IF statement. It is either a race condition of the label being added and the IF not seeing it, or the IF is running off the information as it has when the automation originally fired.

Either way, I would not trust the label to exist by the time the IF is tested.


author: Jared Lumpe
body: Thanks Shawn. If I can't trust the label to exist, how would you suggest I go about accomplishing this?


author: Shawn Doyle - ReleaseTEAM
body: You can test by attaching the label before publishing. Not a great option, but see if that would work. Or experiment with the title or body and see if you can trigger off of that.


author: Jared Lumpe
body: Thanks for the help Shawn. What I was doing was attaching the label prior to publishing, so it seems like that information should be available when the rule is running.

Since I couldn't get this to work I'm instead having people attach the "announcement" label strictly *after* publishing the blog and then using the "Blog labeled" trigger for the rule.


Tags: automation

cloud

confluence-cloud

cql