Skip to main content

Retry Mechanism

To use Webhook Notification retry mechanism, you should return a response with HTTP Status Code other than 2xx. This response will inform the Webhook Notification sender to retry the request as much as 10 times with intervals of 15 minutes.

If you're unfamiliar with HTTP Status Codes, we recommend reading this wikipedia article for reference.

This Golang example uses Golang Standard Library, if you’re unfamiliar with how Golang works, we recommend reading the official documentation here.

import (
"log"
"net/http"
)

func main() {
http.HandleFunc("/listener", func(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(http.StatusBadRequest)
})
log.Print("Server is running!")
log.Fatal(http.ListenAndServe(":8080", nil))
}

To test the code above, using this command.

curl -X POST 'http://localhost:8080/listener' -i

It will show this message.

HTTP/1.1 400 Bad Request
Date: Tue, 30 Jun 2020 13:46:51 GMT
Content-Length: 1
Content-Type: text/plain; charset=utf-8

The first line HTTP/1.1 400 Bad Request shows that it's status code is not 2xx, which will prompt a retry to our server.

This means that you now know how to ask our Webhook Notification to retry, Congratulations!