MGR’s notification Webhook will notify a URL of your choice via HTTP/HTTPS POST with information about events that occur as MGR processes your data. Notifications can be configured to send webhooks to your server when important events occur within the MGR system. These webhooks allow you to trigger different behaviours in your server depending on the status of the notifications you send.

Webhooks are sent as POST requests with a JSON body. You configure the request body payload in the content section.

So how do you set up webhooks in the notifications?

  1. Please go to the Notifications section in the shop settings.
  2. Click on the EDIT icon next to the notification you want to send it to your server.
  3. From the popup please provide the following 4 pieces of information.
    1. Webhook URL – URL of the endpoint
    2. Username – If applicable
    3. Password – If applicable
    4. Payload – JSON Required
  4. The payload is where you define what format the data should be in. Please note that you can change everything to suit your needs, you can use the TAGS for the values where needed. Your data will look like the following example. Please note that the following example is only for illustration purposes.
    {
    "customer_account_url": "{customer_account_url}",
    "ticket_ref": "{ticket_ref}",
    "device_id": "{cf_34977}",
    "model": "{ticket_model}"
    }
Headers
  KEY   VALUE
  Authorization   Basic: username: password
  User-Agent   always mygadgetrepairs
  Content-Type   always application/json
  mgr-event-id   the type of event that triggered the webhook.

You can add additional headers by clicking on the “Add Headers” button. Please enter the headers in the below JSON format.

{
“header”: "value",
“header2”: “value”
}


Expected response

We expect your server to respond to webhook requests with a 2XX status code within five seconds. Non-2XX responses, or responses that take more than five seconds, will be considered failures. Your server should return the repose as soon as it gets the request and then do whatever needs to be done with the data afterwards.

Retry strategy
  • If your server fails to reply with a 2xx status code, we will retry the webhook request up to five times – every 300 seconds. Please note that you can always retry the failed ones from the webhook queue.
  • If your server fails to reply within five seconds, we will consider it as a request timeout. In this case, it is possible that your server may have already processed the request and we will still retry up to five times – every 300 seconds. So we recommend you send a unique identity within the payload that you could test if your server has already processed and only process it if it was not already done.
  • After 24 hours all the failed ones will be deleted automatically so there will not be further retries.

 

Was this article helpful to you?

mm

John Smith

Leave a Reply

You must be logged in to post a comment.