Highlight
Webhooks allow you to set up a notification system that can be used to receive
updates on certain requests made to the GetEquity API.
Introduction
Generally, when you make a request to an API endpoint, you expect to get a near-immediate response. However, some requests may take a long time to process, which can lead to timeout errors. In order to prevent a timeout error, a pending response is returned. Since your records need to be updated with the final state of the request, you need to listen to events by using a webhook URL.Create a webhook URL
A webhook URL is simply aPOST endpoint that a resource server sends updates to. The URL needs to parse a JSON request and return a 200 OK:
200 OK in the HTTP header. Without a 200 OK in the response header, we’ll keep sending events for the next 15mins
Verify event origin
Since your webhook URL is publicly available, you need to verify that events originate from GetEquity and not a bad actor. Signature validation is a way to ensure events to your webhook URL are from GetEquity:Signature Validation
Events sent from GetEquity carry thex-getequity-signature header. The value of this header is a HMAC SHA256 signature of the event payload signed using your secret key. Verifying the header signature should be done before processing the event:
Go live checklist
Now that you’ve successfully created your webhook URL, here are some ways to ensure you get a delightful experience:- Add the webhook URL on your GetEquity dashboard
- Ensure your webhook URL is publicly available (localhost URLs cannot receive events)
- Test your webhook to ensure you’re getting the JSON body and returning a
200 OKHTTP response - If we don’t get a
200 OKHTTP response from your webhooks, we flagged it as a failed attempt - Failed attempts are retried every 5 minutes for the next 15 minutes
Supported Events
Every webhook payload is a single JSON object containing awebhook_event field that identifies the event, plus event-specific fields. Select an event from the sidebar for its full payload reference.
