# Teams Notification Provider Configuration Guide This guide provides instructions on how to configure the Teams Notification provider, ## 1. For Public Webhooks Teams can be configured to allow public webhooks. This means that anyone can send a message to a channel. To create a public webhook, follow the steps below. ### 1. Create a Webhook - Common steps for public and authenticated webhooks 1. Log in to Entra ID with a user having write permissions to **Power Automate** ; Navigate to make.powerautomate.com. 2. Click on **Create** -> **Instant cloud flow**. 3. Give it a unuque flow name 4. Click on **When a Teams webhook request is received**. 5. Click on **Create**. 6. Click on the block **When a Teams webhook request is received**. 7. For **Who can trigger the flow?**, select **Anyone**. 8. Click on the "+" icon below this step to add an action. 9. Click on **Add an action**. 10. Search for "Parse JSON". Under **Data Operations** click on **Parse JSON**. 11. Click in the text box under **Content**, click on the blue bar to the right and select the spark like icon. Click on **Body** 12. Under Schema click on "Use sample payload to generate schema". 13. In the popup that appears, paste the following JSON payload: ```json { "message": "My Message", "TeamID": "teamId", "ChannelID": "channelId" } ``` 14. Click on **Done**. 15. Click on the "+" icon below Parse JSON to add an action. 16. Click on **Add an action**. 17. Click on **Microsoft Teams** under **Add an action**. 18. Click on **Post card in a chat or channel**. 19. Fill in the following details: - **Post As**: Flow bot (keep unchanged) - **Post In**: In drop down select **Channel** - **Team**: Click in the text box, and in the blue bar to the right, click on **fx**. In search box under "Function" search for "body". Select **triggerBody()**. In the text box above edit the text to **triggerBody()?['TeamID']**. Click on **Add** - **Channel**: Click in the text box, and in the blue bar to the right, click on "fx". In search box under "Function" search for "body". Select **triggerBody()**. In the text box above edit the text to **triggerBody()?['ChannelID']**. Click on **Add** - **Adaptive Card**: Click in text box , and in the blue bar to the right, click on "fx". Click on **Dynamic content**. Click on **Body message**. Click on **Add**. 20. Click on **Save**. 21. Click on **When a Teams webhook request is received** and copy the HTTP URL. ### 2. Get the Channel ID and Team ID to post to 1. In Teams, navigate to the channel you want to post to on the list of channels 2. Click on the three dots next to the channel name. 3. Click on **Get link to channel**. 4. Copy the URL. The channel ID is the last part of the URL. The team ID is the part of the URL before the channel ID. 5. For example if the link is "https://teams.microsoft.com/l/channel/XXX17f4%40thread.tacv2/test?groupId=f47c4a46-XXX" then the team ID is "f47c4a46-XXX" and the channel ID is "XXX17f4%40thread.tacv2". ### 3. Configure your Integration 1. Ensure you have the following items - **Webhook URL**: The URL copied from the "When a Teams webhook request is received" block. - **Channel ID**: The channel ID copied from Teams. - **Team ID**: The team ID copied from Teams. 2. Create your integration by supplying the following values. - **Credential** / **WebhookUrl** : Paste the webhook URL. - **ChannelId** : Paste the channel ID. - **TeamId** : Paste the team ID. 1. Do not set the following parameters: **Credential** / **OAuthClient** , **TenantId** or **Endpoint**. ## 2. For Authenticated Webhooks Teams can be configured to allow authenticated webhooks. This means that only users with the correct credentials (Tenant ID, Client ID and Client Secret) can send a message to a channel. To create an authenticated webhook, follow the steps below. ### 1. Create a Webhook - Common steps for public and authenticated webhooks 1. Log in to Entra ID with a user having write permissions to **Power Automate** ; Navigate to make.powerautomate.com. 2. Click on **Create** -> **Instant cloud flow**. 3. Give it a unuque flow name 4. Click on **When a Teams webhook request is received**. 5. Click on **Create**. 6. Click on the block **When a Teams webhook request is received**. 7. For **Who can trigger the flow?**, select **Any user in my tenant**. 8. Click on the "+" icon below this step to add an action. 9. Click on **Add an action**. 10. Search for "Parse JSON". Under **Data Operations** click on **Parse JSON**. 11. Click in the text box under **Content**, click on the blue bar to the right and select the spark like icon. Click on **Body** 12. Under Schema click on "Use sample payload to generate schema". 13. In the popup that appears, paste the following JSON payload: ```json { "message": "My Message", "TeamID": "teamId", "ChannelID": "channelId" } ``` 14. Click on **Done**. 15. Click on the "+" icon below Parse JSON to add an action. 16. Click on **Add an action**. 17. Click on **Microsoft Teams** under **Add an action**. 18. Click on **Post card in a chat or channel**. 19. Fill in the following details: - **Post As**: Flow bot (keep unchanged) - **Post In**: In drop down select **Channel** - **Team**: Click in the text box, and in the blue bar to the right, click on **fx**. In search box under "Function" search for "body". Select **triggerBody()**. In the text box above edit the text to **triggerBody()?['TeamID']**. Click on **Add** - **Channel**: Click in the text box, and in the blue bar to the right, click on "fx". In search box under "Function" search for "body". Select **triggerBody()**. In the text box above edit the text to **triggerBody()?['ChannelID']**. Click on **Add** - **Adaptive Card**: Click in text box , and in the blue bar to the right, click on "fx". Click on **Dynamic content**. Click on **Body message**. Click on **Add**. 20. Click on **Save**. 21. Click on **When a Teams webhook request is received** and copy the HTTP URL. ### 2. Get the Channel ID and Team ID to post to 1. In Teams, navigate to the channel you want to post to on the list of channels 2. Click on the three dots next to the channel name. 3. Click on **Get link to channel**. 4. Copy the URL. The channel ID is the last part of the URL. The team ID is the part of the URL before the channel ID. 5. For example if the link is "https://teams.microsoft.com/l/channel/XXX17f4%40thread.tacv2/test?groupId=f47c4a46-XXX" then the team ID is "f47c4a46-XXX" and the channel ID is "XXX17f4%40thread.tacv2". ### 3. Create Azure AD App Registration 1. Navigate to portal.azure.com and login with your Entra ID account having admin permissions. 2. In search bar above, search for **App registrations** and click on it. 3. Click on **New registration**. 4. Fill in the following details: - **Name**: Enter a name for the app registration. - **Supported account types**: Select the appropriate account type. We suggest you use **Accounts in any organizational directory (Any Microsoft Entra IO tenant - Multitenant)**. - **Redirect URI**: Do not enter 5. Click on **Register**. 6. In the left pane, click on **Certificates & secrets**. 7. Click on **New client secret**. Click **Add**. 8. Copy the **Value** of the client secret. This is the client secret. You will not be able to see this value again. Copy the **Secret ID** as well. Store in a secure location. This will be the client ID and client secret. 9. In the left pane, click on **API permissions**. 10. Click on **Add a permission**. 11. Click on **Power Automate** ; Click on **User** under **Other permissions**. Click on **Add permissions**. 12. Click on **Overview** and copy the **Directory (tenant) ID**. This is the tenant ID. ### 4. Configure your Integration 1. Ensure you have the following items - **Webhook URL**: The URL copied from the "When a Teams webhook request is received" block. - **Channel ID**: The channel ID copied from Teams. - **Team ID**: The team ID copied from Teams. - **Tenant ID**: The tenant ID copied from Azure AD App Registration. - **Client ID**: The client ID copied from Azure AD App Registration. - **Client Secret**: The client secret copied from Azure AD App Registration. 2. Create your integration by supplying the following values. - **Endpoint** : Paste the webhook URL. - **TenantId** : Paste the tenant ID. - **Credential** / **OAuthClient** / **ClientId** : Paste the client ID - **Credential** / **OAuthClient** / **ClientSecret** : Paste the client secret. - **ChannelId** : Paste the channel ID. - **TeamId** : Paste the team ID. 3. Do not set the following parameters: **Credential** / **WebhookUrl**.