Skip to main content

Notifications

Calling Actions from Copilot Studio
Unanswered

How to create a MS Teams with Flow

Posted on by 179

Hi,

 

Can someone please tell me how can I pass the following information to Flow using Power virtual agent. 

1.  Teams Type- Private or Public

2.  Team Name

3. Description

4. User Id of the person who is using the virtual agent

 

Please see the attached screenshot of the Virtual agent where I have defied the above information and the Flow HTTP action that I required above information to get in.

Categories:
  • MarKol Profile Picture
    MarKol on at
    Re: How to create a MS Teams with Flow

    It looks like a similar problem was solved in this post - the use case is about reading records from Dynamics CRM, but PVA passing the AuthToken to a flow and using this AuthToken in an HTTP Request call to an API is the same:

     

    https://powerusers.microsoft.com/t5/Power-Virtual-Agents-Forum/How-to-get-PVA-to-authenticate-user-in-portal/m-p/420988#M340

  • MarKol Profile Picture
    MarKol on at
    Re: How to create a MS Teams with Flow

    @ for FYI

     

    Hi Vidanaw,

    there are couple of places where this error could be coming from.

     

    1. Authentication in PVA - I assume you have already set it up and the PVA is passing a non-empty String value for the token to your flow. You can verify that the token is non-empty in flow by looking at the flow run.

     - this blog post will help you with setting up Authentication with Azure Active Directory in PVA step by step:

    https://poszytek.eu/en/microsoft-en/office-365-en/pva-en/pva-series-authentication-in-power-virtual-agent/

     

    2. Passing a token to a Graph API call  - there are 2 ways of doing this. You can either include your token in an Authorization header in your HTTP call, or you can use the Raw Authentication method.

     - The token is not usually passed in HTTP Request Body.

     

    See  this blog for an example on how how to pass a token to a Graph API call with Authorization header or by using Raw Authentication method:

    https://laurakokkarinen.com/calling-microsoft-graph-from-microsoft-flow-and-other-daemon-apps-with-delegated-permissions/

    The Blog section that has examples of both token-passing methods is called this:

    Include the access token in the request when making calls to Microsoft Graph

     

    This blog might be helpful to you in general, since it has other posts on Graph API and Teams in Power Automate (flow).

     

    Your flow scenario is quite deep, and it might be worth cross-posting this questions on Power Automate Community forum (https://powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/FlowCommunity) to get a deatiled solution faster.  Most flow specialists focus on posts at Power Automate forum rather than Power VA community.

     

    Hope this helps!

     

  • Vidanaw Profile Picture
    Vidanaw 179 on at
    Re: How to create a MS Teams with Flow

    @jpirelli all good except Auth part, When I try to create MS teams using Http Post , I m getting an error saying 

    error": {
    "code": "InvalidAuthenticationToken",
    "message": "Access token is empty.",
    "innerError": {
     
    As you mentioned, dont know is it possible to do this.
  • Vidanaw Profile Picture
    Vidanaw 179 on at
    Re: How to create a MS Teams with Flow

    @jpirelli @MarKol 

    {
    "type": "object",
    "properties": {
    "Team Name": {
    "type": "string"
    },
    "Team Type": {
    "type": "string"
    },
    "Team Description": {
    "type": "string"
    }
    }
    }
  • jpirelli Profile Picture
    jpirelli on at
    Re: How to create a MS Teams with Flow

    This is actually a complex workflow you have outlined.

     

    For authentication, you need to get that working, which is not trivial, then you need to query your directory for more information about the user from flow. I haven't yet worked out the details of this, but I am optimistic that I can use the auth token to query AD for more information about the users profile (alias, email address, etc)

    Regarding the auth Token, you can just send it as a string to flow, see attached. 

     

    I feel like this part is the most complex and where the bulk of your effort will be. Everything is in flow from that point forward as far as I can tell until you return the response back to the user.

     

  • MarKol Profile Picture
    MarKol on at
    Re: How to create a MS Teams with Flow

    Hi Vidanaw,

     

    Can you please share the image of your Response Node with "Advanced options" open? It is possible that your Response Schema (hidden under Advanced options) does not match the Response Body?

  • Vidanaw Profile Picture
    Vidanaw 179 on at
    Re: How to create a MS Teams with Flow

    @jpirelli Thanks for your reply.

     

    Please see attached screenshot for Virtual agent and Flow.

    See my Power virtual agent, do you know why I m getting a failure as marked on the red box.  

     

    Also can you tell me how can I pass the user ID (after the authentication) from Power Virtual agent to Flow to create the Team?

     

    Thanks.

  • jpirelli Profile Picture
    jpirelli on at
    Re: How to create a MS Teams with Flow

    I'd like to know a bit more information about what you are trying to do.

     

    In any case, you still need to address authentication as well as variables back and forth. For variables, you can use the templated flow inside actions to get started. Don't forget that in order to see that in your actions you will have to save it and import it into one of your solutions.

     

    You also might want to look at authentication, unless any bot user is allowed to create any teams? Seems like you might want to register your app and authenticate the user to ensure you are only provision the correct levels of access to them.

     

Helpful resources

Quick Links

Welcome to the Power Platform…

We are thrilled to unveil the newly-launched Power Platform Communities!…

Getting Started…

Welcome to the Power Platform Community! We appreciate your visit…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 138,287

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,172

Leaderboard

Featured topics