Documentation
¶
Overview ¶
Package webhook provides the outbound webhook integration definition, which posts signed JSON payloads to a destination the organization controls
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrURLInvalid indicates the destination url is unparsable or not allowed ErrURLInvalid = errors.New("webhook: destination url invalid") // ErrHTTPSRequired indicates the destination url does not use https ErrHTTPSRequired = errors.New("webhook: destination url must use https") // ErrHeaderNameInvalid indicates a static header name is invalid ErrHeaderNameInvalid = errors.New("webhook: header name invalid") // ErrSigningSecretInvalid indicates a whsec_ signing secret is not valid base64 ErrSigningSecretInvalid = errors.New("webhook: signing secret invalid") // ErrMessageIDInvalid indicates the message id is empty or contains a full stop ErrMessageIDInvalid = errors.New("webhook: message id invalid") // ErrSignatureFormatInvalid indicates the signature format has no signature placeholder ErrSignatureFormatInvalid = errors.New("webhook: signature format must contain {signature}") // ErrSignatureEncodingInvalid indicates the signature encoding is not hex or base64 ErrSignatureEncodingInvalid = errors.New("webhook: signature encoding must be hex or base64") // ErrClientBuild indicates the webhook client could not be constructed ErrClientBuild = errors.New("webhook: unable to build client") // ErrDeliveryFailed indicates a delivery failure that may succeed on retry ErrDeliveryFailed = errors.New("webhook: delivery failed") // ErrDeliveryRejected indicates the destination rejected the delivery ErrDeliveryRejected = errors.New("webhook: delivery rejected by destination") // ErrResultEncode indicates the delivery result could not be serialized ErrResultEncode = errors.New("webhook: result encode failed") )
View Source
var ( // DefinitionID is the stable identifier for the webhook integration definition DefinitionID = types.NewDefinitionRef("def_01K0WEBHOOK0000000000000001") )
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client posts signed deliveries to one installation's destination
type CredentialSchema ¶
type CredentialSchema struct {
// URL is the destination every delivery is posted to
URL string `json:"url" jsonschema:"required,title=Destination URL,description=HTTPS endpoint that receives the JSON deliveries."`
// Headers are static headers added to every delivery, such as an API key the destination requires
Headers map[string]string `` /* 196-byte string literal not displayed */
// SigningSecret signs each delivery with HMAC-SHA256; deliveries are unsigned when empty
SigningSecret string `` /* 244-byte string literal not displayed */
// SignatureHeader replaces the Standard Webhooks signature with a signature of the body alone in this header, for a destination that dictates its own
SignatureHeader string `` /* 244-byte string literal not displayed */
// SignatureFormat is the custom signature header value, with {signature} replaced by the encoded signature
SignatureFormat string `` /* 195-byte string literal not displayed */
// SignatureEncoding is how the custom signature bytes are written
SignatureEncoding string `` /* 168-byte string literal not displayed */
}
CredentialSchema holds the destination, the headers it requires and optional signing for one installation
type DeliverOperation ¶
type DeliverOperation struct {
// ID identifies the message and is the same on every attempt; sent as webhook-id for the destination to deduplicate on
ID string `` /* 142-byte string literal not displayed */
// Body is the JSON document posted to the destination as-is
Body json.RawMessage `json:"body" jsonschema:"required,title=Body,description=JSON document posted to the destination."`
}
DeliverOperation holds per-invocation parameters for one webhook delivery
type DeliverResult ¶
type DeliverResult struct {
// StatusCode is the HTTP status the destination returned
StatusCode int `json:"statusCode"`
}
DeliverResult is the outcome of one webhook delivery
type InstallationMetadata ¶
type InstallationMetadata struct {
// Host is the destination host deliveries are posted to
Host string `json:"host,omitempty" jsonschema:"title=Host"`
}
InstallationMetadata holds the destination details for one installation
Click to show internal directories.
Click to hide internal directories.