Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save princesslea/399b0f112e977a3a3a613ecfa4980d54 to your computer and use it in GitHub Desktop.

Select an option

Save princesslea/399b0f112e977a3a3a613ecfa4980d54 to your computer and use it in GitHub Desktop.
mapping.template
#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