In my earlier blog post, I shared an exciting new feature that lets you send messages or query results from your Autonomous Database to your Slack channels. As we know, these apps offer more than just the ability to message other individuals or groups in your organization. Thanks to their feature rich platform and key integration points with other external apps or source, they are an essential tool for many enterprises today. Therefore, it’s been extremely important for us to expand this integration to other platforms as well. I’m excited to announce that Autonomous Database now supports sending messages, alerts, or query results to Microsoft Teams as well! Similar to Slack, Microsoft Teams also offers various productivity features in addition to its core messaging functionalities. In this blog post, we are going to learn how to send messages and query results from Autonomous Database to a Microsoft Teams channel.
Before we get started, here are the prerequisites for this feature:
- Microsoft Teams account and team. If your organization uses Microsoft Teams, you should already have these.
- Microsoft Teams app. Teams comes with various built-in productivity apps that you can add to your teams and channels. For this use case, you want to create your own app with a bot and a secret key for the bot. For the full details on creating, publishing and setting the right permissions for your app, please refer to Prepare to Send Microsoft Teams Notifications from Autonomous Database.
- Microsoft Teams channel. As mentioned earlier, your Teams app will be posting the alerts or notifications that come from ADB to your designated channel. For this purpose, you need to have a Teams channel in which you will add the app you created in the previous step.
Now that we have a Teams channel and a Teams app added to that channel, we are ready go ahead with this demonstration. Here are the steps we’ll follow:
- Create a credential object for our Teams app
- Send a message to our Teams channel
- Send a query output to our Teams channel
- Confirm the receival of the messages in our Teams channel
Create a credential object for our Teams app
We first need to create a credential object in our ADB instance so that it can authenticate itself against the Teams app we created. For this credential, we need to use the app bot id as our username and bot secret key as our password (see Prepare to Send Microsoft Teams Notifications from Autonomous Database for more details on these properties).
begin
dbms_cloud.create_credential(credential_name => 'TEAMS_CRED',
username => 'e1**********************e',
password => 'Ym********************c0T');
end;
/
Send a message to our Teams channel
I have a Teams channel called ‘ctuzla_channel‘ in which I added my Teams app called ‘memfebadbs‘. In this step, we are going to send a simple message in plain text using the DBMS_CLOUD_NOTIFICATIONS.SEND_MESSAGE procedure. One thing to note here is the params parameter where we specify our channel id (see step 6 in Prepare to Send Microsoft Teams Notifications from Autonomous Database on how to obtain the channel id).
begin
dbms_cloud_notification.send_message(provider => 'msteams',
credential_name => 'TEAMS_CRED',
message => 'Hello World!',
params => json_object('channel' value '19%3ab***************cv2'));
end;
/
Send a query output to our Teams channel
Next, we are going to share the instance and tenancy details of our Autonomous Database in our channel by querying the cloud_identity column of the v$pdbs view. For this use case, we will be using the DBMS_CLOUD_NOTIFICATIONS.SEND_MESSAGE procedure. In addition to the channel id, we also need tenant id and team id as well as the format of the output file (see step 5 in Prepare to Send Microsoft Teams Notifications from Autonomous Database on how to obtain the tenant and team id).
begin
dbms_cloud_notification.send_data(provider => 'msteams',
credential_name => 'TEAMS_CRED',
query => 'select cloud_identity from v$pdbs',
params => json_object('tenant' value 'b7c2*****************a1c',
'team' value '19%3ap***************cv2',
'channel' value '19%3ab***************cv2',
'title' value 'cloud_identity',
'type' value 'csv'));
end;
/
Confirm the receival of the messages in our Teams channel
Let’s check our channel to see if we have successfully received both notifications from our Autonomous Database:

To recap, Autonomous Database now supports sending alerts, messages, or query results directly to your Microsoft Teams channels to boost your productivity even more. You can use this feature to send messages regarding certain database events or share reports that are created based on queries you execute in your ADB instance. If you’d like to learn more about this new integration, please check out our documentation.
