How mention a group of teams in a flow of power automate? - microsoft-teams

I create a group for question in Microsoft teams, the name for this group is "Information Comunity". In this group, I put a Microsoft forms to capture the question.
Then, I create a Flow with Microsoft power Automate. This flow send send a message in "information Comunity" group, like this
I need to mention a other group in this message, the name of the other group is "Gerencia de information", this group will answer the question. But I don´t know how to capture the name of thisgroup or how i get the id of the other group.
Can you help me please.
Thanks for your help.

1 The Flow will use a manual trigger.
2.After that the Flow initializes three variables as below:
3.First make sure that you invoke the HTTP request action connection using https://graph.microsoft.com as the Base Resource URL and Azure AD Resource URI values like in the screenshot below:
4.Then invoke the HTTP request
Body of the request:
{
"body": {
"content": "This is Flow mention channel test, <at id=\"0\">RA Experts</at>",
"contentType": "html"
},
"mentions": [
{
"id": 0,
"mentionText": "RA Experts",
"mentioned": {
"conversation": {
"id": "19:ac7b9c53a099498f9e08679e58f1f7fc#thread.tacv2",
"displayName": "RA Experts",
"conversationIdentityType": "channel"
}
}
}
]
}
Result:

Related

Teams Graph API, how to place an outgoing call on Hold

I am using the graph API to place an outgoing call from a BOT to a Teams user, with this API :
ret = await graphServiceClient.Communications.Calls
.Request()
.AddAsync(call);
This works OK, and I receive callbacks to say the call is a) establishing and then b) established.
However, if I wish to place this call on Hold from the BOT using the "Participant.StartHoldMusic" call, (see https://learn.microsoft.com/en-us/graph/api/participant-startholdmusic?view=graph-rest-1.0&tabs=csharp#request)
this does not appear possible, because the participant id is needed and this is not being passed with either of the two callbacks mentioned :
Establishing
{
"#odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"#odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resource": "/app/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceUrl": "/communications/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceData": {
"#odata.type": "#microsoft.graph.call",
"state": "establishing",
"callChainId": "fe6f4ad4-2187-45d0-967a-af93b0d9bca6"
}
}
]
}
Established:
{
"#odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"#odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resource": "/app/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceUrl": "/communications/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceData": {
"#odata.type": "#microsoft.graph.call",
"state": "established",
"mediaState": {
"#odata.type": "#microsoft.graph.callMediaState",
"audio": "active"
},
"callChainId": "fe6f4ad4-2187-45d0-967a-af93b0d9bca6"
}
}
]
}
Also if I look at the object returned from the API to create the call (ret) it shows :
i.e. the target participant id is null.
Furthermore if I try to poll the call object to obtain the participants using the API
graphServiceClient.Communications.Calls[callid].Participants
.Request()
.GetAsync();
The participants collection comes back as null.
How can I place a call on hold using the graph API, if I have no Participant id ?
Update:
It was suggested that I treat the "MyParticipantId" as the participantid of the external party. After establishing a call to a user I tried to hold the call using the MyParticipantId field of the call, with
This results in an exception, code 8522 "Participant not found"
This startHoldMusic API only supports group call.
For P2P call (bot calling a Teams user) its not supported.
For group call, roster update will always happen so that bot is able to get participant id for any of the participants in the call.
This hold music feature is not to put user's Teams client on hold. The target Teams user will still be "active" in the call, but start hearing music instead of others talking.
To make P2P working in this way, bot can just call PlayPrompt API to play audio, since there is no other people in the call.

Dynamic typeahead in Adaptive Card Task flow

I'm trying to implement the dynamic typeahead search as was shown on the below resources:
https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/dynamic-search?tabs=desktop%2Ccsharp
https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-type-ahead-search-adaptive-cards/csharp
I'm having the following Adaptive Card returned from the OnTeamsMessagingExtensionFetchTaskAsync (from message action):
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"id": "choiceSelect",
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Choice 1",
"value": "Choice 1"
},
{
"title": "Choice 2",
"value": "Choice 2"
}
],
"placeholder": "Placeholder text",
"style": "filtered",
"choices.data": {
"type": "Data.Query",
"dataset": "cases"
}
}
]
}
Card is rendered correctly, but when I start typing, I'm getting the following results:
No request is being made. I was trying to debug the JS, but it is troublesome for me - I couldn't pinpoint the exact place it fails, but got these symbols to lookup: executeSearchInvoke, enableAppPermissionEnforcement and enableTenantSettingsForBots in 3.2-app.min.js.
Can anyone point me in the right direction? Is there some kind of dependency or permission I should add to the bot? Some setting in Teams Admin Center? I can add that static typeahead works flawlessly, but I need the dynamic one (big data collection to query).
EDIT:
I have confirmed that the app is added to the team (it is visible on the list of apps in team settings); I've removed and added it again just in case. I am still getting the same results.
List of permissions visible from the App details page:
This app will have permission to:
Receive messages and data that I provide to it.
Send me messages and notifications.
Access my profile information such as my name, email address, company name, and preferred language.
Receive messages and data that team members provide to it in a channel.
Send messages and notifications in a channel.
Access this team's information such as team name, channel list and roster (including team member's names and email addresses) - and use this to contact them​.

