• Products
  • Get started
  • Documentation
  • Resources

Integrate Opsgenie with Incoming Amazon SNS

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

You can add this integration from your team dashboard

If you're using Opsgenie's Free or Essentials plan, or if you’re using Opsgenie with Jira Service Management's Standard plan, you can only add this integration from your team dashboard as the Integrations page under Settings is not available in your plan.

Adding the integration from your team dashboard will make your team the owner of the integration. This means Opsgenie will assign the alerts received through this integration to your team only.

To do that,

  1. Go to your team’s dashboard from Teams,

  2. Select Integrations, and select Add integration.

Follow the rest of the steps to complete the integration.

  1. Go to Settings > Integrations. Search for Amazon SNS and select Add

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

  3. Copy the integration URL which includes Opsgenie’s endpoint as well as the API key.

  4. Select Save Integration.

Set up Subscription on Amazon SNS

  1. Create an SNS topic.

Amazon SNS topic

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

Amazon SNS Subscription

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

Amazon SNS Confirmation

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

Text

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 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:

JSON

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 { "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"} } }



Additional Help