DEV Community

Takahiro Kudo
Takahiro Kudo

Posted on • Edited on

1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay