Webhooks

Webhooks is a mechanism allowing to send HTTP requests to the URL configured by Admin, triggered by some event, such as customer registration, transaction created, customer data edit etc. There is no need to be a request initiated on your end, data is sent whenever there’s new data available.

To setup a webhook all you have to do is register a URL with the company proving the service you’re requesting data from. That URL will accept data and can activate a workflow to turn the data into something useful.

Webhooks Enable Option

To enable Webhook:

  1. Tap the Settings icon settings in the upper-right corner and choose Configuration on the menu.
  1. Scroll down to Webhooks section, and to enable mechanism do the following:
  • In Webhooks field mark Enable webhooks checkbox
  • Enter configured URL address on which request will be sent
  • In Request header name as an additional security measure for webhooks batch provide a custom header that batches can be securely sent to your webhook endpoint(s). This gives you the option of rejecting webhook batches if these custom headers and associated values are not included in the batch
  • In Request header value enter associated with header value
  1. When it is done, tap SAVE

Available webhooks

onCustomerUpdate

{
   "type": "customer.updated",
    "data": {
            "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff"
         }
}

onCustomerDeleted

{
   "type": "customer.deleted",
    "data": {
            "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff"
         }
}

onCustomerRegistered

{
   "type": "customer.registered",
   "data": {
       "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff",
       "data": {
           "firstName": "Jon",
           "lastName": "Doe",
           "gender": "not_disclosed",
           "email": "jdoe@example.com",
           "phone": 123456789,
           "levelAchievementDate": "2019-08-09T14:08:28+02:00",
           "createdAt": 1563363348,
            "address": {
               "street": "Streets",
               "address1": "12",
               "address2": "3",
               "postal": "41-222",
               "city": "Glasgow",
               "province": "Glasgow",
               "country": "GB"
           },
           "company": {
               "name": "Hydropol",
               "nip": "123"
           },
           "loyaltyCardNumber": "444555666",
           "labels": [
               {
                   "key": "labels_key",
                   "value": "5"
               }
           ],
           "agreement1": true,
           "agreement2": false,
           "agreement3": false,
           "levelId": "e82c96cf-32a3-43bd-9034-4df343e50000",
           "posId": "00000000-0000-474c-1111-b0dd880c07e3",
           "sellerId": "00000000-0000-474c-b092-b0dd880c07e4"
       }
   }
}

onCustomerDeactivated

{
   "type": "customer.deactivated",
   "data": {
       "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff"
   }
}

onCustomerLevelChangedAutomatically

{
   "type": "customer.level_changed_automatically",
   "data": {
       "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff",
       "levelId": "e82c96cf-32a3-43bd-9034-4df343e51111",
       "levelName": "level1",
       "levelMove": "up",
             "levelAchievementDate": "2019-08-09T14:08:28+02:00",
   }
}

onCustomerLevelChanged

{
   "type": "customer.level_changed",
   "data": {
       "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff",
       "levelId": "e82c96cf-32a3-43bd-9034-4df343e50000",
       "levelName": "level0",
             "levelAchievementDate": "2019-08-09T14:08:28+02:00",
   }
}

onTransactionRegistered

{
   "type": "transaction.registered",
   "data": {
       "transactionId": "cb4cc2f7-d897-4fe0-b5a6-9b67a91c0729",
       "transactionData": {
           "documentType": "sell",
           "documentNumber": "80",
           "purchasePlace": null,
           "purchaseDate": "2019-08-09T14:08:28+02:00"
       },
       "customerData": {
           "name": "Jon Doe",
           "email": "jdoe@example.com",
           "phone": null,
           "loyaltyCardNumber": null,
           "nip": "123",
           "address": {
               "street": "Bridges",
               "address1": "12",
               "address2": “3”,
               "postal": "41-222",
               "city": "New york",
               "province": "NY",
               "country": "EN"
           }
       },
       "items": [
           {
               "sku": {
                   "code": "sku1230"
               },
               "name": "product_name",
               "quantity": 1,
               "grossValue": 80,
               "category": "Women",
               "maker": "Exclusive",
               "labels": []
           }
       ],
       "posId": null
   }
}

onTransactionAssignedToCustomer

{
   "type": "transaction.assigned_to_customer",
   "data": {
       "transactionId": "cb4cc2f7-d897-4fe0-b5a6-9b67a91c0729",
       "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff",
       "grossValue": 80,
   }
}

onAccountAvailablePointsAmountChanged

{
   "type": "account.available_points_amount_changed",
   "data": {
       "customerId": "32c764d9-ddd5-401f-ac13-a7fcba0982ff",
       "amount": 125,
       "amountChange": 25,
       "amountChangeType": "add”,
       "pointsTransferId": "e82c96cf-32a3-43bd-9034-4df343e5f333",
       "expiresAt": "2022-01-30T23:59:59+01:00",
       "transactionId": "cb4cc2f7-d897-4fe0-b5a6-9b67a91c0729"
   }
}

onCampaignBought

{
   "type": "customer.bought_campaign",
   "createdAt": "2020-09-24T14:09:13+02:00",
   "data": {
       "storeCode": "DEFAULT",
       "customerId": "00000000-0000-474c-b092-b0dd880c07e1",
       "campaignId": "38e45c26-7c57-3962-9516-3704fa3eb776",
       "costInPoints": 1.0,
       "couponCode": "655"
   }
}

onExpiringPointsNotification

{
   "type": "account.expiring_points_notification"
   "createdAt": "2021-12-14T14:16:54+00:00",
   "data": {
          "customerId": "00000000-0000-474c-b092-b0dd880c07e1",
          "customerEmail": "jdoe@example.com",
          "customerPhone": "+123456789",
          "customerLoyaltyCardNumber": "0000",
          "customerFirstName": "Jane",
          "customerLastName": "Doe",
          "points": 100.0,
          "pointsWillExpire": "2021-11-16T22:59:59+01:00",
          "storeCode": "DEFAULT"
   }
}

onPointsTransfer

{
   "type": "account.points_transfer",
   "createdAt": "2020-09-24T14:09:13+02:00",
   "data": {
       "storeCode": "DEFAULT",
       "accountId": "b0577790-b84f-466e-b2d0-12d3c12d527b",
       "customerId": "00000000-0000-474c-b092-b0dd880c07f3",
       "customerFirstName": "TestUser",
       "customerLastName": "ForTransfersTest",
       "customerEmail": "user-transfer-1@example.com",
       "customerPhone": "1231232312312312360",
       "createdAt": "2022-12-08T13:05:44+01:00",
       "pointsTransferId": "85d1f163-f6d4-469c-8a32-aecc0f04f7ee",
       "expiresAt": "2023-01-07T23:59:59+01:00",
       "value": 100,
       "issuer": "admin",
       "type": "adding",
       "state": "active"
   }
}