Help us shape the future of Go! Take the 2026 Go Developer Survey

whsetup

package
v1.152.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package whsetup answers the checks a webhook sender makes of an address before it delivers to it (#2223): Slack's url_verification and monday.com's challenge echoed back, Zoom's endpoint.url_validation answered with an HMAC of its token, Discord's PING answered with a PONG, and Microsoft Graph's validation token returned as plain text.

It decides whether a request is a source's setup check and what the answer is. It writes nothing and counts nothing: the receiver writes the answer, counts it as a setup check, and stores nothing for it.

Index

Constants

View Source
const (
	ContentJSON = "application/json"
	// ContentText is Graph's validation answer, which must be plain text.
	ContentText = "text/plain; charset=utf-8"
)

Content types an answer is written in.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	ContentType string
	Body        []byte
}

Answer is the body a setup check is answered 200 with.

func AfterVerification

func AfterVerification(src whsource.Source, body []byte) (Answer, bool)

AfterVerification answers the checks made of a request that has verified: Zoom's url_validation, whose answer is an HMAC under the source's secret (answered unverified, it would sign any text for anyone, which forges Zoom signatures), and Discord's PING, which Discord expects refused unsigned.

func BeforeVerification

func BeforeVerification(src whsource.Source, body []byte) (Answer, bool)

BeforeVerification answers a challenge_echo source's check with its challenge. monday.com does not sign its challenge, so it is answered before the request is verified; echoing it hands the caller back only what it sent.

func FromQuery

func FromQuery(src whsource.Source, query url.Values) (Answer, bool)

FromQuery answers a graph_validation source's validation request, which is read from the address alone: the token, URL-decoded, as plain text. It is answered before the body is read or verified, since Graph's validation carries no clientState, and is never written into an HTML or JSON body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL