cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EaEberhardt
Regular Visitor

Extracting all links from Teams Posts

We have a Teams Channel where daily posts are made with links to various websites. Is it possible to create a Power Automate flow that is automatically triggered by a new post in Teams to extract the links that are posted?

1 ACCEPTED SOLUTION

Accepted Solutions

@EaEberhardt  please follow below steps to extract the link

 

1.  Add Initialize Variable action and name the variable as link

annajhaveri_0-1669215770935.png

 

2. Add Compose action and configure below expression

split(triggerOutputs()?['body/body/content'],'<a ')

annajhaveri_1-1669215799119.png

 

3. Add Apply to each loop and use outputs of compose action in it

4. Add Condition action on left side select Current Item from Dynamic content, in dropdown select startswith and on right side provide value href

5. Under yes branch of condition, add Set Variable action, select Link variable and configure below expressions in it

replace(replace(substring(items('Apply_to_each'),0,indexOf(items('Apply_to_each'), ' ')),'href="',''),'"','')

 

See screenshot below for full flow

annajhaveri_2-1669215966274.png

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
annajhaveri
Community Champion
Community Champion

@EaEberhardt  You can create a flow with trigger "When a new channel message is added". So that flow triggers everytime a new channel message is posted. In terms of extracting link, do you expect multiple links in single message?

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.
EaEberhardt
Regular Visitor

Thank you for the reply. There is only one link per post. But it can be part of a longer text

@EaEberhardt  please follow below steps to extract the link

 

1.  Add Initialize Variable action and name the variable as link

annajhaveri_0-1669215770935.png

 

2. Add Compose action and configure below expression

split(triggerOutputs()?['body/body/content'],'<a ')

annajhaveri_1-1669215799119.png

 

3. Add Apply to each loop and use outputs of compose action in it

4. Add Condition action on left side select Current Item from Dynamic content, in dropdown select startswith and on right side provide value href

5. Under yes branch of condition, add Set Variable action, select Link variable and configure below expressions in it

replace(replace(substring(items('Apply_to_each'),0,indexOf(items('Apply_to_each'), ' ')),'href="',''),'"','')

 

See screenshot below for full flow

annajhaveri_2-1669215966274.png

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

@EaEberhardt  did you get chance to apply above solution?

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

Thank you! Works perfectly!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,628)