How to send a message to a teams channel via Power Automate

Martin Hirsch
Contributor
July 15, 2024

We are using connectors to send messages about new tickets to a teams channel. MS will not longer support this, so we have to use power automate. No i want to use webhooks, but in my workflow the followin error occurs:

Setting in Jira Automation:

image.png

 

ExpressionEvaluationFailed. The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression 'Test@{triggerBody()}' is of type 'String'. The result must be a valid array.

 

Any idea to this?

2 answers

2 accepted

1 vote
Answer accepted
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2024

Hi @Martin Hirsch  You have to use Workflow in MS Team , create flow similar to below screenshot : 

Screenshot 2024-07-15 at 5.37.42 PM.png

 

Screenshot 2024-07-15 at 5.39.06 PM.png



Martin Hirsch
Contributor
July 16, 2024

Thanks for help. Now i'm getting this error:

 

ExpressionEvaluationFailed. The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']' is of type 'Null'. The result must be a valid array.

Hugo Fernandes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 16, 2024

Is there an update about this issue?

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 16, 2024

@Martin Hirsch @Hugo Fernandes Try to add compose action before send each adaptive card and put dynamic content body only. It seems that body.attachment is not a correct dynamic content. 

Like Hugo Fernandes likes this
Andras M
Contributor
August 23, 2024

@Vikrant Yadav when selecting Body (with capital B?) for Compose as dynamic content (and also for Send each adaptive card)

compose-input.jpg

still I got an error message

ExpressionEvaluationFailed. The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@triggerBody()' is of type 'Object'. The result must be a valid array.

failed.jpg

 

Also, when selecting Compose Output for the Send each adaptive cart, got error


output.jpg

 

 

ExpressionEvaluationFailed. The execution of template action 'Send_each_adaptive_card' failed: the result of the evaluation of 'foreach' expression '@outputs('Compose')' is of type 'Object'. The result must be a valid array.
Like Vikrant Yadav likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 24, 2024

Hi @Andras M 

In Jira, Use Send Web Request action and in body select "Custom Data" . In Custom Data, capture only those fields in which you want to post on MS Teams Channel. 

In MS Team >> 

1. When a Teams Webhook request is recevied

2. Initialie variable >> Give name , type should be Object >> in value select Body dynamic content. 

3. Compose item : write expression >> variables('JiraData')?['Summary'] 

4. Post a message in a chat. In message i have selected Compose output.  

Screenshot 2024-08-24 at 10.24.21 PM.pngScreenshot 2024-08-24 at 10.25.33 PM.pngScreenshot 2024-08-24 at 10.25.51 PM.png

 

 

Like Andras M likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 24, 2024

Hi @Andras M  @Martin Hirsch  Checkout short video created for you : https://www.youtube.com/watch?v=7OAquAcJaAo

Like Andras M likes this
Andras M
Contributor
August 25, 2024

Hi @Vikrant Yadav thank for your time and effort, now the notification works perfectly with the solution you provided. Simple, but effective. Cheers

Like Vikrant Yadav likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 26, 2024

Thanks @Andras M  Glad to hear i am able to help you out!

Martin Hirsch
Contributor
August 26, 2024

Thank you very much. One problem: I'm getting two posts in teams. One with the summary ane another one with the issue key. But i don't have the issue key in the web message. Only the summary and the description.

Like Vikrant Yadav likes this
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 26, 2024

@Martin Hirsch  Might be two workflows are running that’s why two notifications are coming

Kindly check number of workflows are enabled. 

Like Martin Hirsch likes this
Martin Hirsch
Contributor
August 26, 2024

You are right. Thank you very much.

Like Vikrant Yadav likes this
0 votes
Answer accepted
Martin Hirsch
Contributor
July 15, 2024

 

 

Suggest an answer

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

Atlassian Community Events