This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($inputRoot = $input.path('$')) | |
{ | |
"X-Shopify-Shop-Domain": "$input.params().header.get('X-Shopify-Shop-Domain')", | |
"X-Shopify-Topic": "$input.params().header.get('X-Shopify-Topic')", | |
"X-Shopify-Hmac-SHA256": "$input.params().header.get('X-Shopify-Hmac-SHA256')", | |
"body": "$util.base64Encode($input.body)", | |
"queue": "$stageVariables.sqs_queue", | |
"client_secret": "$stageVariables.client_secret" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "ShopifyWebhookInput", | |
"type": "object", | |
"properties": { | |
"header": { "type": "string" }, | |
"body": { | |
"type": "string" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var AWS = require('aws-sdk'); | |
var sqs = new AWS.SQS(); | |
var crypto = require('crypto'); | |
exports.handler = (event, context, callback) => { | |
var client_secret = event.client_secret; | |
delete event.client_secret; | |
//calculate the hash | |
var calculated_hash = crypto.createHmac("sha256", client_secret).update(new Buffer(event.body, "base64")).digest("base64"); |