Web Hooks
A webhook provides the ability for you to request Fieldpine to trigger an API when certain events occur.
Webhooks are currently in testing. This documentation preceeds the general release
Requesting a WebHook
To register to receive a webhook you need to provide the following information:
- What you want The type of webhook you want describing when and where Fieldpine executes the webhook.
- Sale Completion
- Email Requested
- Product/Customer/etc record changed
- Error Detected.
- Charge account balance changed
- Stock level changed
- more....
- How you want it HTTP or HTTPS? POST, PUT or something else? Any custom headers?
- Where it should execute Fieldpine is a distributed system and some hooks can fire in multiple places. You might like to receive hook events direct from trading counters or central servers. If not specified, or not implied by what you are hooking, the webhook will execute from central servers
- Frequency How often should the webhook execute? The default is to receive one hook for each event, but in some cases this can be a large amount of information, or cause excess charges. If specified you can request that the hook should "batch up" data and only execute periodically.
Validating a Hook is from Fieldpine
For the highest level of security you should extract key information from the data received and query Fieldpine using your API-Key for that exact data, rather than trusting the data you receive. This turns the webhook into a trigger for you to poll Fieldpine rather than relying on the webhook contents.
For instances where validation does not need to be so stringent, the following options are available
Source IP checking.
Custom header specified when you registered
How a Hook appears when called
POST https://yourserver.com/your/registered/url Content-Type: application/json Content-Length: 12345 X-Fieldpine-HMAC: xxxxx
Detecting and Handling Lost Hooks
Fieldpine will consider the Hook completed when we receive a HTTP status of 200-299 or 404, or when we exhaust the retry limit. As this could lead to lost messages due to errors in external delivery chain (ie the network and hidden applications between Fieldpine and your application)