Skip to main content

Notifications

Power Automate - General Discussion
Answered

Reply to ms teams message only if message is not posted by bot

(0) ShareShare
ReportReport
Posted on by 9

I setup a workflow which sends a reply if a keyword "help" is posted. However, the reply itself also contains the word "help" which then triggers and endless loop of bot messages

 

I thought to add a contrition which checks whether the message is posted by a normal user (then reply) or by a bot (don't reply), however I can't find to set such a condition

papanito_0-1700224066384.png

 

  • michael0808 Profile Picture
    michael0808 304 on at
    Re: Reply to ms teams message only if message is not posted by bot

    I guess I am too lazy to go through all that work. You taught me something as well 🙂 

  • papanito Profile Picture
    papanito 9 on at
    Re: Reply to ms teams message only if message is not posted by bot

    Ok I guess I found it, using the webapp and navigating to the Workflow "user" where I can find a "slug" in the URL. However, I see that when I write a message, the workflow runs trough, when I then do a reply it fails

    papanito_0-1700231859974.png

     

    Request to the Bot framework failed with error: '{"error":{"code":"ServiceError","message":"Unknown"}}'.

    papanito_1-1700231967029.png

     

  • michael0808 Profile Picture
    michael0808 304 on at
    Re: Reply to ms teams message only if message is not posted by bot

    Run the flow once without any checks. Check the output of the trigger and look for this section:

    michael0808_0-1700231304642.png

    That ID should be the ID of your workflows bot. 


    I hope this helps.

  • papanito Profile Picture
    papanito 9 on at
    Re: Reply to ms teams message only if message is not posted by bot


    Thanks for your help, not sure how to do that - I am very very new to the PowerBI stuff. I can see the workflow runs and see the input and output of each run, but somehow I don't see the ID of the "Flow bot"

     

    papanito_0-1700230697288.png

     

  • Verified answer
    michael0808 Profile Picture
    michael0808 304 on at
    Re: Reply to ms teams message only if message is not posted by bot

    You will first need to find the ID of the bot, then add the following to your trigger condition:

     

    @not(equals(triggerOutputs()?['initiator']?['user']?['id'], '213f53bf-7e17-486f-b792-c410b4e10cc9'))

     

    michael0808_0-1700226385005.png

    michael0808_2-1700226571429.png

     

    michael0808_1-1700226418328.png


    You can find the ID of the bot by having the trigger execute on a bots response at least once, and go into the output of the trigger to find the initaitor ID.

     

    Hope this helps!

     

  • Matthy79 Profile Picture
    Matthy79 4,178 on at
    Re: Reply to ms teams message only if message is not posted by bot

    You could add it to the trigger condition.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard