web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Call a Teams Chatbot v...
Copilot Studio
Unanswered

Call a Teams Chatbot via a Power Automate Flow

(0) ShareShare
ReportReport
Posted on by 7

Hi.

I created a chatbot using Power Virtual Agents and added it to a Teams channel. When someone posts a message on the Teams channel, I want to reply to that message using Power Automate. This Power Automate message should be able to @mention and call the chatbot. Is there a way to accomplish this?

 

Thanks in advance. 

I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Himashi,

     

    First of all great question, very interesting scenario 🙂

     

    You could use the Graph API and the Reply to a message in a channel method. In that request you can reply with an at-mention to the bot and add a topic trigger text.

     

    Below is a short example.

     

    1. Add a When a new channel message is added trigger action

     

    whenanewchannelmessageisadded02.png

     

    2. Add a Send an HTTP request action (Office 365 Groups Connector)

     

    Use the following URI & the POST method

    https://graph.microsoft.com/v1.0/teams/@{triggerOutputs()?['body/channelIdentity']['teamId']}/channels/@{triggerOutputs()?['body/channelIdentity']['channelId']}/messages/@{triggerOutputs()?['body/id']}/replies

     

    Use the json below for the body.

    Replace the variables with your values for the topic trigger phrase, bot name & bot app id.

    {
     "body": {
     "contentType": "html",
     "content": "<div><div><at id=\"0\">@{variables('BotName')}</at> @{variables('PVATopicTrigger')}</div></div>"
     },
     "mentions": [
     {
     "id": 0,
     "mentionText": "@{variables('BotName')}",
     "mentioned": {
     "device": null,
     "user": null,
     "conversation": null,
     "tag": null,
     "application": {
     "id": "@{variables('BotAppId')}",
     "displayName": "@{variables('BotName')}",
     "applicationIdentityType": "bot"
     }
     }
     }
     ]
    }

     

    atmentionbotviagraphapi.png

     

    Btw, I have also written a blog about this approach with a bit more details:

    https://www.expiscornovus.com/2022/06/10/mention-a-bot-with-a-flow/

     

  • Himashi Profile Picture
    7 on at

    @Expiscornovus Great and detailed solution. Thank you very much! 

  • ryeee Profile Picture
    3 on at

    @Expiscornovus 
    Thanks for the solution presented. However, it appears that this is not working as of this writing.
    I read your vlog and tried replicating the flow but was getting this error message.
    URI path is not a valid Graph endpoint, path is neither absolute nor relative or resource/object is not supported for this connector.
    I tested the uri through graph explorer and it works but does not with the http connecter in powerautomate.

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @ryeee,

     

    The action has changed and is now limited to only the groups resource. In this example we are not using that type of resource, that's why you are getting that error. You can replace this action by a HTTP action instead.

     

    That action is however part of a premium connecter and you would also need to register an app in Entra Id for the Oath authentication.

  • bruna_rs Profile Picture
    2 on at

    @Expiscornovus Could you please post this last solution?

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 265 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 240 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard