Send Microsoft Teams Notifications from Autonomous Database
Describes how to configure Microsoft Teams so that you can send messages, alerts, or output of a query from Autonomous Database to a Microsoft Teams Channel. Also describes the procedures you use to send Microsoft Teams notifications.
Prepare to Send Microsoft Teams Notifications from Autonomous Database 🔗
Get started by configuring a bot in your Microsoft Teams app. Next, create a credential to use with the DBMS_CLOUD_NOTIFICATION procedures to send Microsoft Teams notifications from Autonomous Database.
To configure Microsoft Teams notifications:
Create your Microsoft Teams app and add a bot in it. See Developer Portal for Teams for information on setting up an app.
From the Bot Management section, ensure that the bot has a secret key, scope set to Team and permission to send notifications.
Publish the app to your org to make it available to the people in your org.
After your IT admin approves the app from the admin center, install the app from the Apps section in Teams.
Request the Files.ReadWrite.All and ChannelSettings.Read.All permissions to the app for Graph API from the Azure Portal using the following instructions:
Log into your Azure Portal, navigate to Azure Active Directory using the left panel, and select the Application option.
The Application page displays the apps that you own along with the bots added to those apps. Click the bot to view its details.
Copy the directory/tenant id from the bot overview page for later use.
Then, go to API permissions in the left panel. Under API permissions, click Add permission, select Microsoft graph and then Application permission.
Search for Files.ReadWrite.All and ChannelSettings.Read.All permissions and add them.
Have your IT admin approve the above-requested permissions from the Azure portal by following the steps below:
Log into your Azure Portal, navigate to Azure Active Directory using the left panel, and select the Application option.
Select All applications from the Application page.
Search the application/bot by its name, go to API permissions, and grant the ADMIN consent for the requested permissions: Files.ReadWrite.All and ChannelSettings.Read.All.
Tip:
After your app is approved by the IT Admin, you can provide the bot id and secret key to other users to install the app within Teams in the org.
After the app is approved by the IT admin and the above requested permissions are granted, you can use the app's bot ID and secret key are used to create the credential object and generate a bot token.
To send a query result to a Microsoft Teams channel, obtain the team id and the tenant id.
Tip:
The team id is located in the team link between /team/ and /conversations. The tenant id is located after "tenantId=" at the end of the team link. This link is found by clicking the three dots next to the team name and selecting Get link to team.
channelID is located in the channel link between /team/ and the channel name. This link is found by clicking the three dots next to the channel name and selecting Get link to channel.
BEGIN
DBMS_CLOUD_NOTIFICATION.SEND_MESSAGE(
provider => 'msteams',
credential_name => 'TEAMS_CRED',
message => 'text from new teams api',
params => json_object('channel' value 'channelID'));
END;
/
title: specifies the title of the file. The title can only contain alphabets, digits, underscores, and hyphens. The file name that appears in Microsoft Teams will be a concatenation of the title parameter and the timestamp to ensure uniqueness. The maximum title size is 50 characters.
For example: 'title'_'timestamp'.'format'
type: This specifies the output format. Valid values are CSV or JSON.
Note
The maximum file size supported when using DBMS_CLOUD_NOTIFICATION.SEND_DATA for Microsoft Teams is 4MB.