Skip to content

Webhooks

Spark uses webhooks to notify your application when an event happens. Webhooks are particularly useful for asynchronous events like when a price gets released.

Begin using webhooks in just two steps:

  • Create a webhook endpoint on your server.
  • Register the endpoint with Spark to test / go live.

Not all Spark integrations require webhooks. Keep reading to learn more about what webhooks are and when you should use them.

What are webhooks

Webhooks refers to a combination of elements that collectively create a notification and reaction system within a larger integration.

Metaphorically, webhooks are like a phone number that Spark calls to notify you of price events. The activity could be, for instance, a price release. The webhook endpoint is the person answering that call who takes actions based upon the specific information it receives.

Non-metaphorically, the webhook endpoint is just more code on your server, which could be written in Python, Java, Node.js, or whatever. The webhook endpoint has an associated URL (e.g. https://example.com/webhooks). The Spark notifications contain all the relevant information about what just happened, including the type of event and the data associated with that event. The webhook endpoint uses the event details to take any required actions, such as processing the newly released prices.

Current event types:

  • new-price-release
  • price-release-revision

When to use webhooks

Most price releases happen on scheduled timing, calling the endpoints will get the latest prices. For example, a scheduled job to fetch the prices. Such requests don’t require webhooks, as the key information is already available.

Other events that may occur after scheduled timing, such as price revision. Spark needs to notify your integration with the latest prices so your integration can take subsequent steps.