WebSQL Server can receive notifications through Amazon SNS.
The following code demonstrates creating an HTTP/HTTPS endpoint that handles bounces and complaints from Amazon SES:
(function() {
var type = request.header("x-amz-sns-message-type");
if (type === "Notification") {
// TODO: custom implementation
response.end(200);
} else if (type === "SubscriptionConfirmation") {
var json = request.body.json();
net("GET", json.SubscribeURL, function(resp) {
response.end(resp.status);
});
} else {
response.end(400);
}
}());
The following code demonstrates a message publishing signed with Amazon Signature Version 4:
(function() {
var data = "Action=Publish";
data += "&Message=" + encodeURIComponent("Test");
data += "&Subject=" + encodeURIComponent("Info");
data += "&TopicArn=" + encodeURIComponent("arn:aws:sns:us-east-1:294138928152:TestTopic");
var headers = {
"Content-Type": "application/x-www-form-urlencoded; charset=utf8"
};
net("POST", "https://sns.us-east-1.amazonaws.com/", headers, data, use("aws4"), function(resp) {
response.end(resp.status);
});
}());