Skip to content

Instantly share code, notes, and snippets.

  • Select an option

  • Save shopifypartners/cd71f09a3ab21307c278e6a35b5914cb to your computer and use it in GitHub Desktop.

Select an option

Save shopifypartners/cd71f09a3ab21307c278e6a35b5914cb 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"
}
@shopifypartners
Copy link
Copy Markdown
Author

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