Webhook

A webhook is a mechanism that allows a subscriber to be kept up to date with changes to the ERP datastore in real-time. If you are subscribed to a certain webhook, the API will advise you that there has been an update using your provided callback URL.

How to subscribe to a webhook

In order to subscribe to a webhook, you need to choose the source and type of data that you would like to subscribe to. For example, if you would like to be kept abreast of shipment data, you would need to the keep track of the SAP ERP data for shipments. The following webhooks are available;

  • Type: "autosettlement"

  • Type: "cashlessresponse"

  • Type: "newcustomerresponse"

  • Type: "notificationupdates"

  • Type: "order-status"

  • Type: "shipment"

  • Type: "shipmentcancel"

You can then subscribe to the webhook API by sending the request body below to the following API endpoint.

(Note: You are only required to subscribe once, thereafter you will receive notifications on the endpoint you have provided in the Callback.)

Request URL:

https://apim-ais-penbev-dev.azure-api.net/webhooks/Subscribe

Request body:

{
"UserIdentifier": "subscriber_name",
"Source": "sap",
"Type": "shipment", //see list above for available types
"Subtype": "", //not currently used
"Callback": {
"Endpoint": "https://your_endpoint_to_receive_notification",
"Authentication": {
"AuthenticationType": "NONE"
}
}
}

Once you are subscribed, the Callback endpoint you provided will be notified with the following response every time there has been an update to the relevant data.

Notification Response

You will receive a notification with the following format:

{

"Source": "sap",

"Type": "shipment",

"Subtype": "",

"Id": "0001391959", //SAP Identifier when relevant

"Reference": null, //External Identifier when relevant

"Message": "Shipment successful",

//This is the endpoint to call to retrieve the related data

"Endpoint": "https://asfa-penbev-ais-sap-transactional-api-prd-01.azurewebsites.net/api/ShipmentSync?code=k9zWvX1Zj0/6fwb+zmp+A9rW6AKntqpsbV2aOtrXiVVXlQlU0qpu+g==&clientId=apim-apim-ais-penbev-prd&datatype=shipment",

"DateTimeStamp": "240906081059"

}

Go to Callback authentication for more examples on the different types of authentication that are catered for.