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.

TriggerSetting nameDataType
Submission of purchase ordersPOSubmitpurchase_order
Submission of transfer ordersTOSubmittransfer_order
Submission of work ordersWOSubmitwork_order
Submission of production ordersProductionOrderSubmitproduction_order
Changes to a SKU-location's inventory policyInventoryPolicyUpdateinventory_policy
Changes to a SKU-location's weekly forecastForecastWeeklyUpdateforecast
Changes to a SKU-location's monthly forecastForecastMonthlyUpdateforecast
Changes to the status of an inbound taskTaskStatusUpdatetask

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

StepPage
Build an endpoint that receives webhooksReceiving Webhooks
Create a configuration: URL, authorization, triggersConfiguring Webhooks
Use OAuth 2.0 to authenticate deliveriesOAuth 2.0 Webhook Destinations
Send only the records you wantWebhook Filters
See what each trigger sendsWebhook Payload Samples
Follow deliveries, retries and resendsDelivery & 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

StatusWhen
400 Bad RequestA 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 UnauthorizedYour credentials are missing or invalid. See Authentication.
403 ForbiddenYour credentials do not include webhook access.
404 Not FoundNo configuration, or no webhook, with the Id in the path.

See Errors Handling & Exceptions for the error body.


Did this page help you?