Webhooks
Get notified when GAINS data changes: the webhook triggers, the DataType each sends, and the steps to set one up.
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, inventory policies or forecasts change, or one of your inbound tasks changes status. This page lists the triggers and the steps to set one up; the pages below cover each step.
Triggers
A trigger is the kind of event a webhook reports. You enable triggers per webhook configuration, and each payload carries the records of one trigger only. The payload's DataType names the subject of those records, not the trigger: both forecast triggers send forecast.
| 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 write in
Triggers, in filters and in theTriggerparameters of the webhook endpoints. Webhook history reports triggers in underscored spelling, such aspo_submit. - If you subscribe to both forecast triggers, tell their payloads apart by the length of their buckets, as Webhook Payload Samples describes.
Setting up a webhook
| Step | Page |
|---|---|
| Create a configuration: URL, authorization, triggers, batching | 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 |
| Build the endpoint that receives webhooks | Receiving Webhooks |
| 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.
Related
- Configuring Webhooks: create and manage configurations
- Delivery & Recovery: retries, history and resending
- Pull or Push: when to read an endpoint and when to use a webhook
- Outbound Subjects: which subjects also arrive by webhook
- Integration Tasks: the tasks
TaskStatusUpdatereports on
Updated 17 days ago
