This information is specific to the deprecated version one. For more up-to-date details, see our API Reference.
What are webhooks anyway?
Webhooks are events triggered whenever a data change occurs internally within our platform. For example, an order being created. There’s no need to poll our API and track updates manually. When a webhook is created and an event occurs, Moltin sends data via POST requests to the URL that you’ve defined. You can then set up automated processes within your website or application to handle this change.
What can I do with webhooks?
Implementing Webhooks opens your organization up to a new level of operations. There are lots of things you can do when your data changes. Whether it’s priming your website cache, triggering a new application build or regenerating a static site, it’s easy to automate. Third party integrations are another great use case; such as being able to push your sales straight to accountancy software, drop shipping or shipping couriers. It’s all made possible thanks to webhooks. You may even just want to notify your team of a change, send a newsletter, push notification or post a Tweet or Facebook status when a product goes on sale.
Creating a webhook
Creating a Webhook is really easy, either via the dashboard or through our API. Log in to the dashboard, then on the left of your screen select the developers dropdown and then from that select Webhooks.
When on Webhooks, select “Create Webhook,” from the top right of the dashboard. This page states what webhooks you already have in place and you can edit, review, add, or delete all of your webhooks from here.
The next step is to set your webhook’s details. Use the following guide for each field:
- URL: Where we send the data to when an action occurs (e.g. your website address/endpoint that has a script that performs some task).
- Content type: Data structure type to send (either in JSON or as form data).
- Secret: A secret to send. Secure your endpoints code, check that this exists and matches what you expect, otherwise, anyone could post to that endpoint and run your code. This is like a password or key, the longer the better and more secure.
- Create: Whether to send data on a create action (e.g. when a new order is placed)
- Update: Whether to send data on an update action (e.g. when a customer updates their details)
- Delete: Whether to send data on a delete action (e.g. when a product is deleted)
- Enabled: Whether or not the webhook is active (send or do not send data).
Click “Submit” and your Webhook is ready to go, any changes will be sent to your specified URL. As stated earlier, if you need to access or change it in the future, simply click the edit button from the Webhooks page.
Webhooks are an advanced tool that allows you to save time by automating tasks. We’ve mentioned a few possible usages, but the only limit is your imagination! If you find a cool application for them or create a service integration, let us know. We love feedback!