Scenario B: Sending Alarm Messages to Slack and SMS
Set up automatic notifications to a Slack channel and an SMS phone number when alarms are triggered.
This scenario involves setting up a Slack endpoint for a channel and creating an alarm that sends a message to both that channel and an SMS phone number. When the alarm fires, the Notifications service sends the alarm message to the destination topic, which then fans out to the topic's subscriptions. In this scenario, the topic's subscriptions include the Slack channel and SMS phone number as well as your email address.
Required IAM Policy
To use Oracle Cloud Infrastructure, an administrator must be a member of a group granted security access in a policy by a tenancy administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don't have permission or are unauthorized, verify with the tenancy administrator what type of access you have and which compartment your access works in.
If you're a member of the Administrators group, you already have the required access to execute this scenario. Otherwise, you need access to Monitoring and Notifications.
Example of an incoming webhook to a Slack app (equivalent to the Slack endpoint for your subscription): https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Once you set up your Slack endpoint, you can complete all other scenario steps in the Console. Alternatively, you can use the Oracle Cloud Infrastructure CLI or API, which lets you execute the
individual operations yourself.
POST /20181201/topics
Host: notification.us-phoenix-1.oraclecloud.com
<authorization and other headers>
{
"name": "Alarm Topic",
"compartmentId": "<compartment_OCID>"
}
Select the topic that you created earlier (example name was Alarm Topic): On the Topics list page, select the topic that you want to work with. If you need help finding the list page or the topic, see Listing Topics.
Create the Slack subscription.
Open the Create Subscription panel: In the detail page for the topic, select Create Subscription.
The Create Subscription panel opens.
For Protocol, select Slack.
Fill in the remaining fields.
Field
Description
URL
Type (or copy and paste) the Slack endpoint that you created earlier. Include the webhook token.
Example endpoint:
https://hooks.slack.com/services/<webhook-token>
Select Create.
Confirm the new Slack subscription: Navigate to the confirmation URL that was sent to Slack.
Create the SMS subscription.
Open the Create Subscription panel: In the detail page for the topic, select Create Subscription.