Webhooks
Receive GAINS data as it changes: configure webhooks, filter triggers, authenticate deliveries and handle retries.
Webhooks let GAINS notify your systems when something happens, instead of you polling for it: GAINS Connect sends an HTTP POST to a URL you choose each time orders are submitted, policies or forecasts change, or one of your inbound tasks changes status. This page lists the triggers; the pages below cover the rest.
Triggers
A trigger is the kind of event a webhook reports. You enable triggers per webhook configuration, and each payload carries records of one trigger only, identified by its DataType.
| Trigger | Setting name | DataType |
|---|---|---|
| Submission of purchase orders | POSubmit | purchase_order |
| Submission of transfer orders | TOSubmit | transfer_order |
| Submission of work orders | WOSubmit | work_order |
| Submission of production orders | ProductionOrderSubmit | production_order |
| Changes to a SKU-location's inventory policy | InventoryPolicyUpdate | inventory_policy |
| Changes to a SKU-location's weekly forecast | ForecastWeeklyUpdate | forecast |
| Changes to a SKU-location's monthly forecast | ForecastMonthlyUpdate | forecast |
| Changes to the status of an inbound task | TaskStatusUpdate | task |
The setting name is what you use in Triggers, in filters and in the Trigger parameters of the webhook endpoints. Webhook history reports triggers in underscored spelling, such as po_submit.
Setting up a webhook
| Step | Page |
|---|---|
| Build an endpoint that receives webhooks | Receiving Webhooks |
| Create a configuration: URL, authorization, triggers | Configuring Webhooks |
| Use OAuth 2.0 to authenticate deliveries | OAuth 2.0 Webhook Destinations |
| Send only the records you want | Webhook Filters |
| See what each trigger sends | Webhook Payload Samples |
| Follow deliveries, retries and resends | Delivery & Recovery |
Payloads
Every delivery is a JSON body in which DataType names the subject and Data holds the records. Webhook Payload Samples shows the payload of each trigger and the conventions every payload follows.
Errors
| Status | When |
|---|---|
400 Bad Request | A setting or filter is invalid, a test failed, or a resend or reset could not be done. Reason explains which; several validation errors come back together in Reasons. |
401 Unauthorized | Your credentials are missing or invalid. See Authentication. |
403 Forbidden | Your credentials do not include webhook access. |
404 Not Found | No configuration, or no webhook, with the Id in the path. |
See Errors Handling & Exceptions for the error body.
Updated 10 days ago
