Send Slack Notifications from Autonomous Database
Describes how to configure Slack so that you can send messages, alerts, or output of a query from Autonomous Database to a Slack Channel. Also describes the procedures you use to send Slack notifications.
- Prepare to Send Slack Notifications from Autonomous Database
To send Slack notifications, you must configure your Slack application to receive messages from Autonomous Database. Next, create a credential to use with theDBMS_CLOUD_NOTIFICATION
procedures to send Slack notifications from Autonomous Database. - Send Messages to a Slack Channel
- Send Query Results to a Slack Channel
Parent topic: Send Email and Notifications on Autonomous Database
Prepare to Send Slack Notifications from Autonomous Database
To send Slack notifications, you must configure your Slack application to receive messages from Autonomous Database. Next, create a credential to use with the DBMS_CLOUD_NOTIFICATION
procedures to send Slack notifications from Autonomous Database.
To use Slack with DBMS_CLOUD_NOTIFICATION
procedures:
Parent topic: Send Slack Notifications from Autonomous Database
Send Messages to a Slack Channel
DBMS_CLOUD_NOTIFICATION.SEND_MESSAGE
procedure to send a message to a Slack channel.
BEGIN
DBMS_CLOUD_NOTIFICATION.SEND_MESSAGE
(
provider => 'slack',
credential_name => 'SLACK_CRED',
message => 'Alert from Autonomous Database...',
params => json_object('channel' value 'C0....08'));
END;
/
Use the params
parameter to specify the Slack channel.
-
channel
: Specifies the Channel ID.The Channel ID is a unique ID for a channel and is different from the channel name. In Slack, when you view channel details you can find the Channel ID on the “About” tab. See How to Find your Slack Team ID and Slack Channel ID for more information.
See SEND_MESSAGE Procedure for more information.
Parent topic: Send Slack Notifications from Autonomous Database
Send Query Results to a Slack Channel
DBMS_CLOUD_NOTIFICATION.SEND_DATA
procedure to send the output of a query to a Slack channel.
BEGIN
DBMS_CLOUD_NOTIFICATION.SEND_DATA
(
provider => 'slack',
credential_name => 'SLACK_CRED',
query => 'SELECT username, account_status, expiry_date FROM USER_USERS WHERE rownum < 5',
params => json_object('channel' value 'C0....08',
'type' value 'csv'));
END;
/
Use the params
parameter to specify the Slack channel and the data type:
-
channel
: Specifies the Channel ID.The Channel ID is a unique ID for a channel and is different from the channel name. In Slack, when you view channel details you can find the Channel ID on the “About” tab. See How to Find your Slack Team ID and Slack Channel ID for more information.
-
type
: Specifies the output type. Valid values are: 'csv
' or 'json
'.
See SEND_DATA Procedure for more information.
Related Topics
Parent topic: Send Slack Notifications from Autonomous Database