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

graphhook

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package graphhook serves the Meta Graph webhook endpoint shared by the Cloud API chat adapters (WhatsApp, Messenger): the one-time hub.challenge subscribe handshake and the X-Hub-Signature-256 raw-body HMAC check, both compared in constant time via hmac.Equal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler added in v0.19.1

func Handler[T any](verifyToken, appSecret string, handle func(*T) error) http.Handler

Handler serves a Graph webhook. GET echoes the raw hub.challenge with a 200 iff hub.mode is "subscribe" and hub.verify_token matches verifyToken, else 403. POST checks header = "sha256=" + hex(HMAC-SHA256(body, appSecret)) over the raw body BEFORE parsing (Meta signs the exact bytes sent), decodes it into a T and hands it to handle; a handle error replies 500 so Meta redelivers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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