Webhooks are a great way to notify your (or 3rd party) applications when an event occurs, such as a new order being created, or a customer being updated.
Some common examples of webhook use cases are:
- Update your own database, or sync the data with your CRM when an order is created in Shoprocket
- Get notified when a product is created or updated; then sync your Shoprocket catalogue with your local database
- Add or remove email addresses from your mailing list when they subscribe or unsubscribe via Shoprocket
To set up a webhook, head to 'Developer' in the 'Settings' section of your Shoprocket dashboard and then:
- Click on "Add Webhook" and then select which event(s) you want to be notified of from the "Select Events" dropdown.
- Next, enter the URL that you would like the webhook payload sent to (this must be an absolute URL, such as https://mysite.com/webhooks)
- Click on "Save Webhook"
- In the next page, you'll see a summary of your webhook, including the status, the events it is sending, and the secret key.
The secret key can be used in your receiver to verify that a request to your callback URL is a valid request from Shoprocket.
We currently support the following webhook events:
- order.created - fired when an order is created
- order.updated - fired when an order is updated
- order.deleted - fired when an order is deleted
- customer.created - fired when a customer is created
- customer.updated - fired when a customer is updated
- customer.deleted - fired when a customer is deleted
You can also click on "Send test data" in the top-right menu, where you can choose which event to test. We will then send a test webhook event to your endpoint with dummy data, which you can then verify your end. We will also verify the webhook response and display the output in the modal.
Below is an example webhook payload for order.created:
We suggest using https://webhook.site to quickly test webhooks with instant visual feedback on the payload.