All Projects → deadmanssnitch → snshttp

deadmanssnitch / snshttp

Licence: MIT License
Handler for receiving Amazon SNS webhooks in Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to snshttp

sns-sqs-big-payload
Amazon SNS/SQS client library that enables sending and receiving messages with payload larger than 256KiB via Amazon S3.
Stars: ✭ 40 (+73.91%)
Mutual labels:  sns, amazon-sns
Amazon-SNS-client-for-PHP
A simple, hacky, incomplete SNS client for PHP
Stars: ✭ 20 (-13.04%)
Mutual labels:  amazon-sns
ontopic
Display SNS messages on your terminal
Stars: ✭ 20 (-13.04%)
Mutual labels:  sns
openapi-tf-example
Example of how you can use OpenAPI with AWS API Gateway, Also includes integrations with AWSLambda, AWS Cognito, AWS SNS and CloudWatch logs
Stars: ✭ 38 (+65.22%)
Mutual labels:  sns
aws-lambda-router
Improved routing for AWS Lambda like SNS and ApiGateway
Stars: ✭ 90 (+291.3%)
Mutual labels:  sns
chef-handler-sns
Chef report handler to send Amazon SNS notifications on failures or changes.
Stars: ✭ 12 (-47.83%)
Mutual labels:  sns
terraform-aws-sns-topic
Terraform Module to Provide an Amazon Simple Notification Service (SNS)
Stars: ✭ 22 (-4.35%)
Mutual labels:  sns
sns-laravel
A library to enable sending and receiving broadcasts to and from SNS topics in Laravel and Lumen.
Stars: ✭ 23 (+0%)
Mutual labels:  sns
changestream
A stream of changes for MySQL built on Akka
Stars: ✭ 25 (+8.7%)
Mutual labels:  sns
go-aws-msg
AWS Pub/Sub Primitives for Go
Stars: ✭ 22 (-4.35%)
Mutual labels:  sns
EventBus
A .NET Core ultra lightweight in-memory event bus implementation.
Stars: ✭ 73 (+217.39%)
Mutual labels:  sns
aws-sqs-sns-client
AWS SNS SQS client UI
Stars: ✭ 26 (+13.04%)
Mutual labels:  sns
terraform-aws-lambda
A Terraform module to create AWS Lambda ressources.
Stars: ✭ 40 (+73.91%)
Mutual labels:  sns
parser
arc.app, .arc, arc.json, arc.yaml, and arc.toml support
Stars: ✭ 20 (-13.04%)
Mutual labels:  sns
sensu-plugins-aws
This plugin provides native AWS instrumentation for monitoring and metrics collection, including: health and metrics for various AWS services, such as EC2, RDS, ELB, and more, as well as handlers for EC2, SES, and SNS.
Stars: ✭ 79 (+243.48%)
Mutual labels:  sns
aws-sns-subscriber
Subscriber for AWS SNS topic in golang
Stars: ✭ 15 (-34.78%)
Mutual labels:  sns
amazon-eventbridge-cdk-audit-service-sample
Sample of a decoupled audit service using Amazon EventBridge and AWS Step Functions. Provisioned with AWS CDK.
Stars: ✭ 25 (+8.7%)
Mutual labels:  amazon-sns
terraform-aws-ecs-cloudwatch-sns-alarms
Terraform module to create CloudWatch Alarms on ECS Service level metrics.
Stars: ✭ 23 (+0%)
Mutual labels:  sns
keycloak-sms-authenticator-sns
SMS 2 Factor Authentication for Keycloak via AWS SNS
Stars: ✭ 66 (+186.96%)
Mutual labels:  sns
document-processing-pipeline-for-regulated-industries
A boilerplate solution for processing image and PDF documents for regulated industries, with lineage and pipeline operations metadata services.
Stars: ✭ 36 (+56.52%)
Mutual labels:  amazon-sns

Amazon SNS HTTP Handler

Documentation

The snshttp package provides an http.Handler adapter for receiving messages from Amazon SNS over HTTP(s) webhooks. The goal is to reduce the boilerplate necessary to get a new service or endpoint receiving messages from Amazon SNS.

Usage

type EventHandler struct {
  // DefaultHandler provides auto confirmation of subscriptions and ignores
  // unsubscribe events.
  snshttp.DefaultHandler
}

// Notification is called for messages published to the SNS Topic. When using
// DefaultHandler as above this is the only event you need to implement.
func (h *EventHandler) Notification(ctx context.Context, event *snshttp.Notification) error {
  fmt.Printf("id=%q subject=%q message=%q timestamp=%q\n",
    event.MessageID,
    event.Subject,
    event.Message,
    event.Timestamp,
  )

  return nil
}

// snshttp.New returns an http.Handler that will parse the payload and pass the
// event to the provided EventHandler.
snsHandler := snshttp.New(&EventHandler{},
  snshttp.WithAuthentication("sns", "password"),
)

http.Handle("/hooks/sns", snsHandler)

Double Requests

When using authentication Amazon SNS will make an initial request without authentication information to determine which scheme (Basic or Digest) the endpoint is using. Amazon will then make a request using the correct authentication scheme. These double requests will happen for every webhook from SNS but only one will be received by the EventHandler.

Timeouts

Amazon SNS expects a webhook to return a response within 15 seconds, any longer and it considers the request failed and it will try again. Because of this, the context.Context passed to each snshttp.EventHandler receiver has a 15 second timeout set from when the request is received.

Thanks

Continued development is sponsored by Dead Man's Snitch.

Ever been surprised that a critical scheduled task was silently failing to run? Whether it's sending invoices, cache clearing, or backups; Dead Man's Snitch makes it easy to monitor cron jobs and Amazon SNS subscriptions.

Get started with Dead Man's Snitch for free

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].