# Webhooks
You can use webhook subscriptions to receive notifications about particular events on an account. After you've subscribed to a webhook, you can let your app execute code immediately after specific events occur on an account that have your app installed, instead of having to make API calls periodically to check their status. For example, you can rely on webhooks to trigger an action in your app when a customer creates an order, or when a supplier creates a new product in their Orderchamp admin. By using webhooks subscriptions you can make fewer API calls overall, which makes sure that your apps are more efficient and update quickly.
# Anatomy of a webhook
After you configure a webhook subscription, the events that you specified will trigger a webhook notification each time they occur.
This notification contains a JSON payload, and HTTP headers that provide context. For example, the PRODUCT_CREATED
webhook includes the following headers:
- X-Orderchamp-Account-Id:
QWNjb3VudDo1NjI2MjU2ODQ1MjA5NjE
- X-Orderchamp-Event:
PRODUCT_CREATED
- X-Orderchamp-Signature:
cbf8b234b4da2aed411a9e5c2301bce0dc5dd68cc14585c38b885e32981
- X-Orderchamp-Webhook-Id:
V2ViaG9vazo1NzExNDQ1Mzc1Mzg1NjE
Some HTTP headers are particularly useful for your app. For example, X-Orderchamp-Signature is used to verify webhooks, and X-Orderchamp-Account-Id is used to identify the account that's associated with them.
# List of supported webhook topics and events
# Products
Events PRODUCT_CREATED
, PRODUCT_DELETED
, PRODUCT_UPDATED
# Response
query ($id: ID!) {
product(id: $id) {
id
title
description
createdAt
updatedAt
images(first: 100) {
edges {
node {
id
position
originalUrl
}
}
}
variants(first: 100) {
edges {
node {
id
inventoryQuantity
position
price
}
}
}
}
}