Email recipients based on Page properties - smart values

Ashok Rao December 26, 2024

Hi,

I am new and not very fluent in smart values, so would appreciate some help:

I have created a confluence template with a page properties macro. In that macro is the project team (i.e. sales, technical lead, project manager, etc). These are often different for each project.

I would now like to use the @username mentions in that page properties macro to send a standard email only to those users.

I have looked on the confluence documentation for smart values, but I cannot find the answer to the problem. I know I am making an error in the syntax, as every time I run the automation rule, i get the following error:

"Unable to send the email as the recipient's email address wasn't provided".

Thanks,

 

2 answers

1 accepted

0 votes
Answer accepted
Tomislav Tobijas _Koios_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 27, 2024

Hi @Ashok Rao ,

On top of what Valerie sad, you can try following the steps described by Manon on this question: Confluence automation - Send email with title based on input of page properties macro 

While it's not the prettiest solution, until CONFCLOUD-78944 is released, this could be a way to go.

Cheers,
Tobi

Ashok Rao December 27, 2024

Hi @Tomislav Tobijas _Koios_ ,

Thanks for the response.

That was also my question, from a few weeks ago. :)

It's what made me think that a solution was possible, But even with that, I cannot find the exact syntax to make it work. Every try I've done results in the same error message in the log: "Unable to send the email as the recipient's email address wasn't provided"

Tomislav Tobijas _Koios_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 27, 2024

My apologies m8! Didn't even consider checking who's the author of the question 🤦‍♂️

I think I'll have some extra time in the next couple of days so I might test it out and try to find the 'workaround'. If I manage to get it to work, I'll share it here.

Like Ashok Rao likes this
Tomislav Tobijas _Koios_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 28, 2024

@Ashok Rao I've managed to get it to work. Although, a slight notice is that this solution is based when only one user is mentioned in Page Properties table row. In order to get it to work for any number of mentioned users, you would need to adjust parsing content from the page (in this example variable part) and then probably use branch based on string of account IDs which would be stored inside mentioned variable.

Anyway, all of this is based on answer Manon provided with additional part of getting account email from account ID which is visible in the page body part.

Here's a page example:

2024-12-28 10-20-04.png

 


 

Firstly you can create variable and use the following:

{{page.body.storage.substringBetween("Client names</strong></p></th><td><p><ac:link><ri:user ri:account-id=\"","\"")}}

This would get you ID of the account that was mentioned.
*👆 change string Client names if necessary; this is just a name I've used in my page properties table (see first screenshot)

2024-12-28 10-09-37.png

 

Next, you would need to send a web request to the Atlassian site to get user details. For this, use account ID which is stored in previously created variable. Web request URL would look something like:

https://sitename.atlassian.net/rest/api/3/user?accountId={{accountId}}

For authorization part, take a look at the following article: Automation for Jira - Send web request using Jira REST API 

2024-12-28 10-09-57.png

 

And lastly, you can then use 

{{webResponse.body.emailAddress}}

smart value and add it to "To" part of the Send email action in automation.

2024-12-28 10-10-02.png

 

Hope this helps.

Cheers,
Tobi

Like # people like this
Ashok Rao January 2, 2025

Hi @Tomislav Tobijas _Koios_ 

Sorry for the delay in responding, was on holiday :).

But thanks a lot! It's working perfectly.

Regards,

Ashok

Tetiana T_ January 9, 2025

-

Tetiana T_ January 9, 2025

Hi @Tomislav Tobijas _Koios_ 

I can’t express how grateful I am for your detailed instructions! I managed to make it work as well, so thank you so much!

I also want to say a big thanks to @Ashok Rao for starting this topic—it’s really exactly what I needed.

I was wondering if you could show me the principle for this part:
"you would need to adjust parsing content from the page (in this example variable part) and then probably use branch based on string of account IDs which would be stored inside mentioned variable."

I’m new to Confluence automation and all my attempts to make the flow match my use case - failed. Here’s my use case:

  • All people mentioned in the specific row of a Page Properties table need to review a page when the status changes. They all need to receive an email notification with a review request.

It works perfectly when there’s only one reviewer, but there can be more. I tried using branches but couldn't make it work, could only get 400 :) I’d really appreciate a step-by-step explanation or guidance on how to adjust this for multiple reviewers.

Thanks again for all your help!

Best regards,
Tania
rule example.jpg

Like Ashok Rao likes this
Tetiana T_ January 9, 2025

I have found a solution that works for us. It might not be the best but it works :)
We set a limit for reviewers and added a variable for each reviewer.

{{page.body.storage.substringBetween("Reviewer 1</strong></p></th><td><p><ac:link><ri:user ri:account-id=\"","\"")}}

The same for Reviewer 2 and Reviewer 3.
All mentioned reviewers are notified via email when the page status changes.

Key points to note:

  1. Ensure there is no space before the mention. Otherwise, the data won't be parsed and there will be an error.
  2. Select 'Continue running the rule even if the request response is not successful (i.e., non-200 response).' This guarantees that all steps are attempted to be executed.

 my solution.jpg

Like Ashok Rao likes this
Ashok Rao January 10, 2025

Hi @Tetiana T_ ,

I'm pleased to hear this topic helped you, but of course credit goes to @Tomislav Tobijas _Koios_ for the detailed instructions. :)

I also have not managed to send a mail to multiple people, so if someone could add instructions for that, that would be great. I would be curious how exactly you do that.

But, just like you, I have also solved it by sending multiple different mails inside the same automation rule. This was actually very suitable for my use case, because I could then customize the mail that I would send to each team member, specific for their role in the project.  

Like Tetiana T_ likes this
Tetiana T_ January 10, 2025

Thank you for your response @Ashok Rao! That’s a great workaround, especially since it allows tailoring communication for each recipient.

However, after testing the setup with my team today, I noticed an issue I haven’t been able to resolve yet. The system successfully extracts and sends emails to my address but fails with others. After the successful web request, at the Send email step, it returns: Unable to send the email as the recipient's email address wasn’t provided.

I’ll keep working on figuring out the cause and hopefully resolve it soon.

Best regards,
Tetiana

0 votes
Valerie Knapp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 26, 2024

Hi @Ashok Rao , thanks for your question 

Please can you share some screens of the automation rule so we can see how far you have got and how you want the rule to work? For example, what is the trigger? Are there any conditions? I appreciate you're asking for help with the actions but for us it's helpful to see the whole picture. 

Thanks

Ashok Rao December 26, 2024

Hi @Valerie Knapp 

Yeah, sure:

So, in the template, I have the page properties macro below:

Schermafbeelding 2024-12-26 141308.png

I want to send a mail to the users that are filled in.

Schermafbeelding 2024-12-26 141717.png

 

Not sure where I'm going wrong here. As I said, I'm not really very experienced in the syntax of smart values.

Thanks,

 

 

 

 

 

Valerie Knapp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 26, 2024

Hi @Ashok Rao , sorry, after checking the smart values documentation for Confluence, it seems you can't access the Page Properties Macro values yet. 

There is a suggestion for this open with Atlassian, which you can vote on https://jira.atlassian.com/browse/CONFCLOUD-78944 

For now, these are the smart values that are supported https://support.atlassian.com/cloud-automation/docs/smart-values-in-confluence-automation/ 

Sorry to disappoint. 

Cheers

Ashok Rao December 26, 2024

Hi @Valerie Knapp ,

Thanks for confirming this. At least I know now to stop trying and wondering why it won't work...

 

Like Valerie Knapp likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events