calamarble-xhub-sns
Auto-publish to an Amazon SNS topic after a X-Hub-Signature check
Checks the signature of a http request and if valid post the body of the request to a configurable existing AWS SNS topic.
Usage
With express.js
;;; const expressConfig = port: 8088 postPath: '/mywebhook' messages: `Server running on port ` ;const xHubSnsConfig = algo: 'sha1' secret: 'MY_APP_SECRET' topicArn: 'arn:aws:sns:us-east-1:XXXXX:yyyyy' awsConfig: region: 'us-east-1' messages: wrongSignature: 'Content signature don\'t match' ;const app = ;const postEndPoint = ;app;app;app;
With claudia-api-builder
;; const api = ;const xHubConfig = algo: 'sha1' secret: 'MY_APP_SECRET' topicArn: 'arn:aws:sns:us-east-1:XXXXX:yyyyy' messages: wrongSignature: 'Content signature don\'t match' api; ;
Remember to copy the file policies/sns-publish.json
and include it in your
claudia create --policies
command line argument when creating your lambdas.