Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

Panel
borderColor#dbdbdb

When some events occur, extend will Post a call with brief information to the callback url.

The body is signed using SHA256 with your secret. The signed value is added in request header 'ms-signature'. The body should be verified before processing to avoid spam calls

Webhooks

Panel
borderColor#dbdbdb

Currently these events triggers a post:

EntityEvent/ActionDescription
CustomerCustomerCreatedTriggered when a customer is created
CustomerCustomerChangedTriggered when customer master data is changed
OfferOfferCreatedTriggered when an offer is created
OfferOfferChangedTriggered when an offer is changed
Order

OrderPicked

Triggered when at least on order row is picked. Can trigger multiple times for one order.
OrderOrderReservedTriggered when at least one order row is reserved and sent to warehouse. Can trigger multiple times for one order.
OrderOrderCancelledTriggered when complete order is cancelled. Can only trigger once for one order.
OrderOrderDeliveryDataChanged

Triggered when data on order affecting delivery date is changed.

Triggered by changes on AskedDeliveryDate, Route, Row quantity, Row price, New row, Cancelled row

ProductBalanceChangedTriggered when physical is changed for a product.
ProductAvailableBalanceChangedTriggered when available balance is changed for a product
ProductProductCreatedTriggered when a product is created
ProductProductChangedTriggered when a product is changed
PurchasePurchasePartiallyDeliveredTriggered when at least one row on purchase order is delivered but the purchase is still open. Can trigger multiple times for one purchase.
PurchasePurchaseCancelledTriggered when purchase is cancelled. Can only trigger once for one purchase.
PurchasePurchaseDeliveredTriggered when a row on purchase order is delivered and the purchase has no open rows. Can only trigger multiple times once for one purchase.

Example

Panel
borderColor#dbdbdb

The content in Notifications array will be different depending on the Action

PurchasePartiallyDelivered:


{
"Id": "6e249eebb818463086ae0dda6eeba7b2",
"Attempt": 1,
"Properties":
{ "NotificationId": "3b3fd4a6-36d5-46fe-8a3f-e73532529db3" }

,
"Notifications": [
{
"Action": "PurchasePartiallyDelivered",
"Details":
{ "OrderNumber": "RP-101", "Warehouse": "GreenWarehouse" }

}
]
}


ProductCreated:


{

"Id": "13f078bcbe2243dc997655ed2cdbbdf7",

"Attempt": 1,

"Properties": {

"NotificationId": "90c6340b-1f5c-49e0-9cee-45df5dd145c2"

},

"Notifications": [

{

"Action": "ProductCreated",

"Details": {

"ProductNumber": "Financial Invoice"

}

}

]

}

Signing

Panel
borderColor#dbdbdb

To make sure the webhook is sent by Extend it is signed. It is optional to use the signature for verification.

Body is signed using SHA256 with clientsecret. The signed value is added in header 'ms-signature'

ClientSecret:

Body: the full request body

SignatureFromHeader: request header 'ms-signature'


Sample pseudo code:

byte[] secret = Encoding.UTF8.GetBytes(ClientSecret);

using (var hasher = new HMACSHA256(secret))

{

byte[] data = Body.ToByteArray();

actualHash = hasher.ComputeHash(data);

}

byte[] expectedHash = FromHex(SignatureFromHeader).ToByteArray()

if(IsSecretEqual(expectedHash, actualHash))

{

//process web hook

}



Sample

ClientSecret = secret123

Body = {'test':'test2'}

BodyAsHex = 7B2774657374273A277465737432277D

ms-signature = sha256=25FB6994568A75CD233E04BA1C653AF1BF476041CC543AF04F82CAAC482C201A



Info








På denna sida:

Table of Contents