Created
October 25, 2017 16:18
-
-
Save princesslea/399b0f112e977a3a3a613ecfa4980d54 to your computer and use it in GitHub Desktop.
mapping.template
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" | |
} | |
A few things to note: | |
a) We set up stage variables so we can easily manage a development/staging/production environment. | |
b) Those stage variables contain the API key that Shopify gives us from our partner dashboard. This is what we use to verify the webhooks are coming from Shopify. | |
c) We also set the SQS queue name in a stage variable. We send webhooks to different queues, so development webhooks don't get sent to production servers. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment