DEV Community

loading...

Go - Prevent Slack Event API retry call

takakd profile image Takahiro Kudo Updated on ・1 min read

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

Discussion (0)

pic
Editor guide