Incoming Amazon SNS Integration

Amazon SNS (Amazon Simple Notification Service) is a fast, flexible, fully managed push messaging service. Use SNS to push notifications to internet-connected smart devices, as well as other distributed services.

Amazon SNS makes it simple and cost-effective to push notifications to Apple, Google, Fire OS, and Windows devices, as well as Android devices in China with Baidu Cloud Push.

​What does Opsgenie offer to Amazon SNS users?

Opsgenie acts as a dispatcher for Amazon SNS notifications, determines the right people to notify based on on-call schedules– notifies via them using email, text messages (SMS), phone calls and iPhone & Android push notifications, and escalates alerts until the alert is acknowledged or closed.

Functionality of the integration

When an alert is created in SNS, an alert is created in Opsgenie automatically through the integration.

Add Incoming Amazon SNS Integration in Opsgenie

  1. Please create an Opsgenie account if you haven't done so already.
  2. Go to Opsgenie Incoming Amazon SNS Integration page.

For Free and Essentials plans, you can only add the integrations from the Team Dashboards, please use the alternative instructions given below to add this integration.

  1. Specify who is notified of SNS alerts using the Teams field. Auto-complete suggestions are provided as you type.

An alternative for Step 2) and Step 3) is to add the integration from the Team Dashboard of the team which will own the integration. To add an integration directly to a team, navigate to the Team Dashboard and open Integrations tab. Click Add Integration and select the integration that you would like to add.

  1. Copy the integration URL which includes Opsgenie endpoint as well as the API key.
  2. Click Save Integration.

Setup Subscription on Amazon SNS

  1. Add an HTTPS subscription to the topic with Opsgenie's API endpoint using the URL provided from Opsgenie Integration.

Upon successfully configuring SNS subscription to Opsgenie a confirmation alert is created in Opsgenie:

Specify alias, entity, tags, recipients, teams, and custom actions of the alert using MessageAttributes.

AmazonSNSClient snsClient = new AmazonSNSClient(new BasicAWSCredentials("AWS_ACCESS_KEY","AWS_SECRET_KEY"));

String msg = "This is the description of Sns Integration test alert";
String subject = "Sns Integration Test alert";
PublishRequest publishRequest = new PublishRequest("arn:aws:sns:us-east-1:974xxxxxxx:OpsGenieSns", msg, subject);
publishRequest.addMessageAttributesEntry("eventType", new MessageAttributeValue()
                    .withDataType("String").withStringValue("create"));
publishRequest.addMessageAttributesEntry("alias", new MessageAttributeValue()
                    .withDataType("String").withStringValue("testalertalias"));
publishRequest.addMessageAttributesEntry("entity", new MessageAttributeValue()
                    .withDataType("String").withStringValue("Test alert entity"));
publishRequest.addMessageAttributesEntry("tags", new MessageAttributeValue()
                    .withDataType("String").withStringValue("trial"));
publishRequest.addMessageAttributesEntry("recipients", new MessageAttributeValue()
                    .withDataType("String").withStringValue("none"));
publishRequest.addMessageAttributesEntry("teams", new MessageAttributeValue()
                    .withDataType("String").withStringValue("team1,team2"));
publishRequest.addMessageAttributesEntry("actions", new MessageAttributeValue()
                    .withDataType("String").withStringValue("customAction"));

PublishResult publishResult = snsClient.publish(publishRequest);

All the fields in "MessageAttributes" are optional. To specify the action to execute, send "eventType" field. An alert is created if "eventType" is not specified.

To execute actions, you should specify "eventType" as shown below:

  • create action -> "eventType" : {"Type":"String","Value":"create"}
  • close action -> "eventType" : {"Type":"String","Value":"close"}
  • acknowledge action -> "eventType" : {"Type":"String","Value":"acknowledge"}
  • add note action -> "eventType" : {"Type":"String","Value":"addNote"}

Sample payload sent from Amazon SNS

Create Alert payload:

{
  "Type" : "Notification",
  "MessageId" : "0323d595-6aed-5dd4-a378-9811daf7d3ed",
  "TopicArn" : "arn:aws:sns:us-east-1:9747xxxxxxx:gj",
  "Subject" : "Sns Integration Test alert",
  "Message" : "This is the description of Sns Integration test alert",
  "Timestamp" : "2015-03-18T15:24:31.877Z",
  "SignatureVersion" : "1",
  "Signature" : "QplK4lyJWAtjIV9BzcF4AHTKT+VTupYqJIzxxxxxxxxxxx4QR8EdAYr31xDjI8...",
  "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-dxxxxd67.pem",
  "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe..",
  "MessageAttributes" : {
    "alias" : {"Type":"String","Value":"testalertalias"},
    "entity" : {"Type":"String","Value":"snstestentity"},
    "tags" : {"Type":"String","Value":"tag1,tag2"},
    "eventType" : {"Type":"String","Value":"create"},
    "recipients" : {"Type":"String","Value":"all"},
    "teams" : {"Type":"String","Value":"team1,team2"},
    "actions" : {"Type":"String","Value":"act1,act2"}
  }
}

Incoming Amazon SNS Integration


Amazon SNS (Amazon Simple Notification Service) is a fast, flexible, fully managed push messaging service. Use SNS to push notifications to internet-connected smart devices, as well as other distributed services.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.