forked from linux/documentation
69 lines
2.9 KiB
Markdown
69 lines
2.9 KiB
Markdown
# Webhooks to Microsoft Teams
|
|
For the old MessageCard format used by some Apps - See the code snippet below.
|
|
|
|
Flows are always owned by its creator. Make sure to share it with people from your team. More information to that below.
|
|
|
|
## Configuring
|
|
Login to https://make.powerautomate.com/ with your AD Account used at PSI.
|
|
|
|
1. In the top right corner change the "Environments" to PPE-webhook
|
|
- There might be also a tst and prd environment. These are for agents and or powerbi workflows.
|
|
2. Click on Templates to the left and search for "Webhook", choose "Send webhook alerts to a channel" or "Send webhook alerts to a chat"
|
|
3. The flow will connect to Microsoft Teams -> Continue -> Create (Its a known bug that in non default Environments the chat / channel dialog is skipped. We configure it later)
|
|
4. Click Edit in the top left and delete all charts except the "When a Teams webhook request is received"
|
|

|
|
5. Click the "+" and search for "Card" and choose "Post card in chat or channel"
|
|

|
|
6. Post in, chose Chat or Channel, chose Team and or Channel / Chat where to post the message
|
|
7. In the Adaptive Card field press "/" and chose "Insert dynamic content" and from the bottom chose "Attachments Adaptive Cards"
|
|
- If other parameters were added you chose the wrong template. remove them all and continue with step 9
|
|
9. Collabse the configuration tab and press save in the top right.
|
|

|
|
10. When you click on the top flow you can copy the HTTP URL where to send the webhook to, that you can use in your application.
|
|
|
|
If your application is using the old "MessageCard" Format, press "/" in the Adaptive Card field and chose Insert expression and paste this:
|
|
|
|
```
|
|
concat(
|
|
'{
|
|
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
|
"type": "AdaptiveCard",
|
|
"version": "1.4",
|
|
"body": [
|
|
|
|
{
|
|
"type": "TextBlock",
|
|
"size": "Medium",
|
|
"weight": "Bolder",
|
|
"text": "', coalesce(triggerBody()?['title'], triggerBody()?['summary'], 'Notification'), '"
|
|
},
|
|
|
|
{
|
|
"type": "TextBlock",
|
|
"text": "', coalesce(triggerBody()?['sections']?[0]?['activityTitle'], ''), '",
|
|
"spacing": "None"
|
|
},
|
|
|
|
{
|
|
"type": "TextBlock",
|
|
"text": "', coalesce(triggerBody()?['sections']?[0]?['text'], triggerBody()?['text'], ''), '",
|
|
"wrap": true
|
|
}
|
|
|
|
],
|
|
|
|
"actions": [
|
|
{
|
|
"type": "Action.OpenUrl",
|
|
"title": "Open",
|
|
"url": "', coalesce(triggerBody()?['potentialAction']?[0]?['targets']?[0]?['uri'], ''), '"
|
|
}
|
|
]
|
|
}'
|
|
)
|
|
```
|
|
|
|
## For Administrators of Environments
|
|
You can visit https://admin.powerplatform.microsoft.com/manage/environments to manage all the flows that have been created in a environment you have admin access to. Also if someone who left PSI owned a flow you want to continue using, you can assign it to a new responsible person there.
|
|
|