DEV Community

Takahiro Kudo
Takahiro Kudo

Posted on • Updated on

Go - Prevent Slack Event API retry call

Prevent Slack Event API retry call if the callback returns the error response.

func handler(w http.ResponseWriter, r *http.Request) {
    // Process something...

    // Set "X-Slack-No-Retry: 1" if prevent retry.
    w.Header().Set("X-Slack-No-Retry", "1")

    w.Header().Set("Content-Type", "application/json")
    w.WriteHeader(http.StatusBadRequest)
    w.Write([]byte(""))
}
Enter fullscreen mode Exit fullscreen mode

Reference

https://api.slack.com/events-api#the-events-api__field-guide__error-handling__graceful-retries__turning-retries-off

Top comments (0)