Create MSTeams Personal chat with customized name

We are trying the following payload using MSTeams Bot access Token to create the Personel chat Room with the provided topicName.
Request : POST /v3/conversations
{
"bot": {
"id": "28:XXXXXXXX-a2Xe-460b-8793-XXXXXXXXXXXX",
"name": "XXXXXXXX"
},
"isGroup": false,
"members": [
{
"id": "29:18KXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"name": "Jane"
}
],
"topicName": "News",
"tenantId": "XXXXXX-XXXX-XXX-829b-5131e9a77XXX"
}
In response we got the resource id and we can post Bot message using that Id. But that message is always shown in the Personal Chat \room and it is not creating c chat with the topicName.
Is there any other permissions we need to add ?
To create a chat with customized name you should have minimum 3 participants[Including you]. In the above request only one user is there, that is why it becomes one-one personal chat between you and Jane.

Cannot send messages in other channels except General msbot for teams (nodejs)

I have created a bot for teams and added it to a channel (testChannel1) as a tab (using a configuration page). I have received a ConversationUpdate event to my server. When I try to send message using the context object that I have received in ConversationUpdate event the message was sent in General channel instead of testChannel1. I have added my bot to testChannel1 but I dont know why the message is sent in General. I am also not able to get the channels list using that context object it is throwing error Error: This method is only valid within the scope of a MS Teams Team..
contextActivityObject :- {
"membersAdded": [
{
"id": "28:[guid]"
}
],
"type": "conversationUpdate",
"timestamp": "2020-04-24T12:00:06.7125247Z",
"id": "f:[guid]",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/in/",
"from": {
"id": "29:[id]",
"aadObjectId": "[guid]"
},
"conversation": {
"isGroup": true,
"conversationType": "channel",
"tenantId": "[guid]",
"id": "19:aba[id]#thread.tacv2"
},
"recipient": {
"id": "28:[guid]",
"name": "teststandups"
},
"channelData": {
"team": {
"aadGroupId": "[guid]",
"name": "nikhilp",
"id": "19:aba[id]#thread.tacv2"
},
"eventType": "teamMemberAdded",
"tenant": {
"id": "[guid]"
}
}
}
The scope I have provided for my bot is Team
I would be thankful for any help
So you've asked a couple of questions, I'll try answer as best as possible. Basically, that Conversation ID (19:aba[id]#thread.tacv2) is unique per channel, so if you're using the "General" channel one, it will for sure go into General.
To find out how to get the channel Ids, have a look at Get the list of channels in a team. That will show you -how- to get the info, but you need to get a trigger in order to be able to make that call. To do that, the best way is to hook into one of the triggers, like receiving a message from a user, or being added to the team. Included in these set of events, are channels being added and deleted. See more here.

Microsoft Graph - Can't read/write the calendar of other users

I have a web app registered on Azure with the goal of being able to read and write the calendars of other users. To do so, I set these permissions for this app on Azure.
However, when I try to, for example, create a new event for a given user, I get an error message. Here's what I'm using:
Endpoint
https://graph.microsoft.com/v1.0/users/${requester}/calendar/events
HTTP Header
Content-Type application/json
Request Body
{
"subject": "${subject}",
"body": {
"contentType": "HTML",
"content": "${remarks}"
},
"start": {
"dateTime": "${startTime}",
"timeZone": "${timezone}"
},
"end": {
"dateTime": "${endTime}",
"timeZone": "${timezone}"
},
"location": {
"displayName": "${spaceName}",
"locationEmailAddress": "${spaceEmail}"
},
"attendees": [
{
"emailAddress": {
"address": "${spaceEmail}",
"name": "${spaceName}"
},
"type": "resource"
}
]
}
Error message
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store.",
"innerError": {
"request-id": "XXXXXXXXXXXXXXXX",
"date": "2018-07-11T09:16:19"
}
}
}
Is there something I'm missing? Thanks in advance for any help!
Solution update
I managed to solve the problem by following the steps described in this link:
https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_service
From your screenshot it's visible that you used application permission (although it'd be nice to include this information in your question):
Depending on kind of the permission you have given, you need to use proper flow to obtain access token (on behalf of a user or as a service. For application permissions you have to use flow for service, not on behalf of a user.
You can also check your token using jwt.io and make sure it's payload contains appropriate role. If it doesn't, it's very likely you used incorrect flow.
Regarding the expiration time of it, you may have found the information about refresh token (for example here). Keep in mind that it applies only to rights granted on behalf of a user. For access without a user you should make sure that you know when your token is going to expire and request a new one accordingly.

Resources