Loyale has a retry system where the webhook will attempt to resend itself if it does not receive a HTTP success code (200–299). The system will attempt to retry for a maximum of 10 times (a duration of about 5 hours) or until a success code is received. An email will be sent on the first failed attempt to indicate that retries are being attempted and on the last failed attempt to indicate that it will no longer retry.
The final email will contain the Topic, the URL which it tried to connect to, the Error Code and Error Message that it received in response, the Id of the job which retried the webhook and finally the Id of the object which was attempted to be sent.

Get list of failed webhook jobs:

curl -X GET "https://api.loyale.io/api/Webhook/Failed" 
-H "accept: */*" 
-H "Scheme: 8f4089bc-91b6-4078-8403-cfd07b285cdb"

This will return the following data if there are any failed webhooks:

[
  {
    "id": "2d4e8ef8-f8dd-4d10-98af-db2e1b54a4d2",
    "topic": 1,
    "url": "https://example.net/updatedcustomer",
    "email": "[email protected]",
    "data": "Customer Id: 7b869944-02bf-483c-aeaf-a50edaa97297",
    "reason": "404 Not Found",
    "createdBy": "System",
    "updatedBy": "System",
    "createdDate": "2022-03-09T10:27:44Z",
    "updatedDate": "2022-03-09T11:52:52Z"
  },
  {
    "id": "51a22a67-726c-4f87-8300-b697d04af8b5",
    "topic": 9,
    "url":  "https://example.net/suspendedcustomer",
    "email": "[email protected]",
    "data": "Customer Id: 2408153e-8427-4706-8ca8-9b9deef49ab7",
    "reason": "404 Not Found",
    "createdBy": "System",
    "updatedBy": "System",
    "createdDate": "2022-04-25T13:15:53Z",
    "updatedDate": "2022-04-25T13:15:53Z"
  }
]

Data represent the Id of the object which was being sent in the webhook. This is can be sent in the following formats: "Customer Id: ", "Transaction Id: ", "AdditionalCustomerFields Id: ", "Customer Coupon Id:" and "Target Customer Id: {targetCustomerId}, Source Customer Id: ".

Retry Failed webhooks:
There are two endpoints for this.

curl -X POST "https://api.loyale.io/api/Webhook/FailedRetry" 
H "accept: */*" 
-H "Scheme: 8f4089bc-91b6-4078-8403-cfd07b285cdb" 
-H "Content-Type: application/json-patch+json" 
-d "[\"3fa85f64-5717-4562-b3fc-2c963f66afa6\"]"

The above endpoint requires passing a list of GUIDs in the body, the webhooks with a matching id will be retried.

curl -X POST "https://api.loyale.io/api/Webhook/FailedRetryAll" 
-H "accept: */*" 
-H "Scheme: 8f4089bc-91b6-4078-8403-cfd07b285cdb"

This endpoint on the other hand will retry all of the failed webhooks.

For both of these endpoints the failed webhooks will be removed from the list and retried for a maximum of 10 times. If the retry count is exceeded then the webhooks will be added to the failed webhook list, thus allowing the jobs to be retried again.


What’s Next