From within the Shopify Admin Interface:
- Click on "Apps" from the list on the left hand sidebar (or go to yourstore.myshopify.com/admin/apps)
- Click on "Manage private apps" (or go to yourstore.myshopify.com/admin/apps/private)
- Create a new private app
- Configure the provider as follows:
provider "shopify" {
access_token = "<app password>"
domain = "<yourstore>.myshopify.com"
}
For reference, see Shopify's Webhook Documentation.
Note: Webhooks created via this resource are not visible within the Shopify Admin GUI. To view webhook created this resource, an API request needs to be made with the same app credentials passed into this provider.
For example:
export SHOPIFY_ACCESS_TOKEN='your app password'
export STORE='your store'
curl "https://${STORE}.myshopify.com/admin/webhooks.json" \
-H "Accept: application/json" \
-H "X-Shopify-Access-Token: ${SHOPIFY_ACCESS_TOKEN}"
resource "shopify_webhook" "example" {
address = "https://shopify-webhook-handler.devaltitude.com"
topic = "orders/create"
format = "json"
}
The following arguments are supported:
- topic (Required) - The event topic for which webhook messages should be sent. See the Shopify documentation for the full list of available topics.
- address (Required) - The full URL to send webhooks to
- format (Required) - The format to send webhook messages in. Can be either
json
orxml
.
In addition to all arguments above, the following attributes are exported:
- topic - The event topic for which webhook messages are sent
- address - The full URL to send webhooks to
- format - The format to send webhook messages in. Will be one of
json
orxml
.
make build