[{"data":1,"prerenderedAt":7111},["ShallowReactive",2],{"docs-navigation":3,"content-query-0sEPff3yN8":342},[4,7,10,13,16,19,22,25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,73,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,181,184,187,190,193,196,199,202,205,208,211,214,217,220,223,226,229,232,235,238,241,244,247,250,253,256,259,262,265,268,271,274,277,280,283,285,288,291,294,297,300,303,306,309,312,315,318,321,324,327,330,333,336,339],{"_path":5,"title":6},"/docs/account/account-management","Account management",{"_path":8,"title":9},"/docs/account/mfa","Multi-factor authentication (MFA)",{"_path":11,"title":12},"/docs/account/team","Teams and sub-accounts",{"_path":14,"title":15},"/docs/account/billing-and-subscriptions","Billing & subscriptions",{"_path":17,"title":18},"/docs/account/access-tokens","Webhook Relay access tokens: permissions and subscription scopes",{"_path":20,"title":21},"/docs/clawhub","Webhook Relay on ClawHub",{"_path":23,"title":24},"/docs/email","Receive emails as webhooks",{"_path":26,"title":27},"/docs/email/payload","Email webhook payload",{"_path":29,"title":30},"/docs/email/filtering-and-policy","Sender filtering & policy",{"_path":32,"title":33},"/docs/email/cli","Create & poll email addresses from the CLI",{"_path":35,"title":36},"/docs","Getting Started",{"_path":38,"title":39},"/docs/installation/cli","CLI",{"_path":41,"title":42},"/docs/installation/docker","Docker container",{"_path":44,"title":45},"/docs/installation/docker-compose","Docker Compose",{"_path":47,"title":48},"/docs/installation/kubernetes","Kubernetes",{"_path":50,"title":51},"/docs/installation/autostart-windows","Autostart (Windows)",{"_path":53,"title":54},"/docs/installation/autostart-linux","Autostart (Linux)",{"_path":56,"title":57},"/docs/installation/autostart-macos","Autostart (MacOS)",{"_path":59,"title":60},"/docs/installation/behind-proxy","HTTP proxy configuration",{"_path":62,"title":63},"/docs/mcp","MCP Server",{"_path":65,"title":66},"/docs/outbound","Outbound Gateway: send webhooks to your customers",{"_path":68,"title":69},"/docs/outbound/setup","Set up the Outbound Gateway",{"_path":71,"title":72},"/docs/outbound/receiving","Receive and verify outbound webhooks",{"_path":74,"title":75},"/docs/outbound/operating","Monitor, retry and recover deliveries",{"_path":77,"title":78},"/docs/outbound/migrate","Migrate to the Outbound Gateway",{"_path":80,"title":81},"/docs/outbound/migrate/svix","Migrate from Svix",{"_path":83,"title":84},"/docs/outbound/migrate/hookdeck-outpost","Migrate from Hookdeck Outpost",{"_path":86,"title":87},"/docs/outbound/migrate/convoy","Migrate from Convoy",{"_path":89,"title":90},"/docs/outbound/migrate/hook0","Migrate from Hook0",{"_path":92,"title":93},"/docs/outbound/migrate/diy","Migrate a homegrown webhook sender",{"_path":95,"title":96},"/docs/security","Security & Tech",{"_path":98,"title":99},"/docs/service-connections","Service Connections",{"_path":101,"title":102},"/docs/service-connections/ai-providers","AI provider connections",{"_path":104,"title":105},"/docs/service-connections/aws_s3","AWS S3",{"_path":107,"title":108},"/docs/service-connections/aws_sns","AWS SNS",{"_path":110,"title":111},"/docs/service-connections/aws_sqs","AWS SQS",{"_path":113,"title":114},"/docs/service-connections/azure","Azure",{"_path":116,"title":117},"/docs/service-connections/gcp_gcs","GCP Cloud Storage",{"_path":119,"title":120},"/docs/service-connections/gcp_pubsub","GCP Pub/Sub",{"_path":122,"title":123},"/docs/service-connections/secrets","Secrets",{"_path":125,"title":126},"/docs/skills","Agent Skills",{"_path":128,"title":129},"/docs/skills-cli","skills.sh — the Agent Skills CLI",{"_path":131,"title":132},"/docs/tunnels/demoing-your-website","Demoing your website",{"_path":134,"title":135},"/docs/tunnels/regions","Regions",{"_path":137,"title":138},"/docs/tutorials/cicd/jenkins-bitbucket","Jenkins and Bitbucket",{"_path":140,"title":141},"/docs/tutorials/cicd/jenkins-github","Jenkins and GitHub",{"_path":143,"title":144},"/docs/tutorials/cicd/jenkins-plugin","Jenkins Plugin",{"_path":146,"title":147},"/docs/tutorials/cicd/jenkins-plugin-multibranch","Jenkins Multibranch Pipelines",{"_path":149,"title":150},"/docs/tutorials/cicd/kubernetes-operator","Kubernetes Operator",{"_path":152,"title":153},"/docs/tutorials/cicd/terraform-atlantis","Terraform Atlantis",{"_path":155,"title":156},"/docs/tutorials/cicd/webhook-exec","Execute scripts on webhook",{"_path":158,"title":159},"/docs/tutorials/edge/home-assistant","Home Assistant",{"_path":161,"title":162},"/docs/tutorials/edge/javascript-app","JavaScript app",{"_path":164,"title":165},"/docs/tutorials/edge/node-red","Node-RED",{"_path":167,"title":168},"/docs/tutorials/email/airtable","Email to Airtable",{"_path":170,"title":171},"/docs/tutorials/email/api","Email to API",{"_path":173,"title":174},"/docs/tutorials/email/database","Email to Database",{"_path":176,"title":177},"/docs/tutorials/email/discord","Email to Discord",{"_path":179,"title":180},"/docs/tutorials/email/google-sheets","Email to Google Sheets",{"_path":182,"title":183},"/docs/tutorials/email/microsoft-teams","Email to Microsoft Teams",{"_path":185,"title":186},"/docs/tutorials/email/notion","Email to Notion",{"_path":188,"title":189},"/docs/tutorials/email/slack","Email to Slack",{"_path":191,"title":192},"/docs/tutorials","Tutorials",{"_path":194,"title":195},"/docs/tutorials/n8n/email-trigger","n8n Email Trigger (Inbound Email)",{"_path":197,"title":198},"/docs/tutorials/n8n/webhook-trigger","n8n Webhook Trigger (No Public IP)",{"_path":200,"title":201},"/docs/tutorials/n8n/whatsapp-cloud-api-webhook","n8n WhatsApp Cloud API Webhook Setup",{"_path":203,"title":204},"/docs/tutorials/outbound/send-webhooks-nodejs","Send webhooks to your customers from a Node.js / TypeScript app",{"_path":206,"title":207},"/docs/tutorials/outbound/send-webhooks-go","Send webhooks to your customers from a Go service",{"_path":209,"title":210},"/docs/tutorials/outbound/nextjs-saas-webhooks","Add webhooks to a Next.js SaaS app",{"_path":212,"title":213},"/docs/tutorials/transform/docker-to-slack","DockerHub webhook to Slack notification",{"_path":215,"title":216},"/docs/tutorials/transform/enrich-webhooks","Enrich webhooks from APIs",{"_path":218,"title":219},"/docs/tutorials/transform/stripe-to-plain","Sync Stripe subscriptions to Plain.com tenants",{"_path":221,"title":222},"/docs/tutorials/warehouse/bigquery","GCP BigQuery",{"_path":224,"title":225},"/docs/webhooks/alerts","Alerts",{"_path":227,"title":228},"/docs/webhooks/auth/username-password","Username and password",{"_path":230,"title":231},"/docs/webhooks/auth/hmac","HMAC",{"_path":233,"title":234},"/docs/webhooks/auth/jwt","JWT authentication",{"_path":236,"title":237},"/docs/webhooks/auth/http-method","Auth using request method",{"_path":239,"title":240},"/docs/webhooks/cors","CORS for webhooks",{"_path":242,"title":243},"/docs/webhooks/cron/using-cron-webhooks","Schedule recurring webhooks",{"_path":245,"title":246},"/docs/webhooks/custom-domains","Custom webhook domains",{"_path":248,"title":249},"/docs/webhooks/custom-subdomains","Custom webhook subdomains",{"_path":251,"title":252},"/docs/webhooks/custom-webhook-response","Custom response to webhooks",{"_path":254,"title":255},"/docs/webhooks/durable-webhooks","Durable webhooks: reliable delivery with automatic retries",{"_path":257,"title":258},"/docs/webhooks/functions/manipulating-json","JSON encoding",{"_path":260,"title":261},"/docs/webhooks/functions/make-http-request","Make HTTP request",{"_path":263,"title":264},"/docs/webhooks/functions/modify-request","Modify webhook headers, body, method and path",{"_path":266,"title":267},"/docs/webhooks/functions/multipart-form-data","Multipart form to JSON",{"_path":269,"title":270},"/docs/webhooks/functions/url-encoded-data","URL Encoded Form",{"_path":272,"title":273},"/docs/webhooks/functions/working-with-time","Working with time",{"_path":275,"title":276},"/docs/webhooks/functions/send-emails","Sending emails",{"_path":278,"title":279},"/docs/webhooks/functions/crypto-functions","Base64, encryption",{"_path":281,"title":282},"/docs/webhooks/functions/integrate-into-cicd","Integrating into CI/CD",{"_path":284,"title":222},"/docs/webhooks/functions/big-query",{"_path":286,"title":287},"/docs/webhooks/functions/accessing-metadata","Accessing metadata",{"_path":289,"title":290},"/docs/webhooks/functions/response-functions","Response (post-delivery) functions",{"_path":292,"title":293},"/docs/webhooks/functions/alerting","Alerting from functions",{"_path":295,"title":296},"/docs/webhooks/functions/helper-libraries","Helper libraries",{"_path":298,"title":299},"/docs/webhooks/functions/transform-webhook-payload","Transform a webhook payload",{"_path":301,"title":302},"/docs/webhooks/functions/filter-webhooks","Filter or drop webhooks before forwarding",{"_path":304,"title":305},"/docs/webhooks/functions/provider-helpers","Provider-aware function helpers",{"_path":307,"title":308},"/docs/webhooks/functions","Webhook transformations (functions): modify body, headers, method and path",{"_path":310,"title":311},"/docs/webhooks/internal/localhost","Receive webhooks on localhost with the relay CLI",{"_path":313,"title":314},"/docs/webhooks/large-webhooks","Large Webhooks",{"_path":316,"title":317},"/docs/webhooks/outbound-throttling","Outbound throttling: control webhook delivery speed",{"_path":319,"title":320},"/docs/webhooks/polling-webhooks","Polling webhooks with /v1/events",{"_path":322,"title":323},"/docs/webhooks/public/public-destination","Forward to public URL",{"_path":325,"title":326},"/docs/webhooks/public/multiple-destination-urls","Forward webhooks to multiple destinations",{"_path":328,"title":329},"/docs/webhooks/replay-on-agent-connect","Webhook replay on agent connect: recover missed webhooks",{"_path":331,"title":332},"/docs/webhooks/static-ip-address","Static IP Address",{"_path":334,"title":335},"/docs/webhooks/tls-ssl-errors","Fix TLS/SSL handshake errors: unsupported protocol, wrong version number, handshake failure",{"_path":337,"title":338},"/docs/webhooks/websocket-server","Connecting to websocket server",{"_path":340,"title":341},"/docs/webhooks/zero-retention-buckets","Zero Retention Buckets",{"_path":206,"_dir":343,"_draft":344,"_partial":344,"_locale":345,"title":207,"description":346,"intro":347,"type":348,"layout":349,"tags":350,"faq":356,"body":369,"_type":7104,"_id":7105,"_source":7106,"_file":7107,"_stem":7108,"_extension":7109,"sitemap":7110},"outbound",false,"","Publish signed webhooks to your customers from Go with webhookrelay-go: event catalog, consumers, endpoints, idempotent publishing from a transactional outbox, delivery inspection, failing-endpoint reports and recovery.","Your Go service publishes each event once; Webhook Relay signs it with Standard Webhooks, delivers it to every subscribed customer endpoint, retries failures and keeps 35 days of history.","tutorial","doc",[351,352,353,354,355],"Outbound webhooks","Send webhooks","Go","Transactional outbox","Standard Webhooks",[357,360,363,366],{"q":358,"a":359},"Is PublishOutboundMessage safe to retry in Go?","Yes. Set IdempotencyKey to a value derived from your event, such as invoice-paid:inv_123. Repeating the publish with the same key and message returns the original receipt instead of delivering twice. If you leave the key empty, the Go SDK generates one per call so its own automatic retries are safe, but your own retries are only deduplicated when you pass a key.",{"q":361,"a":362},"Why use a transactional outbox if Webhook Relay already retries deliveries?","Webhook Relay retries delivery to your customers once it has accepted the message. The outbox covers the step before that: if your service commits a database change and crashes before calling publish, the event row is still in the outbox and a worker publishes it later. The idempotency key makes the worker's retries safe.",{"q":364,"a":365},"How do I find customers whose webhook endpoints are failing?","Call GetOutboundHealth for counts by state and the last 24 hours of attempts and failures, then ListAllOutboundEndpoints with State set to failing. It returns failing endpoints across all consumers, longest failing first, each with its failure count over the last 24 hours.",{"q":367,"a":368},"What do Go receivers need to verify the webhooks?","Each delivery carries Standard Webhooks headers: webhook-id, webhook-timestamp and webhook-signature, an HMAC-SHA256 over the id, timestamp and raw body keyed with the endpoint's whsec_ secret. The Webhook Relay receiving guide has a 40-line Go verification function using only the standard library.",{"type":370,"children":371,"toc":7094},"root",[372,421,434,564,571,660,804,810,837,2548,2554,2583,3131,3136,3142,3154,3274,3295,4840,4877,4883,4938,5673,5679,5707,6732,6737,6770,6776,6969,7032,7038,7088],{"type":373,"tag":374,"props":375,"children":376},"element","p",{},[377,401,403,410,412,419],{"type":373,"tag":378,"props":379,"children":380},"strong",{},[381,384,391,393,399],{"type":382,"value":383},"text","To send webhooks to your customers from a Go service, add ",{"type":373,"tag":385,"props":386,"children":388},"code",{"className":387},[],[389],{"type":382,"value":390},"github.com/webhookrelay/webhookrelay-go",{"type":382,"value":392},", register each customer as a consumer with their HTTPS endpoint, and call ",{"type":373,"tag":385,"props":394,"children":396},{"className":395},[],[397],{"type":382,"value":398},"api.PublishOutboundMessage",{"type":382,"value":400}," with an idempotency key when an event happens.",{"type":382,"value":402}," Webhook Relay's ",{"type":373,"tag":404,"props":405,"children":407},"a",{"href":406},"/outbound-webhooks/",[408],{"type":382,"value":409},"Outbound Gateway",{"type":382,"value":411}," signs each delivery with ",{"type":373,"tag":404,"props":413,"children":417},{"href":414,"rel":415},"https://www.standardwebhooks.com/",[416],"nofollow",[418],{"type":382,"value":355},{"type":382,"value":420}," headers, delivers it to every subscribed endpoint, retries failures up to eight times within 48 hours (5s, 5m, 30m, 2h, 5h, 10h, 10h), paces each endpoint separately and keeps every attempt for 35 days.",{"type":373,"tag":374,"props":422,"children":423},{},[424,426,432],{"type":382,"value":425},"This tutorial builds a small CLI, ",{"type":373,"tag":385,"props":427,"children":429},{"className":428},[],[430],{"type":382,"value":431},"webhooks",{"type":382,"value":433},", with the commands a real service needs:",{"type":373,"tag":435,"props":436,"children":437},"table",{},[438,457],{"type":373,"tag":439,"props":440,"children":441},"thead",{},[442],{"type":373,"tag":443,"props":444,"children":445},"tr",{},[446,452],{"type":373,"tag":447,"props":448,"children":449},"th",{},[450],{"type":382,"value":451},"Command",{"type":373,"tag":447,"props":453,"children":454},{},[455],{"type":382,"value":456},"What it does",{"type":373,"tag":458,"props":459,"children":460},"tbody",{},[461,479,496,513,530,547],{"type":373,"tag":443,"props":462,"children":463},{},[464,474],{"type":373,"tag":465,"props":466,"children":467},"td",{},[468],{"type":373,"tag":385,"props":469,"children":471},{"className":470},[],[472],{"type":382,"value":473},"webhooks catalog",{"type":373,"tag":465,"props":475,"children":476},{},[477],{"type":382,"value":478},"Creates or updates your event types",{"type":373,"tag":443,"props":480,"children":481},{},[482,491],{"type":373,"tag":465,"props":483,"children":484},{},[485],{"type":373,"tag":385,"props":486,"children":488},{"className":487},[],[489],{"type":382,"value":490},"webhooks onboard \u003Ccustomer-id> \u003Cname> \u003Curl>",{"type":373,"tag":465,"props":492,"children":493},{},[494],{"type":382,"value":495},"Registers a customer's endpoint and prints its signing secret",{"type":373,"tag":443,"props":497,"children":498},{},[499,508],{"type":373,"tag":465,"props":500,"children":501},{},[502],{"type":373,"tag":385,"props":503,"children":505},{"className":504},[],[506],{"type":382,"value":507},"webhooks outbox",{"type":373,"tag":465,"props":509,"children":510},{},[511],{"type":382,"value":512},"Publishes pending events from a Postgres outbox table, idempotently",{"type":373,"tag":443,"props":514,"children":515},{},[516,525],{"type":373,"tag":465,"props":517,"children":518},{},[519],{"type":373,"tag":385,"props":520,"children":522},{"className":521},[],[523],{"type":382,"value":524},"webhooks inspect \u003Cmessage-id>",{"type":373,"tag":465,"props":526,"children":527},{},[528],{"type":382,"value":529},"Shows where a message went and what each endpoint answered",{"type":373,"tag":443,"props":531,"children":532},{},[533,542],{"type":373,"tag":465,"props":534,"children":535},{},[536],{"type":373,"tag":385,"props":537,"children":539},{"className":538},[],[540],{"type":382,"value":541},"webhooks failing",{"type":373,"tag":465,"props":543,"children":544},{},[545],{"type":382,"value":546},"Lists failing endpoints across all customers",{"type":373,"tag":443,"props":548,"children":549},{},[550,559],{"type":373,"tag":465,"props":551,"children":552},{},[553],{"type":373,"tag":385,"props":554,"children":556},{"className":555},[],[557],{"type":382,"value":558},"webhooks recover \u003Cendpoint-id> \u003Csince>",{"type":373,"tag":465,"props":560,"children":561},{},[562],{"type":382,"value":563},"Re-sends deliveries that exhausted their retries after an outage",{"type":373,"tag":565,"props":566,"children":568},"h2",{"id":567},"prerequisites",[569],{"type":382,"value":570},"Prerequisites",{"type":373,"tag":572,"props":573,"children":574},"ul",{},[575,586,635,643],{"type":373,"tag":576,"props":577,"children":578},"li",{},[579,584],{"type":373,"tag":378,"props":580,"children":581},{},[582],{"type":382,"value":583},"A Webhook Relay account on the Basic plan or above.",{"type":382,"value":585}," The Outbound Gateway is self-serve on Basic ($9.99/month), Business and Pro, not on the Free plan.",{"type":373,"tag":576,"props":587,"children":588},{},[589,594,596,603,605,610,612,617,619,625,627,633],{"type":373,"tag":378,"props":590,"children":591},{},[592],{"type":382,"value":593},"An outbound-restricted access token",{"type":382,"value":595}," from the ",{"type":373,"tag":404,"props":597,"children":600},{"href":598,"rel":599},"https://my.webhookrelay.com/tokens",[416],[601],{"type":382,"value":602},"Access Tokens",{"type":382,"value":604}," page. Choose ",{"type":373,"tag":378,"props":606,"children":607},{},[608],{"type":382,"value":609},"Outbound: manage",{"type":382,"value":611}," for the onboarding commands and ",{"type":373,"tag":378,"props":613,"children":614},{},[615],{"type":382,"value":616},"Outbound: publish only",{"type":382,"value":618}," (",{"type":373,"tag":385,"props":620,"children":622},{"className":621},[],[623],{"type":382,"value":624},"\"permissions\": { \"outbound\": \"publish\" }",{"type":382,"value":626},") for the process that runs the outbox worker. Restricted tokens can only reach ",{"type":373,"tag":385,"props":628,"children":630},{"className":629},[],[631],{"type":382,"value":632},"/v1/outbound/*",{"type":382,"value":634},".",{"type":373,"tag":576,"props":636,"children":637},{},[638],{"type":373,"tag":378,"props":639,"children":640},{},[641],{"type":382,"value":642},"Go 1.23 or newer.",{"type":373,"tag":576,"props":644,"children":645},{},[646,651,653,659],{"type":373,"tag":378,"props":647,"children":648},{},[649],{"type":382,"value":650},"A public HTTPS URL to test with",{"type":382,"value":652},", for example a free ",{"type":373,"tag":404,"props":654,"children":656},{"href":655},"/webhook-bin/",[657],{"type":382,"value":658},"Webhook Bin",{"type":382,"value":634},{"type":373,"tag":661,"props":662,"children":666},"pre",{"className":663,"code":664,"language":665,"meta":345,"style":345},"language-bash shiki shiki-themes github-dark","mkdir webhooks && cd webhooks\ngo mod init example.com/webhooks\ngo get github.com/webhookrelay/webhookrelay-go@latest\n\nexport RELAY_KEY=YOUR_TOKEN_KEY\nexport RELAY_SECRET=YOUR_TOKEN_SECRET\n","bash",[667],{"type":373,"tag":385,"props":668,"children":669},{"__ignoreMap":345},[670,705,729,747,757,782],{"type":373,"tag":671,"props":672,"children":675},"span",{"class":673,"line":674},"line",1,[676,682,688,694,700],{"type":373,"tag":671,"props":677,"children":679},{"style":678},"--shiki-default:#B392F0",[680],{"type":382,"value":681},"mkdir",{"type":373,"tag":671,"props":683,"children":685},{"style":684},"--shiki-default:#9ECBFF",[686],{"type":382,"value":687}," webhooks",{"type":373,"tag":671,"props":689,"children":691},{"style":690},"--shiki-default:#E1E4E8",[692],{"type":382,"value":693}," && ",{"type":373,"tag":671,"props":695,"children":697},{"style":696},"--shiki-default:#79B8FF",[698],{"type":382,"value":699},"cd",{"type":373,"tag":671,"props":701,"children":702},{"style":684},[703],{"type":382,"value":704}," webhooks\n",{"type":373,"tag":671,"props":706,"children":708},{"class":673,"line":707},2,[709,714,719,724],{"type":373,"tag":671,"props":710,"children":711},{"style":678},[712],{"type":382,"value":713},"go",{"type":373,"tag":671,"props":715,"children":716},{"style":684},[717],{"type":382,"value":718}," mod",{"type":373,"tag":671,"props":720,"children":721},{"style":684},[722],{"type":382,"value":723}," init",{"type":373,"tag":671,"props":725,"children":726},{"style":684},[727],{"type":382,"value":728}," example.com/webhooks\n",{"type":373,"tag":671,"props":730,"children":732},{"class":673,"line":731},3,[733,737,742],{"type":373,"tag":671,"props":734,"children":735},{"style":678},[736],{"type":382,"value":713},{"type":373,"tag":671,"props":738,"children":739},{"style":684},[740],{"type":382,"value":741}," get",{"type":373,"tag":671,"props":743,"children":744},{"style":684},[745],{"type":382,"value":746}," github.com/webhookrelay/webhookrelay-go@latest\n",{"type":373,"tag":671,"props":748,"children":750},{"class":673,"line":749},4,[751],{"type":373,"tag":671,"props":752,"children":754},{"emptyLinePlaceholder":753},true,[755],{"type":382,"value":756},"\n",{"type":373,"tag":671,"props":758,"children":760},{"class":673,"line":759},5,[761,767,772,777],{"type":373,"tag":671,"props":762,"children":764},{"style":763},"--shiki-default:#F97583",[765],{"type":382,"value":766},"export",{"type":373,"tag":671,"props":768,"children":769},{"style":690},[770],{"type":382,"value":771}," RELAY_KEY",{"type":373,"tag":671,"props":773,"children":774},{"style":763},[775],{"type":382,"value":776},"=",{"type":373,"tag":671,"props":778,"children":779},{"style":690},[780],{"type":382,"value":781},"YOUR_TOKEN_KEY\n",{"type":373,"tag":671,"props":783,"children":785},{"class":673,"line":784},6,[786,790,795,799],{"type":373,"tag":671,"props":787,"children":788},{"style":763},[789],{"type":382,"value":766},{"type":373,"tag":671,"props":791,"children":792},{"style":690},[793],{"type":382,"value":794}," RELAY_SECRET",{"type":373,"tag":671,"props":796,"children":797},{"style":763},[798],{"type":382,"value":776},{"type":373,"tag":671,"props":800,"children":801},{"style":690},[802],{"type":382,"value":803},"YOUR_TOKEN_SECRET\n",{"type":373,"tag":565,"props":805,"children":807},{"id":806},"_1-the-client-and-the-event-catalog",[808],{"type":382,"value":809},"1. The client and the event catalog",{"type":373,"tag":374,"props":811,"children":812},{},[813,819,821,827,829,835],{"type":373,"tag":385,"props":814,"children":816},{"className":815},[],[817],{"type":382,"value":818},"webhookrelay.New",{"type":382,"value":820}," takes the token key and secret (HTTP Basic auth). ",{"type":373,"tag":385,"props":822,"children":824},{"className":823},[],[825],{"type":382,"value":826},"UpsertOutboundEventType",{"type":382,"value":828}," creates or updates an event type, so ",{"type":373,"tag":385,"props":830,"children":832},{"className":831},[],[833],{"type":382,"value":834},"catalog",{"type":382,"value":836}," is safe to run on every deploy.",{"type":373,"tag":661,"props":838,"children":841},{"className":839,"code":840,"language":713,"meta":345,"style":345},"language-go shiki shiki-themes github-dark","// main.go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"os\"\n    \"time\"\n\n    \"github.com/webhookrelay/webhookrelay-go\"\n)\n\nfunc main() {\n    api, err := webhookrelay.New(os.Getenv(\"RELAY_KEY\"), os.Getenv(\"RELAY_SECRET\"))\n    if err != nil {\n        log.Fatal(err)\n    }\n    if len(os.Args) \u003C 2 {\n        log.Fatal(\"usage: webhooks catalog|onboard|outbox|inspect|failing|recover\")\n    }\n\n    switch args := os.Args[2:]; os.Args[1] {\n    case \"catalog\":\n        err = syncCatalog(api)\n    case \"onboard\":\n        need(args, 3)\n        err = onboard(api, args[0], args[1], args[2])\n    case \"outbox\":\n        err = runOutbox(api, os.Getenv(\"DATABASE_URL\"))\n    case \"inspect\":\n        need(args, 1)\n        err = inspect(api, args[0])\n    case \"failing\":\n        err = failing(api)\n    case \"recover\":\n        need(args, 2)\n        var since time.Time\n        if since, err = time.Parse(time.RFC3339, args[1]); err == nil {\n            err = recoverSince(api, args[0], since)\n        }\n    default:\n        err = fmt.Errorf(\"unknown command %q\", os.Args[1])\n    }\n    if err != nil {\n        log.Fatal(err)\n    }\n}\n\nfunc need(args []string, n int) {\n    if len(args) \u003C n {\n        log.Fatalf(\"expected %d arguments, got %d\", n, len(args))\n    }\n}\n\nfunc syncCatalog(api *webhookrelay.API) error {\n    events := []webhookrelay.OutboundEventTypeOptions{\n        {\n            Name:        \"invoice.paid\",\n            Description: \"An invoice was paid in full\",\n            Example:     map[string]interface{}{\"invoice_id\": \"inv_123\", \"amount\": 4900, \"currency\": \"usd\"},\n        },\n        {\n            Name:        \"invoice.refunded\",\n            Description: \"An invoice was refunded, fully or partially\",\n            Example:     map[string]interface{}{\"invoice_id\": \"inv_123\", \"refund_id\": \"re_9\", \"amount\": 4900},\n        },\n    }\n    for i := range events {\n        if _, err := api.UpsertOutboundEventType(&events[i]); err != nil {\n            return fmt.Errorf(\"event type %s: %w\", events[i].Name, err)\n        }\n    }\n    return nil\n}\n",[842],{"type":373,"tag":385,"props":843,"children":844},{"__ignoreMap":345},[845,854,867,874,887,905,921,938,955,963,979,988,996,1015,1082,1111,1130,1139,1171,1196,1204,1212,1255,1274,1297,1314,1337,1386,1403,1442,1459,1479,1508,1525,1546,1563,1583,1610,1665,1696,1705,1718,1772,1780,1804,1820,1828,1837,1845,1898,1924,1979,1987,1995,2003,2057,2092,2101,2120,2138,2232,2241,2249,2266,2283,2365,2373,2381,2409,2461,2510,2518,2526,2540],{"type":373,"tag":671,"props":846,"children":847},{"class":673,"line":674},[848],{"type":373,"tag":671,"props":849,"children":851},{"style":850},"--shiki-default:#6A737D",[852],{"type":382,"value":853},"// main.go\n",{"type":373,"tag":671,"props":855,"children":856},{"class":673,"line":707},[857,862],{"type":373,"tag":671,"props":858,"children":859},{"style":763},[860],{"type":382,"value":861},"package",{"type":373,"tag":671,"props":863,"children":864},{"style":678},[865],{"type":382,"value":866}," main\n",{"type":373,"tag":671,"props":868,"children":869},{"class":673,"line":731},[870],{"type":373,"tag":671,"props":871,"children":872},{"emptyLinePlaceholder":753},[873],{"type":382,"value":756},{"type":373,"tag":671,"props":875,"children":876},{"class":673,"line":749},[877,882],{"type":373,"tag":671,"props":878,"children":879},{"style":763},[880],{"type":382,"value":881},"import",{"type":373,"tag":671,"props":883,"children":884},{"style":690},[885],{"type":382,"value":886}," (\n",{"type":373,"tag":671,"props":888,"children":889},{"class":673,"line":759},[890,895,900],{"type":373,"tag":671,"props":891,"children":892},{"style":684},[893],{"type":382,"value":894},"    \"",{"type":373,"tag":671,"props":896,"children":897},{"style":678},[898],{"type":382,"value":899},"fmt",{"type":373,"tag":671,"props":901,"children":902},{"style":684},[903],{"type":382,"value":904},"\"\n",{"type":373,"tag":671,"props":906,"children":907},{"class":673,"line":784},[908,912,917],{"type":373,"tag":671,"props":909,"children":910},{"style":684},[911],{"type":382,"value":894},{"type":373,"tag":671,"props":913,"children":914},{"style":678},[915],{"type":382,"value":916},"log",{"type":373,"tag":671,"props":918,"children":919},{"style":684},[920],{"type":382,"value":904},{"type":373,"tag":671,"props":922,"children":924},{"class":673,"line":923},7,[925,929,934],{"type":373,"tag":671,"props":926,"children":927},{"style":684},[928],{"type":382,"value":894},{"type":373,"tag":671,"props":930,"children":931},{"style":678},[932],{"type":382,"value":933},"os",{"type":373,"tag":671,"props":935,"children":936},{"style":684},[937],{"type":382,"value":904},{"type":373,"tag":671,"props":939,"children":941},{"class":673,"line":940},8,[942,946,951],{"type":373,"tag":671,"props":943,"children":944},{"style":684},[945],{"type":382,"value":894},{"type":373,"tag":671,"props":947,"children":948},{"style":678},[949],{"type":382,"value":950},"time",{"type":373,"tag":671,"props":952,"children":953},{"style":684},[954],{"type":382,"value":904},{"type":373,"tag":671,"props":956,"children":958},{"class":673,"line":957},9,[959],{"type":373,"tag":671,"props":960,"children":961},{"emptyLinePlaceholder":753},[962],{"type":382,"value":756},{"type":373,"tag":671,"props":964,"children":966},{"class":673,"line":965},10,[967,971,975],{"type":373,"tag":671,"props":968,"children":969},{"style":684},[970],{"type":382,"value":894},{"type":373,"tag":671,"props":972,"children":973},{"style":678},[974],{"type":382,"value":390},{"type":373,"tag":671,"props":976,"children":977},{"style":684},[978],{"type":382,"value":904},{"type":373,"tag":671,"props":980,"children":982},{"class":673,"line":981},11,[983],{"type":373,"tag":671,"props":984,"children":985},{"style":690},[986],{"type":382,"value":987},")\n",{"type":373,"tag":671,"props":989,"children":991},{"class":673,"line":990},12,[992],{"type":373,"tag":671,"props":993,"children":994},{"emptyLinePlaceholder":753},[995],{"type":382,"value":756},{"type":373,"tag":671,"props":997,"children":999},{"class":673,"line":998},13,[1000,1005,1010],{"type":373,"tag":671,"props":1001,"children":1002},{"style":763},[1003],{"type":382,"value":1004},"func",{"type":373,"tag":671,"props":1006,"children":1007},{"style":678},[1008],{"type":382,"value":1009}," main",{"type":373,"tag":671,"props":1011,"children":1012},{"style":690},[1013],{"type":382,"value":1014},"() {\n",{"type":373,"tag":671,"props":1016,"children":1018},{"class":673,"line":1017},14,[1019,1024,1029,1034,1039,1044,1049,1054,1059,1064,1068,1072,1077],{"type":373,"tag":671,"props":1020,"children":1021},{"style":690},[1022],{"type":382,"value":1023},"    api, err ",{"type":373,"tag":671,"props":1025,"children":1026},{"style":763},[1027],{"type":382,"value":1028},":=",{"type":373,"tag":671,"props":1030,"children":1031},{"style":690},[1032],{"type":382,"value":1033}," webhookrelay.",{"type":373,"tag":671,"props":1035,"children":1036},{"style":678},[1037],{"type":382,"value":1038},"New",{"type":373,"tag":671,"props":1040,"children":1041},{"style":690},[1042],{"type":382,"value":1043},"(os.",{"type":373,"tag":671,"props":1045,"children":1046},{"style":678},[1047],{"type":382,"value":1048},"Getenv",{"type":373,"tag":671,"props":1050,"children":1051},{"style":690},[1052],{"type":382,"value":1053},"(",{"type":373,"tag":671,"props":1055,"children":1056},{"style":684},[1057],{"type":382,"value":1058},"\"RELAY_KEY\"",{"type":373,"tag":671,"props":1060,"children":1061},{"style":690},[1062],{"type":382,"value":1063},"), os.",{"type":373,"tag":671,"props":1065,"children":1066},{"style":678},[1067],{"type":382,"value":1048},{"type":373,"tag":671,"props":1069,"children":1070},{"style":690},[1071],{"type":382,"value":1053},{"type":373,"tag":671,"props":1073,"children":1074},{"style":684},[1075],{"type":382,"value":1076},"\"RELAY_SECRET\"",{"type":373,"tag":671,"props":1078,"children":1079},{"style":690},[1080],{"type":382,"value":1081},"))\n",{"type":373,"tag":671,"props":1083,"children":1085},{"class":673,"line":1084},15,[1086,1091,1096,1101,1106],{"type":373,"tag":671,"props":1087,"children":1088},{"style":763},[1089],{"type":382,"value":1090},"    if",{"type":373,"tag":671,"props":1092,"children":1093},{"style":690},[1094],{"type":382,"value":1095}," err ",{"type":373,"tag":671,"props":1097,"children":1098},{"style":763},[1099],{"type":382,"value":1100},"!=",{"type":373,"tag":671,"props":1102,"children":1103},{"style":696},[1104],{"type":382,"value":1105}," nil",{"type":373,"tag":671,"props":1107,"children":1108},{"style":690},[1109],{"type":382,"value":1110}," {\n",{"type":373,"tag":671,"props":1112,"children":1114},{"class":673,"line":1113},16,[1115,1120,1125],{"type":373,"tag":671,"props":1116,"children":1117},{"style":690},[1118],{"type":382,"value":1119},"        log.",{"type":373,"tag":671,"props":1121,"children":1122},{"style":678},[1123],{"type":382,"value":1124},"Fatal",{"type":373,"tag":671,"props":1126,"children":1127},{"style":690},[1128],{"type":382,"value":1129},"(err)\n",{"type":373,"tag":671,"props":1131,"children":1133},{"class":673,"line":1132},17,[1134],{"type":373,"tag":671,"props":1135,"children":1136},{"style":690},[1137],{"type":382,"value":1138},"    }\n",{"type":373,"tag":671,"props":1140,"children":1142},{"class":673,"line":1141},18,[1143,1147,1152,1157,1162,1167],{"type":373,"tag":671,"props":1144,"children":1145},{"style":763},[1146],{"type":382,"value":1090},{"type":373,"tag":671,"props":1148,"children":1149},{"style":678},[1150],{"type":382,"value":1151}," len",{"type":373,"tag":671,"props":1153,"children":1154},{"style":690},[1155],{"type":382,"value":1156},"(os.Args) ",{"type":373,"tag":671,"props":1158,"children":1159},{"style":763},[1160],{"type":382,"value":1161},"\u003C",{"type":373,"tag":671,"props":1163,"children":1164},{"style":696},[1165],{"type":382,"value":1166}," 2",{"type":373,"tag":671,"props":1168,"children":1169},{"style":690},[1170],{"type":382,"value":1110},{"type":373,"tag":671,"props":1172,"children":1174},{"class":673,"line":1173},19,[1175,1179,1183,1187,1192],{"type":373,"tag":671,"props":1176,"children":1177},{"style":690},[1178],{"type":382,"value":1119},{"type":373,"tag":671,"props":1180,"children":1181},{"style":678},[1182],{"type":382,"value":1124},{"type":373,"tag":671,"props":1184,"children":1185},{"style":690},[1186],{"type":382,"value":1053},{"type":373,"tag":671,"props":1188,"children":1189},{"style":684},[1190],{"type":382,"value":1191},"\"usage: webhooks catalog|onboard|outbox|inspect|failing|recover\"",{"type":373,"tag":671,"props":1193,"children":1194},{"style":690},[1195],{"type":382,"value":987},{"type":373,"tag":671,"props":1197,"children":1199},{"class":673,"line":1198},20,[1200],{"type":373,"tag":671,"props":1201,"children":1202},{"style":690},[1203],{"type":382,"value":1138},{"type":373,"tag":671,"props":1205,"children":1207},{"class":673,"line":1206},21,[1208],{"type":373,"tag":671,"props":1209,"children":1210},{"emptyLinePlaceholder":753},[1211],{"type":382,"value":756},{"type":373,"tag":671,"props":1213,"children":1215},{"class":673,"line":1214},22,[1216,1221,1226,1230,1235,1240,1245,1250],{"type":373,"tag":671,"props":1217,"children":1218},{"style":763},[1219],{"type":382,"value":1220},"    switch",{"type":373,"tag":671,"props":1222,"children":1223},{"style":690},[1224],{"type":382,"value":1225}," args ",{"type":373,"tag":671,"props":1227,"children":1228},{"style":763},[1229],{"type":382,"value":1028},{"type":373,"tag":671,"props":1231,"children":1232},{"style":690},[1233],{"type":382,"value":1234}," os.Args[",{"type":373,"tag":671,"props":1236,"children":1237},{"style":696},[1238],{"type":382,"value":1239},"2",{"type":373,"tag":671,"props":1241,"children":1242},{"style":690},[1243],{"type":382,"value":1244},":]; os.Args[",{"type":373,"tag":671,"props":1246,"children":1247},{"style":696},[1248],{"type":382,"value":1249},"1",{"type":373,"tag":671,"props":1251,"children":1252},{"style":690},[1253],{"type":382,"value":1254},"] {\n",{"type":373,"tag":671,"props":1256,"children":1258},{"class":673,"line":1257},23,[1259,1264,1269],{"type":373,"tag":671,"props":1260,"children":1261},{"style":763},[1262],{"type":382,"value":1263},"    case",{"type":373,"tag":671,"props":1265,"children":1266},{"style":684},[1267],{"type":382,"value":1268}," \"catalog\"",{"type":373,"tag":671,"props":1270,"children":1271},{"style":690},[1272],{"type":382,"value":1273},":\n",{"type":373,"tag":671,"props":1275,"children":1277},{"class":673,"line":1276},24,[1278,1283,1287,1292],{"type":373,"tag":671,"props":1279,"children":1280},{"style":690},[1281],{"type":382,"value":1282},"        err ",{"type":373,"tag":671,"props":1284,"children":1285},{"style":763},[1286],{"type":382,"value":776},{"type":373,"tag":671,"props":1288,"children":1289},{"style":678},[1290],{"type":382,"value":1291}," syncCatalog",{"type":373,"tag":671,"props":1293,"children":1294},{"style":690},[1295],{"type":382,"value":1296},"(api)\n",{"type":373,"tag":671,"props":1298,"children":1300},{"class":673,"line":1299},25,[1301,1305,1310],{"type":373,"tag":671,"props":1302,"children":1303},{"style":763},[1304],{"type":382,"value":1263},{"type":373,"tag":671,"props":1306,"children":1307},{"style":684},[1308],{"type":382,"value":1309}," \"onboard\"",{"type":373,"tag":671,"props":1311,"children":1312},{"style":690},[1313],{"type":382,"value":1273},{"type":373,"tag":671,"props":1315,"children":1317},{"class":673,"line":1316},26,[1318,1323,1328,1333],{"type":373,"tag":671,"props":1319,"children":1320},{"style":678},[1321],{"type":382,"value":1322},"        need",{"type":373,"tag":671,"props":1324,"children":1325},{"style":690},[1326],{"type":382,"value":1327},"(args, ",{"type":373,"tag":671,"props":1329,"children":1330},{"style":696},[1331],{"type":382,"value":1332},"3",{"type":373,"tag":671,"props":1334,"children":1335},{"style":690},[1336],{"type":382,"value":987},{"type":373,"tag":671,"props":1338,"children":1340},{"class":673,"line":1339},27,[1341,1345,1349,1354,1359,1364,1369,1373,1377,1381],{"type":373,"tag":671,"props":1342,"children":1343},{"style":690},[1344],{"type":382,"value":1282},{"type":373,"tag":671,"props":1346,"children":1347},{"style":763},[1348],{"type":382,"value":776},{"type":373,"tag":671,"props":1350,"children":1351},{"style":678},[1352],{"type":382,"value":1353}," onboard",{"type":373,"tag":671,"props":1355,"children":1356},{"style":690},[1357],{"type":382,"value":1358},"(api, args[",{"type":373,"tag":671,"props":1360,"children":1361},{"style":696},[1362],{"type":382,"value":1363},"0",{"type":373,"tag":671,"props":1365,"children":1366},{"style":690},[1367],{"type":382,"value":1368},"], args[",{"type":373,"tag":671,"props":1370,"children":1371},{"style":696},[1372],{"type":382,"value":1249},{"type":373,"tag":671,"props":1374,"children":1375},{"style":690},[1376],{"type":382,"value":1368},{"type":373,"tag":671,"props":1378,"children":1379},{"style":696},[1380],{"type":382,"value":1239},{"type":373,"tag":671,"props":1382,"children":1383},{"style":690},[1384],{"type":382,"value":1385},"])\n",{"type":373,"tag":671,"props":1387,"children":1389},{"class":673,"line":1388},28,[1390,1394,1399],{"type":373,"tag":671,"props":1391,"children":1392},{"style":763},[1393],{"type":382,"value":1263},{"type":373,"tag":671,"props":1395,"children":1396},{"style":684},[1397],{"type":382,"value":1398}," \"outbox\"",{"type":373,"tag":671,"props":1400,"children":1401},{"style":690},[1402],{"type":382,"value":1273},{"type":373,"tag":671,"props":1404,"children":1406},{"class":673,"line":1405},29,[1407,1411,1415,1420,1425,1429,1433,1438],{"type":373,"tag":671,"props":1408,"children":1409},{"style":690},[1410],{"type":382,"value":1282},{"type":373,"tag":671,"props":1412,"children":1413},{"style":763},[1414],{"type":382,"value":776},{"type":373,"tag":671,"props":1416,"children":1417},{"style":678},[1418],{"type":382,"value":1419}," runOutbox",{"type":373,"tag":671,"props":1421,"children":1422},{"style":690},[1423],{"type":382,"value":1424},"(api, os.",{"type":373,"tag":671,"props":1426,"children":1427},{"style":678},[1428],{"type":382,"value":1048},{"type":373,"tag":671,"props":1430,"children":1431},{"style":690},[1432],{"type":382,"value":1053},{"type":373,"tag":671,"props":1434,"children":1435},{"style":684},[1436],{"type":382,"value":1437},"\"DATABASE_URL\"",{"type":373,"tag":671,"props":1439,"children":1440},{"style":690},[1441],{"type":382,"value":1081},{"type":373,"tag":671,"props":1443,"children":1445},{"class":673,"line":1444},30,[1446,1450,1455],{"type":373,"tag":671,"props":1447,"children":1448},{"style":763},[1449],{"type":382,"value":1263},{"type":373,"tag":671,"props":1451,"children":1452},{"style":684},[1453],{"type":382,"value":1454}," \"inspect\"",{"type":373,"tag":671,"props":1456,"children":1457},{"style":690},[1458],{"type":382,"value":1273},{"type":373,"tag":671,"props":1460,"children":1462},{"class":673,"line":1461},31,[1463,1467,1471,1475],{"type":373,"tag":671,"props":1464,"children":1465},{"style":678},[1466],{"type":382,"value":1322},{"type":373,"tag":671,"props":1468,"children":1469},{"style":690},[1470],{"type":382,"value":1327},{"type":373,"tag":671,"props":1472,"children":1473},{"style":696},[1474],{"type":382,"value":1249},{"type":373,"tag":671,"props":1476,"children":1477},{"style":690},[1478],{"type":382,"value":987},{"type":373,"tag":671,"props":1480,"children":1482},{"class":673,"line":1481},32,[1483,1487,1491,1496,1500,1504],{"type":373,"tag":671,"props":1484,"children":1485},{"style":690},[1486],{"type":382,"value":1282},{"type":373,"tag":671,"props":1488,"children":1489},{"style":763},[1490],{"type":382,"value":776},{"type":373,"tag":671,"props":1492,"children":1493},{"style":678},[1494],{"type":382,"value":1495}," inspect",{"type":373,"tag":671,"props":1497,"children":1498},{"style":690},[1499],{"type":382,"value":1358},{"type":373,"tag":671,"props":1501,"children":1502},{"style":696},[1503],{"type":382,"value":1363},{"type":373,"tag":671,"props":1505,"children":1506},{"style":690},[1507],{"type":382,"value":1385},{"type":373,"tag":671,"props":1509,"children":1511},{"class":673,"line":1510},33,[1512,1516,1521],{"type":373,"tag":671,"props":1513,"children":1514},{"style":763},[1515],{"type":382,"value":1263},{"type":373,"tag":671,"props":1517,"children":1518},{"style":684},[1519],{"type":382,"value":1520}," \"failing\"",{"type":373,"tag":671,"props":1522,"children":1523},{"style":690},[1524],{"type":382,"value":1273},{"type":373,"tag":671,"props":1526,"children":1528},{"class":673,"line":1527},34,[1529,1533,1537,1542],{"type":373,"tag":671,"props":1530,"children":1531},{"style":690},[1532],{"type":382,"value":1282},{"type":373,"tag":671,"props":1534,"children":1535},{"style":763},[1536],{"type":382,"value":776},{"type":373,"tag":671,"props":1538,"children":1539},{"style":678},[1540],{"type":382,"value":1541}," failing",{"type":373,"tag":671,"props":1543,"children":1544},{"style":690},[1545],{"type":382,"value":1296},{"type":373,"tag":671,"props":1547,"children":1549},{"class":673,"line":1548},35,[1550,1554,1559],{"type":373,"tag":671,"props":1551,"children":1552},{"style":763},[1553],{"type":382,"value":1263},{"type":373,"tag":671,"props":1555,"children":1556},{"style":684},[1557],{"type":382,"value":1558}," \"recover\"",{"type":373,"tag":671,"props":1560,"children":1561},{"style":690},[1562],{"type":382,"value":1273},{"type":373,"tag":671,"props":1564,"children":1566},{"class":673,"line":1565},36,[1567,1571,1575,1579],{"type":373,"tag":671,"props":1568,"children":1569},{"style":678},[1570],{"type":382,"value":1322},{"type":373,"tag":671,"props":1572,"children":1573},{"style":690},[1574],{"type":382,"value":1327},{"type":373,"tag":671,"props":1576,"children":1577},{"style":696},[1578],{"type":382,"value":1239},{"type":373,"tag":671,"props":1580,"children":1581},{"style":690},[1582],{"type":382,"value":987},{"type":373,"tag":671,"props":1584,"children":1586},{"class":673,"line":1585},37,[1587,1592,1597,1601,1605],{"type":373,"tag":671,"props":1588,"children":1589},{"style":763},[1590],{"type":382,"value":1591},"        var",{"type":373,"tag":671,"props":1593,"children":1594},{"style":690},[1595],{"type":382,"value":1596}," since ",{"type":373,"tag":671,"props":1598,"children":1599},{"style":678},[1600],{"type":382,"value":950},{"type":373,"tag":671,"props":1602,"children":1603},{"style":690},[1604],{"type":382,"value":634},{"type":373,"tag":671,"props":1606,"children":1607},{"style":678},[1608],{"type":382,"value":1609},"Time\n",{"type":373,"tag":671,"props":1611,"children":1613},{"class":673,"line":1612},38,[1614,1619,1624,1628,1633,1638,1643,1647,1652,1657,1661],{"type":373,"tag":671,"props":1615,"children":1616},{"style":763},[1617],{"type":382,"value":1618},"        if",{"type":373,"tag":671,"props":1620,"children":1621},{"style":690},[1622],{"type":382,"value":1623}," since, err ",{"type":373,"tag":671,"props":1625,"children":1626},{"style":763},[1627],{"type":382,"value":776},{"type":373,"tag":671,"props":1629,"children":1630},{"style":690},[1631],{"type":382,"value":1632}," time.",{"type":373,"tag":671,"props":1634,"children":1635},{"style":678},[1636],{"type":382,"value":1637},"Parse",{"type":373,"tag":671,"props":1639,"children":1640},{"style":690},[1641],{"type":382,"value":1642},"(time.RFC3339, args[",{"type":373,"tag":671,"props":1644,"children":1645},{"style":696},[1646],{"type":382,"value":1249},{"type":373,"tag":671,"props":1648,"children":1649},{"style":690},[1650],{"type":382,"value":1651},"]); err ",{"type":373,"tag":671,"props":1653,"children":1654},{"style":763},[1655],{"type":382,"value":1656},"==",{"type":373,"tag":671,"props":1658,"children":1659},{"style":696},[1660],{"type":382,"value":1105},{"type":373,"tag":671,"props":1662,"children":1663},{"style":690},[1664],{"type":382,"value":1110},{"type":373,"tag":671,"props":1666,"children":1668},{"class":673,"line":1667},39,[1669,1674,1678,1683,1687,1691],{"type":373,"tag":671,"props":1670,"children":1671},{"style":690},[1672],{"type":382,"value":1673},"            err ",{"type":373,"tag":671,"props":1675,"children":1676},{"style":763},[1677],{"type":382,"value":776},{"type":373,"tag":671,"props":1679,"children":1680},{"style":678},[1681],{"type":382,"value":1682}," recoverSince",{"type":373,"tag":671,"props":1684,"children":1685},{"style":690},[1686],{"type":382,"value":1358},{"type":373,"tag":671,"props":1688,"children":1689},{"style":696},[1690],{"type":382,"value":1363},{"type":373,"tag":671,"props":1692,"children":1693},{"style":690},[1694],{"type":382,"value":1695},"], since)\n",{"type":373,"tag":671,"props":1697,"children":1699},{"class":673,"line":1698},40,[1700],{"type":373,"tag":671,"props":1701,"children":1702},{"style":690},[1703],{"type":382,"value":1704},"        }\n",{"type":373,"tag":671,"props":1706,"children":1708},{"class":673,"line":1707},41,[1709,1714],{"type":373,"tag":671,"props":1710,"children":1711},{"style":763},[1712],{"type":382,"value":1713},"    default",{"type":373,"tag":671,"props":1715,"children":1716},{"style":690},[1717],{"type":382,"value":1273},{"type":373,"tag":671,"props":1719,"children":1721},{"class":673,"line":1720},42,[1722,1726,1730,1735,1740,1744,1749,1754,1759,1764,1768],{"type":373,"tag":671,"props":1723,"children":1724},{"style":690},[1725],{"type":382,"value":1282},{"type":373,"tag":671,"props":1727,"children":1728},{"style":763},[1729],{"type":382,"value":776},{"type":373,"tag":671,"props":1731,"children":1732},{"style":690},[1733],{"type":382,"value":1734}," fmt.",{"type":373,"tag":671,"props":1736,"children":1737},{"style":678},[1738],{"type":382,"value":1739},"Errorf",{"type":373,"tag":671,"props":1741,"children":1742},{"style":690},[1743],{"type":382,"value":1053},{"type":373,"tag":671,"props":1745,"children":1746},{"style":684},[1747],{"type":382,"value":1748},"\"unknown command ",{"type":373,"tag":671,"props":1750,"children":1751},{"style":696},[1752],{"type":382,"value":1753},"%q",{"type":373,"tag":671,"props":1755,"children":1756},{"style":684},[1757],{"type":382,"value":1758},"\"",{"type":373,"tag":671,"props":1760,"children":1761},{"style":690},[1762],{"type":382,"value":1763},", os.Args[",{"type":373,"tag":671,"props":1765,"children":1766},{"style":696},[1767],{"type":382,"value":1249},{"type":373,"tag":671,"props":1769,"children":1770},{"style":690},[1771],{"type":382,"value":1385},{"type":373,"tag":671,"props":1773,"children":1775},{"class":673,"line":1774},43,[1776],{"type":373,"tag":671,"props":1777,"children":1778},{"style":690},[1779],{"type":382,"value":1138},{"type":373,"tag":671,"props":1781,"children":1783},{"class":673,"line":1782},44,[1784,1788,1792,1796,1800],{"type":373,"tag":671,"props":1785,"children":1786},{"style":763},[1787],{"type":382,"value":1090},{"type":373,"tag":671,"props":1789,"children":1790},{"style":690},[1791],{"type":382,"value":1095},{"type":373,"tag":671,"props":1793,"children":1794},{"style":763},[1795],{"type":382,"value":1100},{"type":373,"tag":671,"props":1797,"children":1798},{"style":696},[1799],{"type":382,"value":1105},{"type":373,"tag":671,"props":1801,"children":1802},{"style":690},[1803],{"type":382,"value":1110},{"type":373,"tag":671,"props":1805,"children":1807},{"class":673,"line":1806},45,[1808,1812,1816],{"type":373,"tag":671,"props":1809,"children":1810},{"style":690},[1811],{"type":382,"value":1119},{"type":373,"tag":671,"props":1813,"children":1814},{"style":678},[1815],{"type":382,"value":1124},{"type":373,"tag":671,"props":1817,"children":1818},{"style":690},[1819],{"type":382,"value":1129},{"type":373,"tag":671,"props":1821,"children":1823},{"class":673,"line":1822},46,[1824],{"type":373,"tag":671,"props":1825,"children":1826},{"style":690},[1827],{"type":382,"value":1138},{"type":373,"tag":671,"props":1829,"children":1831},{"class":673,"line":1830},47,[1832],{"type":373,"tag":671,"props":1833,"children":1834},{"style":690},[1835],{"type":382,"value":1836},"}\n",{"type":373,"tag":671,"props":1838,"children":1840},{"class":673,"line":1839},48,[1841],{"type":373,"tag":671,"props":1842,"children":1843},{"emptyLinePlaceholder":753},[1844],{"type":382,"value":756},{"type":373,"tag":671,"props":1846,"children":1848},{"class":673,"line":1847},49,[1849,1853,1858,1862,1868,1873,1878,1883,1888,1893],{"type":373,"tag":671,"props":1850,"children":1851},{"style":763},[1852],{"type":382,"value":1004},{"type":373,"tag":671,"props":1854,"children":1855},{"style":678},[1856],{"type":382,"value":1857}," need",{"type":373,"tag":671,"props":1859,"children":1860},{"style":690},[1861],{"type":382,"value":1053},{"type":373,"tag":671,"props":1863,"children":1865},{"style":1864},"--shiki-default:#FFAB70",[1866],{"type":382,"value":1867},"args",{"type":373,"tag":671,"props":1869,"children":1870},{"style":690},[1871],{"type":382,"value":1872}," []",{"type":373,"tag":671,"props":1874,"children":1875},{"style":763},[1876],{"type":382,"value":1877},"string",{"type":373,"tag":671,"props":1879,"children":1880},{"style":690},[1881],{"type":382,"value":1882},", ",{"type":373,"tag":671,"props":1884,"children":1885},{"style":1864},[1886],{"type":382,"value":1887},"n",{"type":373,"tag":671,"props":1889,"children":1890},{"style":763},[1891],{"type":382,"value":1892}," int",{"type":373,"tag":671,"props":1894,"children":1895},{"style":690},[1896],{"type":382,"value":1897},") {\n",{"type":373,"tag":671,"props":1899,"children":1901},{"class":673,"line":1900},50,[1902,1906,1910,1915,1919],{"type":373,"tag":671,"props":1903,"children":1904},{"style":763},[1905],{"type":382,"value":1090},{"type":373,"tag":671,"props":1907,"children":1908},{"style":678},[1909],{"type":382,"value":1151},{"type":373,"tag":671,"props":1911,"children":1912},{"style":690},[1913],{"type":382,"value":1914},"(args) ",{"type":373,"tag":671,"props":1916,"children":1917},{"style":763},[1918],{"type":382,"value":1161},{"type":373,"tag":671,"props":1920,"children":1921},{"style":690},[1922],{"type":382,"value":1923}," n {\n",{"type":373,"tag":671,"props":1925,"children":1927},{"class":673,"line":1926},51,[1928,1932,1937,1941,1946,1951,1956,1960,1964,1969,1974],{"type":373,"tag":671,"props":1929,"children":1930},{"style":690},[1931],{"type":382,"value":1119},{"type":373,"tag":671,"props":1933,"children":1934},{"style":678},[1935],{"type":382,"value":1936},"Fatalf",{"type":373,"tag":671,"props":1938,"children":1939},{"style":690},[1940],{"type":382,"value":1053},{"type":373,"tag":671,"props":1942,"children":1943},{"style":684},[1944],{"type":382,"value":1945},"\"expected ",{"type":373,"tag":671,"props":1947,"children":1948},{"style":696},[1949],{"type":382,"value":1950},"%d",{"type":373,"tag":671,"props":1952,"children":1953},{"style":684},[1954],{"type":382,"value":1955}," arguments, got ",{"type":373,"tag":671,"props":1957,"children":1958},{"style":696},[1959],{"type":382,"value":1950},{"type":373,"tag":671,"props":1961,"children":1962},{"style":684},[1963],{"type":382,"value":1758},{"type":373,"tag":671,"props":1965,"children":1966},{"style":690},[1967],{"type":382,"value":1968},", n, ",{"type":373,"tag":671,"props":1970,"children":1971},{"style":678},[1972],{"type":382,"value":1973},"len",{"type":373,"tag":671,"props":1975,"children":1976},{"style":690},[1977],{"type":382,"value":1978},"(args))\n",{"type":373,"tag":671,"props":1980,"children":1982},{"class":673,"line":1981},52,[1983],{"type":373,"tag":671,"props":1984,"children":1985},{"style":690},[1986],{"type":382,"value":1138},{"type":373,"tag":671,"props":1988,"children":1990},{"class":673,"line":1989},53,[1991],{"type":373,"tag":671,"props":1992,"children":1993},{"style":690},[1994],{"type":382,"value":1836},{"type":373,"tag":671,"props":1996,"children":1998},{"class":673,"line":1997},54,[1999],{"type":373,"tag":671,"props":2000,"children":2001},{"emptyLinePlaceholder":753},[2002],{"type":382,"value":756},{"type":373,"tag":671,"props":2004,"children":2006},{"class":673,"line":2005},55,[2007,2011,2015,2019,2024,2029,2034,2038,2043,2048,2053],{"type":373,"tag":671,"props":2008,"children":2009},{"style":763},[2010],{"type":382,"value":1004},{"type":373,"tag":671,"props":2012,"children":2013},{"style":678},[2014],{"type":382,"value":1291},{"type":373,"tag":671,"props":2016,"children":2017},{"style":690},[2018],{"type":382,"value":1053},{"type":373,"tag":671,"props":2020,"children":2021},{"style":1864},[2022],{"type":382,"value":2023},"api",{"type":373,"tag":671,"props":2025,"children":2026},{"style":763},[2027],{"type":382,"value":2028}," *",{"type":373,"tag":671,"props":2030,"children":2031},{"style":678},[2032],{"type":382,"value":2033},"webhookrelay",{"type":373,"tag":671,"props":2035,"children":2036},{"style":690},[2037],{"type":382,"value":634},{"type":373,"tag":671,"props":2039,"children":2040},{"style":678},[2041],{"type":382,"value":2042},"API",{"type":373,"tag":671,"props":2044,"children":2045},{"style":690},[2046],{"type":382,"value":2047},") ",{"type":373,"tag":671,"props":2049,"children":2050},{"style":763},[2051],{"type":382,"value":2052},"error",{"type":373,"tag":671,"props":2054,"children":2055},{"style":690},[2056],{"type":382,"value":1110},{"type":373,"tag":671,"props":2058,"children":2060},{"class":673,"line":2059},56,[2061,2066,2070,2074,2078,2082,2087],{"type":373,"tag":671,"props":2062,"children":2063},{"style":690},[2064],{"type":382,"value":2065},"    events ",{"type":373,"tag":671,"props":2067,"children":2068},{"style":763},[2069],{"type":382,"value":1028},{"type":373,"tag":671,"props":2071,"children":2072},{"style":690},[2073],{"type":382,"value":1872},{"type":373,"tag":671,"props":2075,"children":2076},{"style":678},[2077],{"type":382,"value":2033},{"type":373,"tag":671,"props":2079,"children":2080},{"style":690},[2081],{"type":382,"value":634},{"type":373,"tag":671,"props":2083,"children":2084},{"style":678},[2085],{"type":382,"value":2086},"OutboundEventTypeOptions",{"type":373,"tag":671,"props":2088,"children":2089},{"style":690},[2090],{"type":382,"value":2091},"{\n",{"type":373,"tag":671,"props":2093,"children":2095},{"class":673,"line":2094},57,[2096],{"type":373,"tag":671,"props":2097,"children":2098},{"style":690},[2099],{"type":382,"value":2100},"        {\n",{"type":373,"tag":671,"props":2102,"children":2104},{"class":673,"line":2103},58,[2105,2110,2115],{"type":373,"tag":671,"props":2106,"children":2107},{"style":690},[2108],{"type":382,"value":2109},"            Name:        ",{"type":373,"tag":671,"props":2111,"children":2112},{"style":684},[2113],{"type":382,"value":2114},"\"invoice.paid\"",{"type":373,"tag":671,"props":2116,"children":2117},{"style":690},[2118],{"type":382,"value":2119},",\n",{"type":373,"tag":671,"props":2121,"children":2123},{"class":673,"line":2122},59,[2124,2129,2134],{"type":373,"tag":671,"props":2125,"children":2126},{"style":690},[2127],{"type":382,"value":2128},"            Description: ",{"type":373,"tag":671,"props":2130,"children":2131},{"style":684},[2132],{"type":382,"value":2133},"\"An invoice was paid in full\"",{"type":373,"tag":671,"props":2135,"children":2136},{"style":690},[2137],{"type":382,"value":2119},{"type":373,"tag":671,"props":2139,"children":2141},{"class":673,"line":2140},60,[2142,2147,2152,2157,2161,2166,2171,2176,2181,2186,2191,2195,2200,2204,2209,2213,2218,2222,2227],{"type":373,"tag":671,"props":2143,"children":2144},{"style":690},[2145],{"type":382,"value":2146},"            Example:     ",{"type":373,"tag":671,"props":2148,"children":2149},{"style":763},[2150],{"type":382,"value":2151},"map",{"type":373,"tag":671,"props":2153,"children":2154},{"style":690},[2155],{"type":382,"value":2156},"[",{"type":373,"tag":671,"props":2158,"children":2159},{"style":763},[2160],{"type":382,"value":1877},{"type":373,"tag":671,"props":2162,"children":2163},{"style":690},[2164],{"type":382,"value":2165},"]",{"type":373,"tag":671,"props":2167,"children":2168},{"style":763},[2169],{"type":382,"value":2170},"interface",{"type":373,"tag":671,"props":2172,"children":2173},{"style":690},[2174],{"type":382,"value":2175},"{}{",{"type":373,"tag":671,"props":2177,"children":2178},{"style":684},[2179],{"type":382,"value":2180},"\"invoice_id\"",{"type":373,"tag":671,"props":2182,"children":2183},{"style":690},[2184],{"type":382,"value":2185},": ",{"type":373,"tag":671,"props":2187,"children":2188},{"style":684},[2189],{"type":382,"value":2190},"\"inv_123\"",{"type":373,"tag":671,"props":2192,"children":2193},{"style":690},[2194],{"type":382,"value":1882},{"type":373,"tag":671,"props":2196,"children":2197},{"style":684},[2198],{"type":382,"value":2199},"\"amount\"",{"type":373,"tag":671,"props":2201,"children":2202},{"style":690},[2203],{"type":382,"value":2185},{"type":373,"tag":671,"props":2205,"children":2206},{"style":696},[2207],{"type":382,"value":2208},"4900",{"type":373,"tag":671,"props":2210,"children":2211},{"style":690},[2212],{"type":382,"value":1882},{"type":373,"tag":671,"props":2214,"children":2215},{"style":684},[2216],{"type":382,"value":2217},"\"currency\"",{"type":373,"tag":671,"props":2219,"children":2220},{"style":690},[2221],{"type":382,"value":2185},{"type":373,"tag":671,"props":2223,"children":2224},{"style":684},[2225],{"type":382,"value":2226},"\"usd\"",{"type":373,"tag":671,"props":2228,"children":2229},{"style":690},[2230],{"type":382,"value":2231},"},\n",{"type":373,"tag":671,"props":2233,"children":2235},{"class":673,"line":2234},61,[2236],{"type":373,"tag":671,"props":2237,"children":2238},{"style":690},[2239],{"type":382,"value":2240},"        },\n",{"type":373,"tag":671,"props":2242,"children":2244},{"class":673,"line":2243},62,[2245],{"type":373,"tag":671,"props":2246,"children":2247},{"style":690},[2248],{"type":382,"value":2100},{"type":373,"tag":671,"props":2250,"children":2252},{"class":673,"line":2251},63,[2253,2257,2262],{"type":373,"tag":671,"props":2254,"children":2255},{"style":690},[2256],{"type":382,"value":2109},{"type":373,"tag":671,"props":2258,"children":2259},{"style":684},[2260],{"type":382,"value":2261},"\"invoice.refunded\"",{"type":373,"tag":671,"props":2263,"children":2264},{"style":690},[2265],{"type":382,"value":2119},{"type":373,"tag":671,"props":2267,"children":2269},{"class":673,"line":2268},64,[2270,2274,2279],{"type":373,"tag":671,"props":2271,"children":2272},{"style":690},[2273],{"type":382,"value":2128},{"type":373,"tag":671,"props":2275,"children":2276},{"style":684},[2277],{"type":382,"value":2278},"\"An invoice was refunded, fully or partially\"",{"type":373,"tag":671,"props":2280,"children":2281},{"style":690},[2282],{"type":382,"value":2119},{"type":373,"tag":671,"props":2284,"children":2286},{"class":673,"line":2285},65,[2287,2291,2295,2299,2303,2307,2311,2315,2319,2323,2327,2331,2336,2340,2345,2349,2353,2357,2361],{"type":373,"tag":671,"props":2288,"children":2289},{"style":690},[2290],{"type":382,"value":2146},{"type":373,"tag":671,"props":2292,"children":2293},{"style":763},[2294],{"type":382,"value":2151},{"type":373,"tag":671,"props":2296,"children":2297},{"style":690},[2298],{"type":382,"value":2156},{"type":373,"tag":671,"props":2300,"children":2301},{"style":763},[2302],{"type":382,"value":1877},{"type":373,"tag":671,"props":2304,"children":2305},{"style":690},[2306],{"type":382,"value":2165},{"type":373,"tag":671,"props":2308,"children":2309},{"style":763},[2310],{"type":382,"value":2170},{"type":373,"tag":671,"props":2312,"children":2313},{"style":690},[2314],{"type":382,"value":2175},{"type":373,"tag":671,"props":2316,"children":2317},{"style":684},[2318],{"type":382,"value":2180},{"type":373,"tag":671,"props":2320,"children":2321},{"style":690},[2322],{"type":382,"value":2185},{"type":373,"tag":671,"props":2324,"children":2325},{"style":684},[2326],{"type":382,"value":2190},{"type":373,"tag":671,"props":2328,"children":2329},{"style":690},[2330],{"type":382,"value":1882},{"type":373,"tag":671,"props":2332,"children":2333},{"style":684},[2334],{"type":382,"value":2335},"\"refund_id\"",{"type":373,"tag":671,"props":2337,"children":2338},{"style":690},[2339],{"type":382,"value":2185},{"type":373,"tag":671,"props":2341,"children":2342},{"style":684},[2343],{"type":382,"value":2344},"\"re_9\"",{"type":373,"tag":671,"props":2346,"children":2347},{"style":690},[2348],{"type":382,"value":1882},{"type":373,"tag":671,"props":2350,"children":2351},{"style":684},[2352],{"type":382,"value":2199},{"type":373,"tag":671,"props":2354,"children":2355},{"style":690},[2356],{"type":382,"value":2185},{"type":373,"tag":671,"props":2358,"children":2359},{"style":696},[2360],{"type":382,"value":2208},{"type":373,"tag":671,"props":2362,"children":2363},{"style":690},[2364],{"type":382,"value":2231},{"type":373,"tag":671,"props":2366,"children":2368},{"class":673,"line":2367},66,[2369],{"type":373,"tag":671,"props":2370,"children":2371},{"style":690},[2372],{"type":382,"value":2240},{"type":373,"tag":671,"props":2374,"children":2376},{"class":673,"line":2375},67,[2377],{"type":373,"tag":671,"props":2378,"children":2379},{"style":690},[2380],{"type":382,"value":1138},{"type":373,"tag":671,"props":2382,"children":2384},{"class":673,"line":2383},68,[2385,2390,2395,2399,2404],{"type":373,"tag":671,"props":2386,"children":2387},{"style":763},[2388],{"type":382,"value":2389},"    for",{"type":373,"tag":671,"props":2391,"children":2392},{"style":690},[2393],{"type":382,"value":2394}," i ",{"type":373,"tag":671,"props":2396,"children":2397},{"style":763},[2398],{"type":382,"value":1028},{"type":373,"tag":671,"props":2400,"children":2401},{"style":763},[2402],{"type":382,"value":2403}," range",{"type":373,"tag":671,"props":2405,"children":2406},{"style":690},[2407],{"type":382,"value":2408}," events {\n",{"type":373,"tag":671,"props":2410,"children":2412},{"class":673,"line":2411},69,[2413,2417,2422,2426,2431,2435,2439,2444,2449,2453,2457],{"type":373,"tag":671,"props":2414,"children":2415},{"style":763},[2416],{"type":382,"value":1618},{"type":373,"tag":671,"props":2418,"children":2419},{"style":690},[2420],{"type":382,"value":2421}," _, err ",{"type":373,"tag":671,"props":2423,"children":2424},{"style":763},[2425],{"type":382,"value":1028},{"type":373,"tag":671,"props":2427,"children":2428},{"style":690},[2429],{"type":382,"value":2430}," api.",{"type":373,"tag":671,"props":2432,"children":2433},{"style":678},[2434],{"type":382,"value":826},{"type":373,"tag":671,"props":2436,"children":2437},{"style":690},[2438],{"type":382,"value":1053},{"type":373,"tag":671,"props":2440,"children":2441},{"style":763},[2442],{"type":382,"value":2443},"&",{"type":373,"tag":671,"props":2445,"children":2446},{"style":690},[2447],{"type":382,"value":2448},"events[i]); err ",{"type":373,"tag":671,"props":2450,"children":2451},{"style":763},[2452],{"type":382,"value":1100},{"type":373,"tag":671,"props":2454,"children":2455},{"style":696},[2456],{"type":382,"value":1105},{"type":373,"tag":671,"props":2458,"children":2459},{"style":690},[2460],{"type":382,"value":1110},{"type":373,"tag":671,"props":2462,"children":2464},{"class":673,"line":2463},70,[2465,2470,2474,2478,2482,2487,2492,2496,2501,2505],{"type":373,"tag":671,"props":2466,"children":2467},{"style":763},[2468],{"type":382,"value":2469},"            return",{"type":373,"tag":671,"props":2471,"children":2472},{"style":690},[2473],{"type":382,"value":1734},{"type":373,"tag":671,"props":2475,"children":2476},{"style":678},[2477],{"type":382,"value":1739},{"type":373,"tag":671,"props":2479,"children":2480},{"style":690},[2481],{"type":382,"value":1053},{"type":373,"tag":671,"props":2483,"children":2484},{"style":684},[2485],{"type":382,"value":2486},"\"event type ",{"type":373,"tag":671,"props":2488,"children":2489},{"style":696},[2490],{"type":382,"value":2491},"%s",{"type":373,"tag":671,"props":2493,"children":2494},{"style":684},[2495],{"type":382,"value":2185},{"type":373,"tag":671,"props":2497,"children":2498},{"style":696},[2499],{"type":382,"value":2500},"%w",{"type":373,"tag":671,"props":2502,"children":2503},{"style":684},[2504],{"type":382,"value":1758},{"type":373,"tag":671,"props":2506,"children":2507},{"style":690},[2508],{"type":382,"value":2509},", events[i].Name, err)\n",{"type":373,"tag":671,"props":2511,"children":2513},{"class":673,"line":2512},71,[2514],{"type":373,"tag":671,"props":2515,"children":2516},{"style":690},[2517],{"type":382,"value":1704},{"type":373,"tag":671,"props":2519,"children":2521},{"class":673,"line":2520},72,[2522],{"type":373,"tag":671,"props":2523,"children":2524},{"style":690},[2525],{"type":382,"value":1138},{"type":373,"tag":671,"props":2527,"children":2529},{"class":673,"line":2528},73,[2530,2535],{"type":373,"tag":671,"props":2531,"children":2532},{"style":763},[2533],{"type":382,"value":2534},"    return",{"type":373,"tag":671,"props":2536,"children":2537},{"style":696},[2538],{"type":382,"value":2539}," nil\n",{"type":373,"tag":671,"props":2541,"children":2543},{"class":673,"line":2542},74,[2544],{"type":373,"tag":671,"props":2545,"children":2546},{"style":690},[2547],{"type":382,"value":1836},{"type":373,"tag":565,"props":2549,"children":2551},{"id":2550},"_2-onboard-a-customer",[2552],{"type":382,"value":2553},"2. Onboard a customer",{"type":373,"tag":374,"props":2555,"children":2556},{},[2557,2559,2565,2567,2573,2575,2581],{"type":382,"value":2558},"Use your own customer ID as the consumer ID. ",{"type":373,"tag":385,"props":2560,"children":2562},{"className":2561},[],[2563],{"type":382,"value":2564},"CreateOutboundEndpoint",{"type":382,"value":2566}," returns the endpoint with its ",{"type":373,"tag":385,"props":2568,"children":2570},{"className":2569},[],[2571],{"type":382,"value":2572},"whsec_",{"type":382,"value":2574}," signing secret, which you show to the customer once. ",{"type":373,"tag":385,"props":2576,"children":2578},{"className":2577},[],[2579],{"type":382,"value":2580},"RevealOutboundEndpointSecret",{"type":382,"value":2582}," returns it again later.",{"type":373,"tag":661,"props":2584,"children":2586},{"className":839,"code":2585,"language":713,"meta":345,"style":345},"// onboard.go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/webhookrelay/webhookrelay-go\"\n)\n\nfunc onboard(api *webhookrelay.API, customerID, name, url string) error {\n    if _, err := api.UpsertOutboundConsumer(&webhookrelay.OutboundConsumerOptions{ID: customerID, Name: name}); err != nil {\n        return err\n    }\n    endpoint, err := api.CreateOutboundEndpoint(&webhookrelay.OutboundEndpointOptions{\n        Consumer:    customerID,\n        URL:         url,\n        EventTypes:  []string{\"invoice.paid\", \"invoice.refunded\"}, // or []string{\"*\"}\n        Description: \"Production webhook receiver\",\n        Timeout:     15,   // seconds per attempt, up to 60\n        AutoDisable: true, // disable after 100 failures in a row spanning 12+ hours\n    })\n    if err != nil {\n        return err\n    }\n    fmt.Printf(\"endpoint %s (%s)\\nsigning secret for the customer: %s\\n\", endpoint.ID, endpoint.State, endpoint.Secret)\n    return nil\n}\n",[2587],{"type":373,"tag":385,"props":2588,"children":2589},{"__ignoreMap":345},[2590,2598,2609,2616,2627,2642,2649,2664,2671,2678,2757,2819,2832,2839,2884,2892,2900,2939,2956,2979,3001,3009,3032,3043,3050,3113,3124],{"type":373,"tag":671,"props":2591,"children":2592},{"class":673,"line":674},[2593],{"type":373,"tag":671,"props":2594,"children":2595},{"style":850},[2596],{"type":382,"value":2597},"// onboard.go\n",{"type":373,"tag":671,"props":2599,"children":2600},{"class":673,"line":707},[2601,2605],{"type":373,"tag":671,"props":2602,"children":2603},{"style":763},[2604],{"type":382,"value":861},{"type":373,"tag":671,"props":2606,"children":2607},{"style":678},[2608],{"type":382,"value":866},{"type":373,"tag":671,"props":2610,"children":2611},{"class":673,"line":731},[2612],{"type":373,"tag":671,"props":2613,"children":2614},{"emptyLinePlaceholder":753},[2615],{"type":382,"value":756},{"type":373,"tag":671,"props":2617,"children":2618},{"class":673,"line":749},[2619,2623],{"type":373,"tag":671,"props":2620,"children":2621},{"style":763},[2622],{"type":382,"value":881},{"type":373,"tag":671,"props":2624,"children":2625},{"style":690},[2626],{"type":382,"value":886},{"type":373,"tag":671,"props":2628,"children":2629},{"class":673,"line":759},[2630,2634,2638],{"type":373,"tag":671,"props":2631,"children":2632},{"style":684},[2633],{"type":382,"value":894},{"type":373,"tag":671,"props":2635,"children":2636},{"style":678},[2637],{"type":382,"value":899},{"type":373,"tag":671,"props":2639,"children":2640},{"style":684},[2641],{"type":382,"value":904},{"type":373,"tag":671,"props":2643,"children":2644},{"class":673,"line":784},[2645],{"type":373,"tag":671,"props":2646,"children":2647},{"emptyLinePlaceholder":753},[2648],{"type":382,"value":756},{"type":373,"tag":671,"props":2650,"children":2651},{"class":673,"line":923},[2652,2656,2660],{"type":373,"tag":671,"props":2653,"children":2654},{"style":684},[2655],{"type":382,"value":894},{"type":373,"tag":671,"props":2657,"children":2658},{"style":678},[2659],{"type":382,"value":390},{"type":373,"tag":671,"props":2661,"children":2662},{"style":684},[2663],{"type":382,"value":904},{"type":373,"tag":671,"props":2665,"children":2666},{"class":673,"line":940},[2667],{"type":373,"tag":671,"props":2668,"children":2669},{"style":690},[2670],{"type":382,"value":987},{"type":373,"tag":671,"props":2672,"children":2673},{"class":673,"line":957},[2674],{"type":373,"tag":671,"props":2675,"children":2676},{"emptyLinePlaceholder":753},[2677],{"type":382,"value":756},{"type":373,"tag":671,"props":2679,"children":2680},{"class":673,"line":965},[2681,2685,2689,2693,2697,2701,2705,2709,2713,2717,2722,2726,2731,2735,2740,2745,2749,2753],{"type":373,"tag":671,"props":2682,"children":2683},{"style":763},[2684],{"type":382,"value":1004},{"type":373,"tag":671,"props":2686,"children":2687},{"style":678},[2688],{"type":382,"value":1353},{"type":373,"tag":671,"props":2690,"children":2691},{"style":690},[2692],{"type":382,"value":1053},{"type":373,"tag":671,"props":2694,"children":2695},{"style":1864},[2696],{"type":382,"value":2023},{"type":373,"tag":671,"props":2698,"children":2699},{"style":763},[2700],{"type":382,"value":2028},{"type":373,"tag":671,"props":2702,"children":2703},{"style":678},[2704],{"type":382,"value":2033},{"type":373,"tag":671,"props":2706,"children":2707},{"style":690},[2708],{"type":382,"value":634},{"type":373,"tag":671,"props":2710,"children":2711},{"style":678},[2712],{"type":382,"value":2042},{"type":373,"tag":671,"props":2714,"children":2715},{"style":690},[2716],{"type":382,"value":1882},{"type":373,"tag":671,"props":2718,"children":2719},{"style":1864},[2720],{"type":382,"value":2721},"customerID",{"type":373,"tag":671,"props":2723,"children":2724},{"style":690},[2725],{"type":382,"value":1882},{"type":373,"tag":671,"props":2727,"children":2728},{"style":1864},[2729],{"type":382,"value":2730},"name",{"type":373,"tag":671,"props":2732,"children":2733},{"style":690},[2734],{"type":382,"value":1882},{"type":373,"tag":671,"props":2736,"children":2737},{"style":1864},[2738],{"type":382,"value":2739},"url",{"type":373,"tag":671,"props":2741,"children":2742},{"style":763},[2743],{"type":382,"value":2744}," string",{"type":373,"tag":671,"props":2746,"children":2747},{"style":690},[2748],{"type":382,"value":2047},{"type":373,"tag":671,"props":2750,"children":2751},{"style":763},[2752],{"type":382,"value":2052},{"type":373,"tag":671,"props":2754,"children":2755},{"style":690},[2756],{"type":382,"value":1110},{"type":373,"tag":671,"props":2758,"children":2759},{"class":673,"line":981},[2760,2764,2768,2772,2776,2781,2785,2789,2793,2797,2802,2807,2811,2815],{"type":373,"tag":671,"props":2761,"children":2762},{"style":763},[2763],{"type":382,"value":1090},{"type":373,"tag":671,"props":2765,"children":2766},{"style":690},[2767],{"type":382,"value":2421},{"type":373,"tag":671,"props":2769,"children":2770},{"style":763},[2771],{"type":382,"value":1028},{"type":373,"tag":671,"props":2773,"children":2774},{"style":690},[2775],{"type":382,"value":2430},{"type":373,"tag":671,"props":2777,"children":2778},{"style":678},[2779],{"type":382,"value":2780},"UpsertOutboundConsumer",{"type":373,"tag":671,"props":2782,"children":2783},{"style":690},[2784],{"type":382,"value":1053},{"type":373,"tag":671,"props":2786,"children":2787},{"style":763},[2788],{"type":382,"value":2443},{"type":373,"tag":671,"props":2790,"children":2791},{"style":678},[2792],{"type":382,"value":2033},{"type":373,"tag":671,"props":2794,"children":2795},{"style":690},[2796],{"type":382,"value":634},{"type":373,"tag":671,"props":2798,"children":2799},{"style":678},[2800],{"type":382,"value":2801},"OutboundConsumerOptions",{"type":373,"tag":671,"props":2803,"children":2804},{"style":690},[2805],{"type":382,"value":2806},"{ID: customerID, Name: name}); err ",{"type":373,"tag":671,"props":2808,"children":2809},{"style":763},[2810],{"type":382,"value":1100},{"type":373,"tag":671,"props":2812,"children":2813},{"style":696},[2814],{"type":382,"value":1105},{"type":373,"tag":671,"props":2816,"children":2817},{"style":690},[2818],{"type":382,"value":1110},{"type":373,"tag":671,"props":2820,"children":2821},{"class":673,"line":990},[2822,2827],{"type":373,"tag":671,"props":2823,"children":2824},{"style":763},[2825],{"type":382,"value":2826},"        return",{"type":373,"tag":671,"props":2828,"children":2829},{"style":690},[2830],{"type":382,"value":2831}," err\n",{"type":373,"tag":671,"props":2833,"children":2834},{"class":673,"line":998},[2835],{"type":373,"tag":671,"props":2836,"children":2837},{"style":690},[2838],{"type":382,"value":1138},{"type":373,"tag":671,"props":2840,"children":2841},{"class":673,"line":1017},[2842,2847,2851,2855,2859,2863,2867,2871,2875,2880],{"type":373,"tag":671,"props":2843,"children":2844},{"style":690},[2845],{"type":382,"value":2846},"    endpoint, err ",{"type":373,"tag":671,"props":2848,"children":2849},{"style":763},[2850],{"type":382,"value":1028},{"type":373,"tag":671,"props":2852,"children":2853},{"style":690},[2854],{"type":382,"value":2430},{"type":373,"tag":671,"props":2856,"children":2857},{"style":678},[2858],{"type":382,"value":2564},{"type":373,"tag":671,"props":2860,"children":2861},{"style":690},[2862],{"type":382,"value":1053},{"type":373,"tag":671,"props":2864,"children":2865},{"style":763},[2866],{"type":382,"value":2443},{"type":373,"tag":671,"props":2868,"children":2869},{"style":678},[2870],{"type":382,"value":2033},{"type":373,"tag":671,"props":2872,"children":2873},{"style":690},[2874],{"type":382,"value":634},{"type":373,"tag":671,"props":2876,"children":2877},{"style":678},[2878],{"type":382,"value":2879},"OutboundEndpointOptions",{"type":373,"tag":671,"props":2881,"children":2882},{"style":690},[2883],{"type":382,"value":2091},{"type":373,"tag":671,"props":2885,"children":2886},{"class":673,"line":1084},[2887],{"type":373,"tag":671,"props":2888,"children":2889},{"style":690},[2890],{"type":382,"value":2891},"        Consumer:    customerID,\n",{"type":373,"tag":671,"props":2893,"children":2894},{"class":673,"line":1113},[2895],{"type":373,"tag":671,"props":2896,"children":2897},{"style":690},[2898],{"type":382,"value":2899},"        URL:         url,\n",{"type":373,"tag":671,"props":2901,"children":2902},{"class":673,"line":1132},[2903,2908,2912,2917,2921,2925,2929,2934],{"type":373,"tag":671,"props":2904,"children":2905},{"style":690},[2906],{"type":382,"value":2907},"        EventTypes:  []",{"type":373,"tag":671,"props":2909,"children":2910},{"style":763},[2911],{"type":382,"value":1877},{"type":373,"tag":671,"props":2913,"children":2914},{"style":690},[2915],{"type":382,"value":2916},"{",{"type":373,"tag":671,"props":2918,"children":2919},{"style":684},[2920],{"type":382,"value":2114},{"type":373,"tag":671,"props":2922,"children":2923},{"style":690},[2924],{"type":382,"value":1882},{"type":373,"tag":671,"props":2926,"children":2927},{"style":684},[2928],{"type":382,"value":2261},{"type":373,"tag":671,"props":2930,"children":2931},{"style":690},[2932],{"type":382,"value":2933},"}, ",{"type":373,"tag":671,"props":2935,"children":2936},{"style":850},[2937],{"type":382,"value":2938},"// or []string{\"*\"}\n",{"type":373,"tag":671,"props":2940,"children":2941},{"class":673,"line":1141},[2942,2947,2952],{"type":373,"tag":671,"props":2943,"children":2944},{"style":690},[2945],{"type":382,"value":2946},"        Description: ",{"type":373,"tag":671,"props":2948,"children":2949},{"style":684},[2950],{"type":382,"value":2951},"\"Production webhook receiver\"",{"type":373,"tag":671,"props":2953,"children":2954},{"style":690},[2955],{"type":382,"value":2119},{"type":373,"tag":671,"props":2957,"children":2958},{"class":673,"line":1173},[2959,2964,2969,2974],{"type":373,"tag":671,"props":2960,"children":2961},{"style":690},[2962],{"type":382,"value":2963},"        Timeout:     ",{"type":373,"tag":671,"props":2965,"children":2966},{"style":696},[2967],{"type":382,"value":2968},"15",{"type":373,"tag":671,"props":2970,"children":2971},{"style":690},[2972],{"type":382,"value":2973},",   ",{"type":373,"tag":671,"props":2975,"children":2976},{"style":850},[2977],{"type":382,"value":2978},"// seconds per attempt, up to 60\n",{"type":373,"tag":671,"props":2980,"children":2981},{"class":673,"line":1198},[2982,2987,2992,2996],{"type":373,"tag":671,"props":2983,"children":2984},{"style":690},[2985],{"type":382,"value":2986},"        AutoDisable: ",{"type":373,"tag":671,"props":2988,"children":2989},{"style":696},[2990],{"type":382,"value":2991},"true",{"type":373,"tag":671,"props":2993,"children":2994},{"style":690},[2995],{"type":382,"value":1882},{"type":373,"tag":671,"props":2997,"children":2998},{"style":850},[2999],{"type":382,"value":3000},"// disable after 100 failures in a row spanning 12+ hours\n",{"type":373,"tag":671,"props":3002,"children":3003},{"class":673,"line":1206},[3004],{"type":373,"tag":671,"props":3005,"children":3006},{"style":690},[3007],{"type":382,"value":3008},"    })\n",{"type":373,"tag":671,"props":3010,"children":3011},{"class":673,"line":1214},[3012,3016,3020,3024,3028],{"type":373,"tag":671,"props":3013,"children":3014},{"style":763},[3015],{"type":382,"value":1090},{"type":373,"tag":671,"props":3017,"children":3018},{"style":690},[3019],{"type":382,"value":1095},{"type":373,"tag":671,"props":3021,"children":3022},{"style":763},[3023],{"type":382,"value":1100},{"type":373,"tag":671,"props":3025,"children":3026},{"style":696},[3027],{"type":382,"value":1105},{"type":373,"tag":671,"props":3029,"children":3030},{"style":690},[3031],{"type":382,"value":1110},{"type":373,"tag":671,"props":3033,"children":3034},{"class":673,"line":1257},[3035,3039],{"type":373,"tag":671,"props":3036,"children":3037},{"style":763},[3038],{"type":382,"value":2826},{"type":373,"tag":671,"props":3040,"children":3041},{"style":690},[3042],{"type":382,"value":2831},{"type":373,"tag":671,"props":3044,"children":3045},{"class":673,"line":1276},[3046],{"type":373,"tag":671,"props":3047,"children":3048},{"style":690},[3049],{"type":382,"value":1138},{"type":373,"tag":671,"props":3051,"children":3052},{"class":673,"line":1299},[3053,3058,3063,3067,3072,3076,3080,3084,3089,3094,3099,3104,3108],{"type":373,"tag":671,"props":3054,"children":3055},{"style":690},[3056],{"type":382,"value":3057},"    fmt.",{"type":373,"tag":671,"props":3059,"children":3060},{"style":678},[3061],{"type":382,"value":3062},"Printf",{"type":373,"tag":671,"props":3064,"children":3065},{"style":690},[3066],{"type":382,"value":1053},{"type":373,"tag":671,"props":3068,"children":3069},{"style":684},[3070],{"type":382,"value":3071},"\"endpoint ",{"type":373,"tag":671,"props":3073,"children":3074},{"style":696},[3075],{"type":382,"value":2491},{"type":373,"tag":671,"props":3077,"children":3078},{"style":684},[3079],{"type":382,"value":618},{"type":373,"tag":671,"props":3081,"children":3082},{"style":696},[3083],{"type":382,"value":2491},{"type":373,"tag":671,"props":3085,"children":3086},{"style":684},[3087],{"type":382,"value":3088},")",{"type":373,"tag":671,"props":3090,"children":3091},{"style":696},[3092],{"type":382,"value":3093},"\\n",{"type":373,"tag":671,"props":3095,"children":3096},{"style":684},[3097],{"type":382,"value":3098},"signing secret for the customer: ",{"type":373,"tag":671,"props":3100,"children":3101},{"style":696},[3102],{"type":382,"value":3103},"%s\\n",{"type":373,"tag":671,"props":3105,"children":3106},{"style":684},[3107],{"type":382,"value":1758},{"type":373,"tag":671,"props":3109,"children":3110},{"style":690},[3111],{"type":382,"value":3112},", endpoint.ID, endpoint.State, endpoint.Secret)\n",{"type":373,"tag":671,"props":3114,"children":3115},{"class":673,"line":1316},[3116,3120],{"type":373,"tag":671,"props":3117,"children":3118},{"style":763},[3119],{"type":382,"value":2534},{"type":373,"tag":671,"props":3121,"children":3122},{"style":696},[3123],{"type":382,"value":2539},{"type":373,"tag":671,"props":3125,"children":3126},{"class":673,"line":1339},[3127],{"type":373,"tag":671,"props":3128,"children":3129},{"style":690},[3130],{"type":382,"value":1836},{"type":373,"tag":374,"props":3132,"children":3133},{},[3134],{"type":382,"value":3135},"The URL must be public HTTPS; hosts that resolve to private or loopback addresses are rejected.",{"type":373,"tag":565,"props":3137,"children":3139},{"id":3138},"_3-publish-from-a-transactional-outbox",[3140],{"type":382,"value":3141},"3. Publish from a transactional outbox",{"type":373,"tag":374,"props":3143,"children":3144},{},[3145,3147,3152],{"type":382,"value":3146},"Webhook Relay makes delivery durable once it accepts a message. The gap it can't close is inside your service: a request handler that commits an order and then crashes before calling publish loses the event. The fix is a ",{"type":373,"tag":378,"props":3148,"children":3149},{},[3150],{"type":382,"value":3151},"transactional outbox",{"type":382,"value":3153},": write the event to a table in the same transaction as the business change, and let a worker publish it.",{"type":373,"tag":661,"props":3155,"children":3159},{"className":3156,"code":3157,"language":3158,"meta":345,"style":345},"language-sql shiki shiki-themes github-dark","CREATE TABLE webhook_outbox (\n  id           BIGSERIAL PRIMARY KEY,\n  customer_id  TEXT        NOT NULL,\n  event_type   TEXT        NOT NULL,\n  event_key    TEXT        NOT NULL UNIQUE, -- e.g. invoice-paid:inv_123\n  payload      JSONB       NOT NULL,\n  created_at   TIMESTAMPTZ NOT NULL DEFAULT now(),\n  published_at TIMESTAMPTZ,\n  message_id   TEXT\n);\n\n-- In your business transaction:\n-- INSERT INTO webhook_outbox (customer_id, event_type, event_key, payload)\n-- VALUES ($1, 'invoice.paid', 'invoice-paid:' || $2, $3);\n","sql",[3160],{"type":373,"tag":385,"props":3161,"children":3162},{"__ignoreMap":345},[3163,3171,3179,3187,3195,3203,3211,3219,3227,3235,3243,3250,3258,3266],{"type":373,"tag":671,"props":3164,"children":3165},{"class":673,"line":674},[3166],{"type":373,"tag":671,"props":3167,"children":3168},{},[3169],{"type":382,"value":3170},"CREATE TABLE webhook_outbox (\n",{"type":373,"tag":671,"props":3172,"children":3173},{"class":673,"line":707},[3174],{"type":373,"tag":671,"props":3175,"children":3176},{},[3177],{"type":382,"value":3178},"  id           BIGSERIAL PRIMARY KEY,\n",{"type":373,"tag":671,"props":3180,"children":3181},{"class":673,"line":731},[3182],{"type":373,"tag":671,"props":3183,"children":3184},{},[3185],{"type":382,"value":3186},"  customer_id  TEXT        NOT NULL,\n",{"type":373,"tag":671,"props":3188,"children":3189},{"class":673,"line":749},[3190],{"type":373,"tag":671,"props":3191,"children":3192},{},[3193],{"type":382,"value":3194},"  event_type   TEXT        NOT NULL,\n",{"type":373,"tag":671,"props":3196,"children":3197},{"class":673,"line":759},[3198],{"type":373,"tag":671,"props":3199,"children":3200},{},[3201],{"type":382,"value":3202},"  event_key    TEXT        NOT NULL UNIQUE, -- e.g. invoice-paid:inv_123\n",{"type":373,"tag":671,"props":3204,"children":3205},{"class":673,"line":784},[3206],{"type":373,"tag":671,"props":3207,"children":3208},{},[3209],{"type":382,"value":3210},"  payload      JSONB       NOT NULL,\n",{"type":373,"tag":671,"props":3212,"children":3213},{"class":673,"line":923},[3214],{"type":373,"tag":671,"props":3215,"children":3216},{},[3217],{"type":382,"value":3218},"  created_at   TIMESTAMPTZ NOT NULL DEFAULT now(),\n",{"type":373,"tag":671,"props":3220,"children":3221},{"class":673,"line":940},[3222],{"type":373,"tag":671,"props":3223,"children":3224},{},[3225],{"type":382,"value":3226},"  published_at TIMESTAMPTZ,\n",{"type":373,"tag":671,"props":3228,"children":3229},{"class":673,"line":957},[3230],{"type":373,"tag":671,"props":3231,"children":3232},{},[3233],{"type":382,"value":3234},"  message_id   TEXT\n",{"type":373,"tag":671,"props":3236,"children":3237},{"class":673,"line":965},[3238],{"type":373,"tag":671,"props":3239,"children":3240},{},[3241],{"type":382,"value":3242},");\n",{"type":373,"tag":671,"props":3244,"children":3245},{"class":673,"line":981},[3246],{"type":373,"tag":671,"props":3247,"children":3248},{"emptyLinePlaceholder":753},[3249],{"type":382,"value":756},{"type":373,"tag":671,"props":3251,"children":3252},{"class":673,"line":990},[3253],{"type":373,"tag":671,"props":3254,"children":3255},{},[3256],{"type":382,"value":3257},"-- In your business transaction:\n",{"type":373,"tag":671,"props":3259,"children":3260},{"class":673,"line":998},[3261],{"type":373,"tag":671,"props":3262,"children":3263},{},[3264],{"type":382,"value":3265},"-- INSERT INTO webhook_outbox (customer_id, event_type, event_key, payload)\n",{"type":373,"tag":671,"props":3267,"children":3268},{"class":673,"line":1017},[3269],{"type":373,"tag":671,"props":3270,"children":3271},{},[3272],{"type":382,"value":3273},"-- VALUES ($1, 'invoice.paid', 'invoice-paid:' || $2, $3);\n",{"type":373,"tag":374,"props":3275,"children":3276},{},[3277,3279,3285,3287,3293],{"type":382,"value":3278},"The worker claims a batch with ",{"type":373,"tag":385,"props":3280,"children":3282},{"className":3281},[],[3283],{"type":382,"value":3284},"FOR UPDATE SKIP LOCKED",{"type":382,"value":3286}," (so several replicas can run it), publishes each row with ",{"type":373,"tag":385,"props":3288,"children":3290},{"className":3289},[],[3291],{"type":382,"value":3292},"event_key",{"type":382,"value":3294}," as the idempotency key, and records the message ID. If the worker crashes after publishing but before marking the row, the next run publishes it again and Webhook Relay returns the original receipt instead of delivering twice.",{"type":373,"tag":661,"props":3296,"children":3298},{"className":839,"code":3297,"language":713,"meta":345,"style":345},"// outbox.go\npackage main\n\nimport (\n    \"context\"\n    \"database/sql\"\n    \"encoding/json\"\n    \"fmt\"\n    \"log\"\n    \"time\"\n\n    \"github.com/webhookrelay/webhookrelay-go\"\n    // Register a Postgres driver, e.g. _ \"github.com/jackc/pgx/v5/stdlib\"\n)\n\nfunc runOutbox(api *webhookrelay.API, databaseURL string) error {\n    db, err := sql.Open(\"pgx\", databaseURL)\n    if err != nil {\n        return err\n    }\n    defer db.Close()\n\n    for {\n        n, err := publishBatch(context.Background(), api, db, 100)\n        if err != nil {\n            log.Printf(\"outbox: %v\", err)\n        }\n        if n == 0 {\n            time.Sleep(time.Second)\n        }\n    }\n}\n\nfunc publishBatch(ctx context.Context, api *webhookrelay.API, db *sql.DB, limit int) (int, error) {\n    tx, err := db.BeginTx(ctx, nil)\n    if err != nil {\n        return 0, err\n    }\n    defer tx.Rollback()\n\n    rows, err := tx.QueryContext(ctx, `\n        SELECT id, customer_id, event_type, event_key, payload\n        FROM webhook_outbox\n        WHERE published_at IS NULL\n        ORDER BY id\n        LIMIT $1\n        FOR UPDATE SKIP LOCKED`, limit)\n    if err != nil {\n        return 0, err\n    }\n    type row struct {\n        id                              int64\n        customerID, eventType, eventKey string\n        payload                         json.RawMessage\n    }\n    var batch []row\n    for rows.Next() {\n        var r row\n        if err := rows.Scan(&r.id, &r.customerID, &r.eventType, &r.eventKey, &r.payload); err != nil {\n            rows.Close()\n            return 0, err\n        }\n        batch = append(batch, r)\n    }\n    rows.Close()\n\n    for _, r := range batch {\n        message, err := api.PublishOutboundMessage(&webhookrelay.OutboundMessagePublishOptions{\n            Consumer:       r.customerID,\n            EventType:      r.eventType,\n            EventID:        r.eventKey,\n            Payload:        r.payload, // json.RawMessage is sent as-is, up to 256 KiB\n            IdempotencyKey: r.eventKey,\n        })\n        if err != nil {\n            // Leave the row unpublished; the next batch retries it with the same key.\n            return 0, fmt.Errorf(\"publish %s: %w\", r.eventKey, err)\n        }\n        if _, err := tx.ExecContext(ctx,\n            `UPDATE webhook_outbox SET published_at = now(), message_id = $1 WHERE id = $2`,\n            message.ID, r.id); err != nil {\n            return 0, err\n        }\n    }\n    return len(batch), tx.Commit()\n}\n",[3299],{"type":373,"tag":385,"props":3300,"children":3301},{"__ignoreMap":345},[3302,3310,3321,3328,3339,3355,3371,3387,3402,3417,3432,3439,3454,3462,3469,3476,3536,3572,3595,3606,3613,3636,3643,3654,3695,3718,3753,3760,3785,3803,3810,3817,3824,3831,3950,3985,4008,4024,4031,4052,4059,4089,4097,4105,4113,4121,4129,4142,4165,4180,4187,4209,4222,4235,4257,4264,4282,4303,4319,4404,4420,4435,4442,4464,4471,4487,4494,4519,4565,4573,4581,4589,4602,4610,4618,4642,4651,4702,4710,4740,4753,4774,4790,4798,4806,4832],{"type":373,"tag":671,"props":3303,"children":3304},{"class":673,"line":674},[3305],{"type":373,"tag":671,"props":3306,"children":3307},{"style":850},[3308],{"type":382,"value":3309},"// outbox.go\n",{"type":373,"tag":671,"props":3311,"children":3312},{"class":673,"line":707},[3313,3317],{"type":373,"tag":671,"props":3314,"children":3315},{"style":763},[3316],{"type":382,"value":861},{"type":373,"tag":671,"props":3318,"children":3319},{"style":678},[3320],{"type":382,"value":866},{"type":373,"tag":671,"props":3322,"children":3323},{"class":673,"line":731},[3324],{"type":373,"tag":671,"props":3325,"children":3326},{"emptyLinePlaceholder":753},[3327],{"type":382,"value":756},{"type":373,"tag":671,"props":3329,"children":3330},{"class":673,"line":749},[3331,3335],{"type":373,"tag":671,"props":3332,"children":3333},{"style":763},[3334],{"type":382,"value":881},{"type":373,"tag":671,"props":3336,"children":3337},{"style":690},[3338],{"type":382,"value":886},{"type":373,"tag":671,"props":3340,"children":3341},{"class":673,"line":759},[3342,3346,3351],{"type":373,"tag":671,"props":3343,"children":3344},{"style":684},[3345],{"type":382,"value":894},{"type":373,"tag":671,"props":3347,"children":3348},{"style":678},[3349],{"type":382,"value":3350},"context",{"type":373,"tag":671,"props":3352,"children":3353},{"style":684},[3354],{"type":382,"value":904},{"type":373,"tag":671,"props":3356,"children":3357},{"class":673,"line":784},[3358,3362,3367],{"type":373,"tag":671,"props":3359,"children":3360},{"style":684},[3361],{"type":382,"value":894},{"type":373,"tag":671,"props":3363,"children":3364},{"style":678},[3365],{"type":382,"value":3366},"database/sql",{"type":373,"tag":671,"props":3368,"children":3369},{"style":684},[3370],{"type":382,"value":904},{"type":373,"tag":671,"props":3372,"children":3373},{"class":673,"line":923},[3374,3378,3383],{"type":373,"tag":671,"props":3375,"children":3376},{"style":684},[3377],{"type":382,"value":894},{"type":373,"tag":671,"props":3379,"children":3380},{"style":678},[3381],{"type":382,"value":3382},"encoding/json",{"type":373,"tag":671,"props":3384,"children":3385},{"style":684},[3386],{"type":382,"value":904},{"type":373,"tag":671,"props":3388,"children":3389},{"class":673,"line":940},[3390,3394,3398],{"type":373,"tag":671,"props":3391,"children":3392},{"style":684},[3393],{"type":382,"value":894},{"type":373,"tag":671,"props":3395,"children":3396},{"style":678},[3397],{"type":382,"value":899},{"type":373,"tag":671,"props":3399,"children":3400},{"style":684},[3401],{"type":382,"value":904},{"type":373,"tag":671,"props":3403,"children":3404},{"class":673,"line":957},[3405,3409,3413],{"type":373,"tag":671,"props":3406,"children":3407},{"style":684},[3408],{"type":382,"value":894},{"type":373,"tag":671,"props":3410,"children":3411},{"style":678},[3412],{"type":382,"value":916},{"type":373,"tag":671,"props":3414,"children":3415},{"style":684},[3416],{"type":382,"value":904},{"type":373,"tag":671,"props":3418,"children":3419},{"class":673,"line":965},[3420,3424,3428],{"type":373,"tag":671,"props":3421,"children":3422},{"style":684},[3423],{"type":382,"value":894},{"type":373,"tag":671,"props":3425,"children":3426},{"style":678},[3427],{"type":382,"value":950},{"type":373,"tag":671,"props":3429,"children":3430},{"style":684},[3431],{"type":382,"value":904},{"type":373,"tag":671,"props":3433,"children":3434},{"class":673,"line":981},[3435],{"type":373,"tag":671,"props":3436,"children":3437},{"emptyLinePlaceholder":753},[3438],{"type":382,"value":756},{"type":373,"tag":671,"props":3440,"children":3441},{"class":673,"line":990},[3442,3446,3450],{"type":373,"tag":671,"props":3443,"children":3444},{"style":684},[3445],{"type":382,"value":894},{"type":373,"tag":671,"props":3447,"children":3448},{"style":678},[3449],{"type":382,"value":390},{"type":373,"tag":671,"props":3451,"children":3452},{"style":684},[3453],{"type":382,"value":904},{"type":373,"tag":671,"props":3455,"children":3456},{"class":673,"line":998},[3457],{"type":373,"tag":671,"props":3458,"children":3459},{"style":850},[3460],{"type":382,"value":3461},"    // Register a Postgres driver, e.g. _ \"github.com/jackc/pgx/v5/stdlib\"\n",{"type":373,"tag":671,"props":3463,"children":3464},{"class":673,"line":1017},[3465],{"type":373,"tag":671,"props":3466,"children":3467},{"style":690},[3468],{"type":382,"value":987},{"type":373,"tag":671,"props":3470,"children":3471},{"class":673,"line":1084},[3472],{"type":373,"tag":671,"props":3473,"children":3474},{"emptyLinePlaceholder":753},[3475],{"type":382,"value":756},{"type":373,"tag":671,"props":3477,"children":3478},{"class":673,"line":1113},[3479,3483,3487,3491,3495,3499,3503,3507,3511,3515,3520,3524,3528,3532],{"type":373,"tag":671,"props":3480,"children":3481},{"style":763},[3482],{"type":382,"value":1004},{"type":373,"tag":671,"props":3484,"children":3485},{"style":678},[3486],{"type":382,"value":1419},{"type":373,"tag":671,"props":3488,"children":3489},{"style":690},[3490],{"type":382,"value":1053},{"type":373,"tag":671,"props":3492,"children":3493},{"style":1864},[3494],{"type":382,"value":2023},{"type":373,"tag":671,"props":3496,"children":3497},{"style":763},[3498],{"type":382,"value":2028},{"type":373,"tag":671,"props":3500,"children":3501},{"style":678},[3502],{"type":382,"value":2033},{"type":373,"tag":671,"props":3504,"children":3505},{"style":690},[3506],{"type":382,"value":634},{"type":373,"tag":671,"props":3508,"children":3509},{"style":678},[3510],{"type":382,"value":2042},{"type":373,"tag":671,"props":3512,"children":3513},{"style":690},[3514],{"type":382,"value":1882},{"type":373,"tag":671,"props":3516,"children":3517},{"style":1864},[3518],{"type":382,"value":3519},"databaseURL",{"type":373,"tag":671,"props":3521,"children":3522},{"style":763},[3523],{"type":382,"value":2744},{"type":373,"tag":671,"props":3525,"children":3526},{"style":690},[3527],{"type":382,"value":2047},{"type":373,"tag":671,"props":3529,"children":3530},{"style":763},[3531],{"type":382,"value":2052},{"type":373,"tag":671,"props":3533,"children":3534},{"style":690},[3535],{"type":382,"value":1110},{"type":373,"tag":671,"props":3537,"children":3538},{"class":673,"line":1132},[3539,3544,3548,3553,3558,3562,3567],{"type":373,"tag":671,"props":3540,"children":3541},{"style":690},[3542],{"type":382,"value":3543},"    db, err ",{"type":373,"tag":671,"props":3545,"children":3546},{"style":763},[3547],{"type":382,"value":1028},{"type":373,"tag":671,"props":3549,"children":3550},{"style":690},[3551],{"type":382,"value":3552}," sql.",{"type":373,"tag":671,"props":3554,"children":3555},{"style":678},[3556],{"type":382,"value":3557},"Open",{"type":373,"tag":671,"props":3559,"children":3560},{"style":690},[3561],{"type":382,"value":1053},{"type":373,"tag":671,"props":3563,"children":3564},{"style":684},[3565],{"type":382,"value":3566},"\"pgx\"",{"type":373,"tag":671,"props":3568,"children":3569},{"style":690},[3570],{"type":382,"value":3571},", databaseURL)\n",{"type":373,"tag":671,"props":3573,"children":3574},{"class":673,"line":1141},[3575,3579,3583,3587,3591],{"type":373,"tag":671,"props":3576,"children":3577},{"style":763},[3578],{"type":382,"value":1090},{"type":373,"tag":671,"props":3580,"children":3581},{"style":690},[3582],{"type":382,"value":1095},{"type":373,"tag":671,"props":3584,"children":3585},{"style":763},[3586],{"type":382,"value":1100},{"type":373,"tag":671,"props":3588,"children":3589},{"style":696},[3590],{"type":382,"value":1105},{"type":373,"tag":671,"props":3592,"children":3593},{"style":690},[3594],{"type":382,"value":1110},{"type":373,"tag":671,"props":3596,"children":3597},{"class":673,"line":1173},[3598,3602],{"type":373,"tag":671,"props":3599,"children":3600},{"style":763},[3601],{"type":382,"value":2826},{"type":373,"tag":671,"props":3603,"children":3604},{"style":690},[3605],{"type":382,"value":2831},{"type":373,"tag":671,"props":3607,"children":3608},{"class":673,"line":1198},[3609],{"type":373,"tag":671,"props":3610,"children":3611},{"style":690},[3612],{"type":382,"value":1138},{"type":373,"tag":671,"props":3614,"children":3615},{"class":673,"line":1206},[3616,3621,3626,3631],{"type":373,"tag":671,"props":3617,"children":3618},{"style":763},[3619],{"type":382,"value":3620},"    defer",{"type":373,"tag":671,"props":3622,"children":3623},{"style":690},[3624],{"type":382,"value":3625}," db.",{"type":373,"tag":671,"props":3627,"children":3628},{"style":678},[3629],{"type":382,"value":3630},"Close",{"type":373,"tag":671,"props":3632,"children":3633},{"style":690},[3634],{"type":382,"value":3635},"()\n",{"type":373,"tag":671,"props":3637,"children":3638},{"class":673,"line":1214},[3639],{"type":373,"tag":671,"props":3640,"children":3641},{"emptyLinePlaceholder":753},[3642],{"type":382,"value":756},{"type":373,"tag":671,"props":3644,"children":3645},{"class":673,"line":1257},[3646,3650],{"type":373,"tag":671,"props":3647,"children":3648},{"style":763},[3649],{"type":382,"value":2389},{"type":373,"tag":671,"props":3651,"children":3652},{"style":690},[3653],{"type":382,"value":1110},{"type":373,"tag":671,"props":3655,"children":3656},{"class":673,"line":1276},[3657,3662,3666,3671,3676,3681,3686,3691],{"type":373,"tag":671,"props":3658,"children":3659},{"style":690},[3660],{"type":382,"value":3661},"        n, err ",{"type":373,"tag":671,"props":3663,"children":3664},{"style":763},[3665],{"type":382,"value":1028},{"type":373,"tag":671,"props":3667,"children":3668},{"style":678},[3669],{"type":382,"value":3670}," publishBatch",{"type":373,"tag":671,"props":3672,"children":3673},{"style":690},[3674],{"type":382,"value":3675},"(context.",{"type":373,"tag":671,"props":3677,"children":3678},{"style":678},[3679],{"type":382,"value":3680},"Background",{"type":373,"tag":671,"props":3682,"children":3683},{"style":690},[3684],{"type":382,"value":3685},"(), api, db, ",{"type":373,"tag":671,"props":3687,"children":3688},{"style":696},[3689],{"type":382,"value":3690},"100",{"type":373,"tag":671,"props":3692,"children":3693},{"style":690},[3694],{"type":382,"value":987},{"type":373,"tag":671,"props":3696,"children":3697},{"class":673,"line":1299},[3698,3702,3706,3710,3714],{"type":373,"tag":671,"props":3699,"children":3700},{"style":763},[3701],{"type":382,"value":1618},{"type":373,"tag":671,"props":3703,"children":3704},{"style":690},[3705],{"type":382,"value":1095},{"type":373,"tag":671,"props":3707,"children":3708},{"style":763},[3709],{"type":382,"value":1100},{"type":373,"tag":671,"props":3711,"children":3712},{"style":696},[3713],{"type":382,"value":1105},{"type":373,"tag":671,"props":3715,"children":3716},{"style":690},[3717],{"type":382,"value":1110},{"type":373,"tag":671,"props":3719,"children":3720},{"class":673,"line":1316},[3721,3726,3730,3734,3739,3744,3748],{"type":373,"tag":671,"props":3722,"children":3723},{"style":690},[3724],{"type":382,"value":3725},"            log.",{"type":373,"tag":671,"props":3727,"children":3728},{"style":678},[3729],{"type":382,"value":3062},{"type":373,"tag":671,"props":3731,"children":3732},{"style":690},[3733],{"type":382,"value":1053},{"type":373,"tag":671,"props":3735,"children":3736},{"style":684},[3737],{"type":382,"value":3738},"\"outbox: ",{"type":373,"tag":671,"props":3740,"children":3741},{"style":696},[3742],{"type":382,"value":3743},"%v",{"type":373,"tag":671,"props":3745,"children":3746},{"style":684},[3747],{"type":382,"value":1758},{"type":373,"tag":671,"props":3749,"children":3750},{"style":690},[3751],{"type":382,"value":3752},", err)\n",{"type":373,"tag":671,"props":3754,"children":3755},{"class":673,"line":1339},[3756],{"type":373,"tag":671,"props":3757,"children":3758},{"style":690},[3759],{"type":382,"value":1704},{"type":373,"tag":671,"props":3761,"children":3762},{"class":673,"line":1388},[3763,3767,3772,3776,3781],{"type":373,"tag":671,"props":3764,"children":3765},{"style":763},[3766],{"type":382,"value":1618},{"type":373,"tag":671,"props":3768,"children":3769},{"style":690},[3770],{"type":382,"value":3771}," n ",{"type":373,"tag":671,"props":3773,"children":3774},{"style":763},[3775],{"type":382,"value":1656},{"type":373,"tag":671,"props":3777,"children":3778},{"style":696},[3779],{"type":382,"value":3780}," 0",{"type":373,"tag":671,"props":3782,"children":3783},{"style":690},[3784],{"type":382,"value":1110},{"type":373,"tag":671,"props":3786,"children":3787},{"class":673,"line":1405},[3788,3793,3798],{"type":373,"tag":671,"props":3789,"children":3790},{"style":690},[3791],{"type":382,"value":3792},"            time.",{"type":373,"tag":671,"props":3794,"children":3795},{"style":678},[3796],{"type":382,"value":3797},"Sleep",{"type":373,"tag":671,"props":3799,"children":3800},{"style":690},[3801],{"type":382,"value":3802},"(time.Second)\n",{"type":373,"tag":671,"props":3804,"children":3805},{"class":673,"line":1444},[3806],{"type":373,"tag":671,"props":3807,"children":3808},{"style":690},[3809],{"type":382,"value":1704},{"type":373,"tag":671,"props":3811,"children":3812},{"class":673,"line":1461},[3813],{"type":373,"tag":671,"props":3814,"children":3815},{"style":690},[3816],{"type":382,"value":1138},{"type":373,"tag":671,"props":3818,"children":3819},{"class":673,"line":1481},[3820],{"type":373,"tag":671,"props":3821,"children":3822},{"style":690},[3823],{"type":382,"value":1836},{"type":373,"tag":671,"props":3825,"children":3826},{"class":673,"line":1510},[3827],{"type":373,"tag":671,"props":3828,"children":3829},{"emptyLinePlaceholder":753},[3830],{"type":382,"value":756},{"type":373,"tag":671,"props":3832,"children":3833},{"class":673,"line":1527},[3834,3838,3842,3846,3851,3856,3860,3865,3869,3873,3877,3881,3885,3889,3893,3898,3902,3906,3910,3915,3919,3924,3928,3933,3938,3942,3946],{"type":373,"tag":671,"props":3835,"children":3836},{"style":763},[3837],{"type":382,"value":1004},{"type":373,"tag":671,"props":3839,"children":3840},{"style":678},[3841],{"type":382,"value":3670},{"type":373,"tag":671,"props":3843,"children":3844},{"style":690},[3845],{"type":382,"value":1053},{"type":373,"tag":671,"props":3847,"children":3848},{"style":1864},[3849],{"type":382,"value":3850},"ctx",{"type":373,"tag":671,"props":3852,"children":3853},{"style":678},[3854],{"type":382,"value":3855}," context",{"type":373,"tag":671,"props":3857,"children":3858},{"style":690},[3859],{"type":382,"value":634},{"type":373,"tag":671,"props":3861,"children":3862},{"style":678},[3863],{"type":382,"value":3864},"Context",{"type":373,"tag":671,"props":3866,"children":3867},{"style":690},[3868],{"type":382,"value":1882},{"type":373,"tag":671,"props":3870,"children":3871},{"style":1864},[3872],{"type":382,"value":2023},{"type":373,"tag":671,"props":3874,"children":3875},{"style":763},[3876],{"type":382,"value":2028},{"type":373,"tag":671,"props":3878,"children":3879},{"style":678},[3880],{"type":382,"value":2033},{"type":373,"tag":671,"props":3882,"children":3883},{"style":690},[3884],{"type":382,"value":634},{"type":373,"tag":671,"props":3886,"children":3887},{"style":678},[3888],{"type":382,"value":2042},{"type":373,"tag":671,"props":3890,"children":3891},{"style":690},[3892],{"type":382,"value":1882},{"type":373,"tag":671,"props":3894,"children":3895},{"style":1864},[3896],{"type":382,"value":3897},"db",{"type":373,"tag":671,"props":3899,"children":3900},{"style":763},[3901],{"type":382,"value":2028},{"type":373,"tag":671,"props":3903,"children":3904},{"style":678},[3905],{"type":382,"value":3158},{"type":373,"tag":671,"props":3907,"children":3908},{"style":690},[3909],{"type":382,"value":634},{"type":373,"tag":671,"props":3911,"children":3912},{"style":678},[3913],{"type":382,"value":3914},"DB",{"type":373,"tag":671,"props":3916,"children":3917},{"style":690},[3918],{"type":382,"value":1882},{"type":373,"tag":671,"props":3920,"children":3921},{"style":1864},[3922],{"type":382,"value":3923},"limit",{"type":373,"tag":671,"props":3925,"children":3926},{"style":763},[3927],{"type":382,"value":1892},{"type":373,"tag":671,"props":3929,"children":3930},{"style":690},[3931],{"type":382,"value":3932},") (",{"type":373,"tag":671,"props":3934,"children":3935},{"style":763},[3936],{"type":382,"value":3937},"int",{"type":373,"tag":671,"props":3939,"children":3940},{"style":690},[3941],{"type":382,"value":1882},{"type":373,"tag":671,"props":3943,"children":3944},{"style":763},[3945],{"type":382,"value":2052},{"type":373,"tag":671,"props":3947,"children":3948},{"style":690},[3949],{"type":382,"value":1897},{"type":373,"tag":671,"props":3951,"children":3952},{"class":673,"line":1548},[3953,3958,3962,3966,3971,3976,3981],{"type":373,"tag":671,"props":3954,"children":3955},{"style":690},[3956],{"type":382,"value":3957},"    tx, err ",{"type":373,"tag":671,"props":3959,"children":3960},{"style":763},[3961],{"type":382,"value":1028},{"type":373,"tag":671,"props":3963,"children":3964},{"style":690},[3965],{"type":382,"value":3625},{"type":373,"tag":671,"props":3967,"children":3968},{"style":678},[3969],{"type":382,"value":3970},"BeginTx",{"type":373,"tag":671,"props":3972,"children":3973},{"style":690},[3974],{"type":382,"value":3975},"(ctx, ",{"type":373,"tag":671,"props":3977,"children":3978},{"style":696},[3979],{"type":382,"value":3980},"nil",{"type":373,"tag":671,"props":3982,"children":3983},{"style":690},[3984],{"type":382,"value":987},{"type":373,"tag":671,"props":3986,"children":3987},{"class":673,"line":1565},[3988,3992,3996,4000,4004],{"type":373,"tag":671,"props":3989,"children":3990},{"style":763},[3991],{"type":382,"value":1090},{"type":373,"tag":671,"props":3993,"children":3994},{"style":690},[3995],{"type":382,"value":1095},{"type":373,"tag":671,"props":3997,"children":3998},{"style":763},[3999],{"type":382,"value":1100},{"type":373,"tag":671,"props":4001,"children":4002},{"style":696},[4003],{"type":382,"value":1105},{"type":373,"tag":671,"props":4005,"children":4006},{"style":690},[4007],{"type":382,"value":1110},{"type":373,"tag":671,"props":4009,"children":4010},{"class":673,"line":1585},[4011,4015,4019],{"type":373,"tag":671,"props":4012,"children":4013},{"style":763},[4014],{"type":382,"value":2826},{"type":373,"tag":671,"props":4016,"children":4017},{"style":696},[4018],{"type":382,"value":3780},{"type":373,"tag":671,"props":4020,"children":4021},{"style":690},[4022],{"type":382,"value":4023},", err\n",{"type":373,"tag":671,"props":4025,"children":4026},{"class":673,"line":1612},[4027],{"type":373,"tag":671,"props":4028,"children":4029},{"style":690},[4030],{"type":382,"value":1138},{"type":373,"tag":671,"props":4032,"children":4033},{"class":673,"line":1667},[4034,4038,4043,4048],{"type":373,"tag":671,"props":4035,"children":4036},{"style":763},[4037],{"type":382,"value":3620},{"type":373,"tag":671,"props":4039,"children":4040},{"style":690},[4041],{"type":382,"value":4042}," tx.",{"type":373,"tag":671,"props":4044,"children":4045},{"style":678},[4046],{"type":382,"value":4047},"Rollback",{"type":373,"tag":671,"props":4049,"children":4050},{"style":690},[4051],{"type":382,"value":3635},{"type":373,"tag":671,"props":4053,"children":4054},{"class":673,"line":1698},[4055],{"type":373,"tag":671,"props":4056,"children":4057},{"emptyLinePlaceholder":753},[4058],{"type":382,"value":756},{"type":373,"tag":671,"props":4060,"children":4061},{"class":673,"line":1707},[4062,4067,4071,4075,4080,4084],{"type":373,"tag":671,"props":4063,"children":4064},{"style":690},[4065],{"type":382,"value":4066},"    rows, err ",{"type":373,"tag":671,"props":4068,"children":4069},{"style":763},[4070],{"type":382,"value":1028},{"type":373,"tag":671,"props":4072,"children":4073},{"style":690},[4074],{"type":382,"value":4042},{"type":373,"tag":671,"props":4076,"children":4077},{"style":678},[4078],{"type":382,"value":4079},"QueryContext",{"type":373,"tag":671,"props":4081,"children":4082},{"style":690},[4083],{"type":382,"value":3975},{"type":373,"tag":671,"props":4085,"children":4086},{"style":684},[4087],{"type":382,"value":4088},"`\n",{"type":373,"tag":671,"props":4090,"children":4091},{"class":673,"line":1720},[4092],{"type":373,"tag":671,"props":4093,"children":4094},{"style":684},[4095],{"type":382,"value":4096},"        SELECT id, customer_id, event_type, event_key, payload\n",{"type":373,"tag":671,"props":4098,"children":4099},{"class":673,"line":1774},[4100],{"type":373,"tag":671,"props":4101,"children":4102},{"style":684},[4103],{"type":382,"value":4104},"        FROM webhook_outbox\n",{"type":373,"tag":671,"props":4106,"children":4107},{"class":673,"line":1782},[4108],{"type":373,"tag":671,"props":4109,"children":4110},{"style":684},[4111],{"type":382,"value":4112},"        WHERE published_at IS NULL\n",{"type":373,"tag":671,"props":4114,"children":4115},{"class":673,"line":1806},[4116],{"type":373,"tag":671,"props":4117,"children":4118},{"style":684},[4119],{"type":382,"value":4120},"        ORDER BY id\n",{"type":373,"tag":671,"props":4122,"children":4123},{"class":673,"line":1822},[4124],{"type":373,"tag":671,"props":4125,"children":4126},{"style":684},[4127],{"type":382,"value":4128},"        LIMIT $1\n",{"type":373,"tag":671,"props":4130,"children":4131},{"class":673,"line":1830},[4132,4137],{"type":373,"tag":671,"props":4133,"children":4134},{"style":684},[4135],{"type":382,"value":4136},"        FOR UPDATE SKIP LOCKED`",{"type":373,"tag":671,"props":4138,"children":4139},{"style":690},[4140],{"type":382,"value":4141},", limit)\n",{"type":373,"tag":671,"props":4143,"children":4144},{"class":673,"line":1839},[4145,4149,4153,4157,4161],{"type":373,"tag":671,"props":4146,"children":4147},{"style":763},[4148],{"type":382,"value":1090},{"type":373,"tag":671,"props":4150,"children":4151},{"style":690},[4152],{"type":382,"value":1095},{"type":373,"tag":671,"props":4154,"children":4155},{"style":763},[4156],{"type":382,"value":1100},{"type":373,"tag":671,"props":4158,"children":4159},{"style":696},[4160],{"type":382,"value":1105},{"type":373,"tag":671,"props":4162,"children":4163},{"style":690},[4164],{"type":382,"value":1110},{"type":373,"tag":671,"props":4166,"children":4167},{"class":673,"line":1847},[4168,4172,4176],{"type":373,"tag":671,"props":4169,"children":4170},{"style":763},[4171],{"type":382,"value":2826},{"type":373,"tag":671,"props":4173,"children":4174},{"style":696},[4175],{"type":382,"value":3780},{"type":373,"tag":671,"props":4177,"children":4178},{"style":690},[4179],{"type":382,"value":4023},{"type":373,"tag":671,"props":4181,"children":4182},{"class":673,"line":1900},[4183],{"type":373,"tag":671,"props":4184,"children":4185},{"style":690},[4186],{"type":382,"value":1138},{"type":373,"tag":671,"props":4188,"children":4189},{"class":673,"line":1926},[4190,4195,4200,4205],{"type":373,"tag":671,"props":4191,"children":4192},{"style":763},[4193],{"type":382,"value":4194},"    type",{"type":373,"tag":671,"props":4196,"children":4197},{"style":678},[4198],{"type":382,"value":4199}," row",{"type":373,"tag":671,"props":4201,"children":4202},{"style":763},[4203],{"type":382,"value":4204}," struct",{"type":373,"tag":671,"props":4206,"children":4207},{"style":690},[4208],{"type":382,"value":1110},{"type":373,"tag":671,"props":4210,"children":4211},{"class":673,"line":1981},[4212,4217],{"type":373,"tag":671,"props":4213,"children":4214},{"style":690},[4215],{"type":382,"value":4216},"        id                              ",{"type":373,"tag":671,"props":4218,"children":4219},{"style":763},[4220],{"type":382,"value":4221},"int64\n",{"type":373,"tag":671,"props":4223,"children":4224},{"class":673,"line":1989},[4225,4230],{"type":373,"tag":671,"props":4226,"children":4227},{"style":690},[4228],{"type":382,"value":4229},"        customerID, eventType, eventKey ",{"type":373,"tag":671,"props":4231,"children":4232},{"style":763},[4233],{"type":382,"value":4234},"string\n",{"type":373,"tag":671,"props":4236,"children":4237},{"class":673,"line":1997},[4238,4243,4248,4252],{"type":373,"tag":671,"props":4239,"children":4240},{"style":690},[4241],{"type":382,"value":4242},"        payload                         ",{"type":373,"tag":671,"props":4244,"children":4245},{"style":678},[4246],{"type":382,"value":4247},"json",{"type":373,"tag":671,"props":4249,"children":4250},{"style":690},[4251],{"type":382,"value":634},{"type":373,"tag":671,"props":4253,"children":4254},{"style":678},[4255],{"type":382,"value":4256},"RawMessage\n",{"type":373,"tag":671,"props":4258,"children":4259},{"class":673,"line":2005},[4260],{"type":373,"tag":671,"props":4261,"children":4262},{"style":690},[4263],{"type":382,"value":1138},{"type":373,"tag":671,"props":4265,"children":4266},{"class":673,"line":2059},[4267,4272,4277],{"type":373,"tag":671,"props":4268,"children":4269},{"style":763},[4270],{"type":382,"value":4271},"    var",{"type":373,"tag":671,"props":4273,"children":4274},{"style":690},[4275],{"type":382,"value":4276}," batch []",{"type":373,"tag":671,"props":4278,"children":4279},{"style":678},[4280],{"type":382,"value":4281},"row\n",{"type":373,"tag":671,"props":4283,"children":4284},{"class":673,"line":2094},[4285,4289,4294,4299],{"type":373,"tag":671,"props":4286,"children":4287},{"style":763},[4288],{"type":382,"value":2389},{"type":373,"tag":671,"props":4290,"children":4291},{"style":690},[4292],{"type":382,"value":4293}," rows.",{"type":373,"tag":671,"props":4295,"children":4296},{"style":678},[4297],{"type":382,"value":4298},"Next",{"type":373,"tag":671,"props":4300,"children":4301},{"style":690},[4302],{"type":382,"value":1014},{"type":373,"tag":671,"props":4304,"children":4305},{"class":673,"line":2103},[4306,4310,4315],{"type":373,"tag":671,"props":4307,"children":4308},{"style":763},[4309],{"type":382,"value":1591},{"type":373,"tag":671,"props":4311,"children":4312},{"style":690},[4313],{"type":382,"value":4314}," r ",{"type":373,"tag":671,"props":4316,"children":4317},{"style":678},[4318],{"type":382,"value":4281},{"type":373,"tag":671,"props":4320,"children":4321},{"class":673,"line":2122},[4322,4326,4330,4334,4338,4343,4347,4351,4356,4360,4365,4369,4374,4378,4383,4387,4392,4396,4400],{"type":373,"tag":671,"props":4323,"children":4324},{"style":763},[4325],{"type":382,"value":1618},{"type":373,"tag":671,"props":4327,"children":4328},{"style":690},[4329],{"type":382,"value":1095},{"type":373,"tag":671,"props":4331,"children":4332},{"style":763},[4333],{"type":382,"value":1028},{"type":373,"tag":671,"props":4335,"children":4336},{"style":690},[4337],{"type":382,"value":4293},{"type":373,"tag":671,"props":4339,"children":4340},{"style":678},[4341],{"type":382,"value":4342},"Scan",{"type":373,"tag":671,"props":4344,"children":4345},{"style":690},[4346],{"type":382,"value":1053},{"type":373,"tag":671,"props":4348,"children":4349},{"style":763},[4350],{"type":382,"value":2443},{"type":373,"tag":671,"props":4352,"children":4353},{"style":690},[4354],{"type":382,"value":4355},"r.id, ",{"type":373,"tag":671,"props":4357,"children":4358},{"style":763},[4359],{"type":382,"value":2443},{"type":373,"tag":671,"props":4361,"children":4362},{"style":690},[4363],{"type":382,"value":4364},"r.customerID, ",{"type":373,"tag":671,"props":4366,"children":4367},{"style":763},[4368],{"type":382,"value":2443},{"type":373,"tag":671,"props":4370,"children":4371},{"style":690},[4372],{"type":382,"value":4373},"r.eventType, ",{"type":373,"tag":671,"props":4375,"children":4376},{"style":763},[4377],{"type":382,"value":2443},{"type":373,"tag":671,"props":4379,"children":4380},{"style":690},[4381],{"type":382,"value":4382},"r.eventKey, ",{"type":373,"tag":671,"props":4384,"children":4385},{"style":763},[4386],{"type":382,"value":2443},{"type":373,"tag":671,"props":4388,"children":4389},{"style":690},[4390],{"type":382,"value":4391},"r.payload); err ",{"type":373,"tag":671,"props":4393,"children":4394},{"style":763},[4395],{"type":382,"value":1100},{"type":373,"tag":671,"props":4397,"children":4398},{"style":696},[4399],{"type":382,"value":1105},{"type":373,"tag":671,"props":4401,"children":4402},{"style":690},[4403],{"type":382,"value":1110},{"type":373,"tag":671,"props":4405,"children":4406},{"class":673,"line":2140},[4407,4412,4416],{"type":373,"tag":671,"props":4408,"children":4409},{"style":690},[4410],{"type":382,"value":4411},"            rows.",{"type":373,"tag":671,"props":4413,"children":4414},{"style":678},[4415],{"type":382,"value":3630},{"type":373,"tag":671,"props":4417,"children":4418},{"style":690},[4419],{"type":382,"value":3635},{"type":373,"tag":671,"props":4421,"children":4422},{"class":673,"line":2234},[4423,4427,4431],{"type":373,"tag":671,"props":4424,"children":4425},{"style":763},[4426],{"type":382,"value":2469},{"type":373,"tag":671,"props":4428,"children":4429},{"style":696},[4430],{"type":382,"value":3780},{"type":373,"tag":671,"props":4432,"children":4433},{"style":690},[4434],{"type":382,"value":4023},{"type":373,"tag":671,"props":4436,"children":4437},{"class":673,"line":2243},[4438],{"type":373,"tag":671,"props":4439,"children":4440},{"style":690},[4441],{"type":382,"value":1704},{"type":373,"tag":671,"props":4443,"children":4444},{"class":673,"line":2251},[4445,4450,4454,4459],{"type":373,"tag":671,"props":4446,"children":4447},{"style":690},[4448],{"type":382,"value":4449},"        batch ",{"type":373,"tag":671,"props":4451,"children":4452},{"style":763},[4453],{"type":382,"value":776},{"type":373,"tag":671,"props":4455,"children":4456},{"style":678},[4457],{"type":382,"value":4458}," append",{"type":373,"tag":671,"props":4460,"children":4461},{"style":690},[4462],{"type":382,"value":4463},"(batch, r)\n",{"type":373,"tag":671,"props":4465,"children":4466},{"class":673,"line":2268},[4467],{"type":373,"tag":671,"props":4468,"children":4469},{"style":690},[4470],{"type":382,"value":1138},{"type":373,"tag":671,"props":4472,"children":4473},{"class":673,"line":2285},[4474,4479,4483],{"type":373,"tag":671,"props":4475,"children":4476},{"style":690},[4477],{"type":382,"value":4478},"    rows.",{"type":373,"tag":671,"props":4480,"children":4481},{"style":678},[4482],{"type":382,"value":3630},{"type":373,"tag":671,"props":4484,"children":4485},{"style":690},[4486],{"type":382,"value":3635},{"type":373,"tag":671,"props":4488,"children":4489},{"class":673,"line":2367},[4490],{"type":373,"tag":671,"props":4491,"children":4492},{"emptyLinePlaceholder":753},[4493],{"type":382,"value":756},{"type":373,"tag":671,"props":4495,"children":4496},{"class":673,"line":2375},[4497,4501,4506,4510,4514],{"type":373,"tag":671,"props":4498,"children":4499},{"style":763},[4500],{"type":382,"value":2389},{"type":373,"tag":671,"props":4502,"children":4503},{"style":690},[4504],{"type":382,"value":4505}," _, r ",{"type":373,"tag":671,"props":4507,"children":4508},{"style":763},[4509],{"type":382,"value":1028},{"type":373,"tag":671,"props":4511,"children":4512},{"style":763},[4513],{"type":382,"value":2403},{"type":373,"tag":671,"props":4515,"children":4516},{"style":690},[4517],{"type":382,"value":4518}," batch {\n",{"type":373,"tag":671,"props":4520,"children":4521},{"class":673,"line":2383},[4522,4527,4531,4535,4540,4544,4548,4552,4556,4561],{"type":373,"tag":671,"props":4523,"children":4524},{"style":690},[4525],{"type":382,"value":4526},"        message, err ",{"type":373,"tag":671,"props":4528,"children":4529},{"style":763},[4530],{"type":382,"value":1028},{"type":373,"tag":671,"props":4532,"children":4533},{"style":690},[4534],{"type":382,"value":2430},{"type":373,"tag":671,"props":4536,"children":4537},{"style":678},[4538],{"type":382,"value":4539},"PublishOutboundMessage",{"type":373,"tag":671,"props":4541,"children":4542},{"style":690},[4543],{"type":382,"value":1053},{"type":373,"tag":671,"props":4545,"children":4546},{"style":763},[4547],{"type":382,"value":2443},{"type":373,"tag":671,"props":4549,"children":4550},{"style":678},[4551],{"type":382,"value":2033},{"type":373,"tag":671,"props":4553,"children":4554},{"style":690},[4555],{"type":382,"value":634},{"type":373,"tag":671,"props":4557,"children":4558},{"style":678},[4559],{"type":382,"value":4560},"OutboundMessagePublishOptions",{"type":373,"tag":671,"props":4562,"children":4563},{"style":690},[4564],{"type":382,"value":2091},{"type":373,"tag":671,"props":4566,"children":4567},{"class":673,"line":2411},[4568],{"type":373,"tag":671,"props":4569,"children":4570},{"style":690},[4571],{"type":382,"value":4572},"            Consumer:       r.customerID,\n",{"type":373,"tag":671,"props":4574,"children":4575},{"class":673,"line":2463},[4576],{"type":373,"tag":671,"props":4577,"children":4578},{"style":690},[4579],{"type":382,"value":4580},"            EventType:      r.eventType,\n",{"type":373,"tag":671,"props":4582,"children":4583},{"class":673,"line":2512},[4584],{"type":373,"tag":671,"props":4585,"children":4586},{"style":690},[4587],{"type":382,"value":4588},"            EventID:        r.eventKey,\n",{"type":373,"tag":671,"props":4590,"children":4591},{"class":673,"line":2520},[4592,4597],{"type":373,"tag":671,"props":4593,"children":4594},{"style":690},[4595],{"type":382,"value":4596},"            Payload:        r.payload, ",{"type":373,"tag":671,"props":4598,"children":4599},{"style":850},[4600],{"type":382,"value":4601},"// json.RawMessage is sent as-is, up to 256 KiB\n",{"type":373,"tag":671,"props":4603,"children":4604},{"class":673,"line":2528},[4605],{"type":373,"tag":671,"props":4606,"children":4607},{"style":690},[4608],{"type":382,"value":4609},"            IdempotencyKey: r.eventKey,\n",{"type":373,"tag":671,"props":4611,"children":4612},{"class":673,"line":2542},[4613],{"type":373,"tag":671,"props":4614,"children":4615},{"style":690},[4616],{"type":382,"value":4617},"        })\n",{"type":373,"tag":671,"props":4619,"children":4621},{"class":673,"line":4620},75,[4622,4626,4630,4634,4638],{"type":373,"tag":671,"props":4623,"children":4624},{"style":763},[4625],{"type":382,"value":1618},{"type":373,"tag":671,"props":4627,"children":4628},{"style":690},[4629],{"type":382,"value":1095},{"type":373,"tag":671,"props":4631,"children":4632},{"style":763},[4633],{"type":382,"value":1100},{"type":373,"tag":671,"props":4635,"children":4636},{"style":696},[4637],{"type":382,"value":1105},{"type":373,"tag":671,"props":4639,"children":4640},{"style":690},[4641],{"type":382,"value":1110},{"type":373,"tag":671,"props":4643,"children":4645},{"class":673,"line":4644},76,[4646],{"type":373,"tag":671,"props":4647,"children":4648},{"style":850},[4649],{"type":382,"value":4650},"            // Leave the row unpublished; the next batch retries it with the same key.\n",{"type":373,"tag":671,"props":4652,"children":4654},{"class":673,"line":4653},77,[4655,4659,4663,4668,4672,4676,4681,4685,4689,4693,4697],{"type":373,"tag":671,"props":4656,"children":4657},{"style":763},[4658],{"type":382,"value":2469},{"type":373,"tag":671,"props":4660,"children":4661},{"style":696},[4662],{"type":382,"value":3780},{"type":373,"tag":671,"props":4664,"children":4665},{"style":690},[4666],{"type":382,"value":4667},", fmt.",{"type":373,"tag":671,"props":4669,"children":4670},{"style":678},[4671],{"type":382,"value":1739},{"type":373,"tag":671,"props":4673,"children":4674},{"style":690},[4675],{"type":382,"value":1053},{"type":373,"tag":671,"props":4677,"children":4678},{"style":684},[4679],{"type":382,"value":4680},"\"publish ",{"type":373,"tag":671,"props":4682,"children":4683},{"style":696},[4684],{"type":382,"value":2491},{"type":373,"tag":671,"props":4686,"children":4687},{"style":684},[4688],{"type":382,"value":2185},{"type":373,"tag":671,"props":4690,"children":4691},{"style":696},[4692],{"type":382,"value":2500},{"type":373,"tag":671,"props":4694,"children":4695},{"style":684},[4696],{"type":382,"value":1758},{"type":373,"tag":671,"props":4698,"children":4699},{"style":690},[4700],{"type":382,"value":4701},", r.eventKey, err)\n",{"type":373,"tag":671,"props":4703,"children":4705},{"class":673,"line":4704},78,[4706],{"type":373,"tag":671,"props":4707,"children":4708},{"style":690},[4709],{"type":382,"value":1704},{"type":373,"tag":671,"props":4711,"children":4713},{"class":673,"line":4712},79,[4714,4718,4722,4726,4730,4735],{"type":373,"tag":671,"props":4715,"children":4716},{"style":763},[4717],{"type":382,"value":1618},{"type":373,"tag":671,"props":4719,"children":4720},{"style":690},[4721],{"type":382,"value":2421},{"type":373,"tag":671,"props":4723,"children":4724},{"style":763},[4725],{"type":382,"value":1028},{"type":373,"tag":671,"props":4727,"children":4728},{"style":690},[4729],{"type":382,"value":4042},{"type":373,"tag":671,"props":4731,"children":4732},{"style":678},[4733],{"type":382,"value":4734},"ExecContext",{"type":373,"tag":671,"props":4736,"children":4737},{"style":690},[4738],{"type":382,"value":4739},"(ctx,\n",{"type":373,"tag":671,"props":4741,"children":4743},{"class":673,"line":4742},80,[4744,4749],{"type":373,"tag":671,"props":4745,"children":4746},{"style":684},[4747],{"type":382,"value":4748},"            `UPDATE webhook_outbox SET published_at = now(), message_id = $1 WHERE id = $2`",{"type":373,"tag":671,"props":4750,"children":4751},{"style":690},[4752],{"type":382,"value":2119},{"type":373,"tag":671,"props":4754,"children":4756},{"class":673,"line":4755},81,[4757,4762,4766,4770],{"type":373,"tag":671,"props":4758,"children":4759},{"style":690},[4760],{"type":382,"value":4761},"            message.ID, r.id); err ",{"type":373,"tag":671,"props":4763,"children":4764},{"style":763},[4765],{"type":382,"value":1100},{"type":373,"tag":671,"props":4767,"children":4768},{"style":696},[4769],{"type":382,"value":1105},{"type":373,"tag":671,"props":4771,"children":4772},{"style":690},[4773],{"type":382,"value":1110},{"type":373,"tag":671,"props":4775,"children":4777},{"class":673,"line":4776},82,[4778,4782,4786],{"type":373,"tag":671,"props":4779,"children":4780},{"style":763},[4781],{"type":382,"value":2469},{"type":373,"tag":671,"props":4783,"children":4784},{"style":696},[4785],{"type":382,"value":3780},{"type":373,"tag":671,"props":4787,"children":4788},{"style":690},[4789],{"type":382,"value":4023},{"type":373,"tag":671,"props":4791,"children":4793},{"class":673,"line":4792},83,[4794],{"type":373,"tag":671,"props":4795,"children":4796},{"style":690},[4797],{"type":382,"value":1704},{"type":373,"tag":671,"props":4799,"children":4801},{"class":673,"line":4800},84,[4802],{"type":373,"tag":671,"props":4803,"children":4804},{"style":690},[4805],{"type":382,"value":1138},{"type":373,"tag":671,"props":4807,"children":4809},{"class":673,"line":4808},85,[4810,4814,4818,4823,4828],{"type":373,"tag":671,"props":4811,"children":4812},{"style":763},[4813],{"type":382,"value":2534},{"type":373,"tag":671,"props":4815,"children":4816},{"style":678},[4817],{"type":382,"value":1151},{"type":373,"tag":671,"props":4819,"children":4820},{"style":690},[4821],{"type":382,"value":4822},"(batch), tx.",{"type":373,"tag":671,"props":4824,"children":4825},{"style":678},[4826],{"type":382,"value":4827},"Commit",{"type":373,"tag":671,"props":4829,"children":4830},{"style":690},[4831],{"type":382,"value":3635},{"type":373,"tag":671,"props":4833,"children":4835},{"class":673,"line":4834},86,[4836],{"type":373,"tag":671,"props":4837,"children":4838},{"style":690},[4839],{"type":382,"value":1836},{"type":373,"tag":374,"props":4841,"children":4842},{},[4843,4845,4851,4853,4859,4861,4867,4869,4875],{"type":382,"value":4844},"If a customer has no consumer yet, publish returns a ",{"type":373,"tag":385,"props":4846,"children":4848},{"className":4847},[],[4849],{"type":382,"value":4850},"404",{"type":382,"value":4852}," error. Either create consumers when customers sign up, or skip events for customers who have not registered an endpoint. The Go client already retries ",{"type":373,"tag":385,"props":4854,"children":4856},{"className":4855},[],[4857],{"type":382,"value":4858},"429",{"type":382,"value":4860}," and ",{"type":373,"tag":385,"props":4862,"children":4864},{"className":4863},[],[4865],{"type":382,"value":4866},"5xx",{"type":382,"value":4868}," responses with backoff, and a ",{"type":373,"tag":385,"props":4870,"children":4872},{"className":4871},[],[4873],{"type":382,"value":4874},"409",{"type":382,"value":4876}," means the key was reused for a different payload, which is a bug worth alerting on.",{"type":373,"tag":565,"props":4878,"children":4880},{"id":4879},"_4-inspect-where-a-message-went",[4881],{"type":382,"value":4882},"4. Inspect where a message went",{"type":373,"tag":374,"props":4884,"children":4885},{},[4886,4892,4894,4900,4902,4908,4909,4915,4916,4922,4923,4929,4930,4936],{"type":373,"tag":385,"props":4887,"children":4889},{"className":4888},[],[4890],{"type":382,"value":4891},"GetOutboundMessage",{"type":382,"value":4893}," returns the payload and one delivery per addressed endpoint. ",{"type":373,"tag":385,"props":4895,"children":4897},{"className":4896},[],[4898],{"type":382,"value":4899},"ListOutboundDeliveries",{"type":382,"value":4901}," answers \"what did this endpoint receive?\" and filters by status (",{"type":373,"tag":385,"props":4903,"children":4905},{"className":4904},[],[4906],{"type":382,"value":4907},"sent",{"type":382,"value":1882},{"type":373,"tag":385,"props":4910,"children":4912},{"className":4911},[],[4913],{"type":382,"value":4914},"failed",{"type":382,"value":1882},{"type":373,"tag":385,"props":4917,"children":4919},{"className":4918},[],[4920],{"type":382,"value":4921},"stalled",{"type":382,"value":1882},{"type":373,"tag":385,"props":4924,"children":4926},{"className":4925},[],[4927],{"type":382,"value":4928},"received",{"type":382,"value":1882},{"type":373,"tag":385,"props":4931,"children":4933},{"className":4932},[],[4934],{"type":382,"value":4935},"rejected",{"type":382,"value":4937},"), event type or message.",{"type":373,"tag":661,"props":4939,"children":4941},{"className":839,"code":4940,"language":713,"meta":345,"style":345},"// inspect.go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/webhookrelay/webhookrelay-go\"\n)\n\nfunc inspect(api *webhookrelay.API, messageID string) error {\n    message, err := api.GetOutboundMessage(messageID)\n    if err != nil {\n        return err\n    }\n    fmt.Printf(\"%s %s for %s, addressed to %d endpoint(s)\\n\", message.ID, message.EventType, message.Consumer, len(message.EndpointIDs))\n    for _, d := range message.Deliveries {\n        fmt.Printf(\"  endpoint %s: %s, last status %d, retries %d\\n\", d.OutputID, d.Status, d.StatusCode, d.Retries)\n    }\n    if len(message.UnavailableEndpointIDs) > 0 {\n        fmt.Printf(\"  still loading: %v (ask again shortly)\\n\", message.UnavailableEndpointIDs)\n    }\n\n    // Recent failures on the first endpoint, for a support ticket.\n    if len(message.EndpointIDs) > 0 {\n        failed, err := api.ListOutboundDeliveries(&webhookrelay.OutboundDeliveryListOptions{\n            EndpointID: message.EndpointIDs[0],\n            Status:     string(webhookrelay.RequestStatusFailed),\n            Limit:      10,\n        })\n        if err != nil {\n            return err\n        }\n        fmt.Printf(\"  %d recent failed deliveries on %s\\n\", len(failed), message.EndpointIDs[0])\n    }\n    return nil\n}\n",[4942],{"type":373,"tag":385,"props":4943,"children":4944},{"__ignoreMap":345},[4945,4953,4964,4971,4982,4997,5004,5019,5026,5033,5093,5118,5141,5152,5159,5232,5257,5318,5325,5354,5396,5403,5410,5418,5446,5491,5508,5525,5542,5549,5572,5583,5590,5648,5655,5666],{"type":373,"tag":671,"props":4946,"children":4947},{"class":673,"line":674},[4948],{"type":373,"tag":671,"props":4949,"children":4950},{"style":850},[4951],{"type":382,"value":4952},"// inspect.go\n",{"type":373,"tag":671,"props":4954,"children":4955},{"class":673,"line":707},[4956,4960],{"type":373,"tag":671,"props":4957,"children":4958},{"style":763},[4959],{"type":382,"value":861},{"type":373,"tag":671,"props":4961,"children":4962},{"style":678},[4963],{"type":382,"value":866},{"type":373,"tag":671,"props":4965,"children":4966},{"class":673,"line":731},[4967],{"type":373,"tag":671,"props":4968,"children":4969},{"emptyLinePlaceholder":753},[4970],{"type":382,"value":756},{"type":373,"tag":671,"props":4972,"children":4973},{"class":673,"line":749},[4974,4978],{"type":373,"tag":671,"props":4975,"children":4976},{"style":763},[4977],{"type":382,"value":881},{"type":373,"tag":671,"props":4979,"children":4980},{"style":690},[4981],{"type":382,"value":886},{"type":373,"tag":671,"props":4983,"children":4984},{"class":673,"line":759},[4985,4989,4993],{"type":373,"tag":671,"props":4986,"children":4987},{"style":684},[4988],{"type":382,"value":894},{"type":373,"tag":671,"props":4990,"children":4991},{"style":678},[4992],{"type":382,"value":899},{"type":373,"tag":671,"props":4994,"children":4995},{"style":684},[4996],{"type":382,"value":904},{"type":373,"tag":671,"props":4998,"children":4999},{"class":673,"line":784},[5000],{"type":373,"tag":671,"props":5001,"children":5002},{"emptyLinePlaceholder":753},[5003],{"type":382,"value":756},{"type":373,"tag":671,"props":5005,"children":5006},{"class":673,"line":923},[5007,5011,5015],{"type":373,"tag":671,"props":5008,"children":5009},{"style":684},[5010],{"type":382,"value":894},{"type":373,"tag":671,"props":5012,"children":5013},{"style":678},[5014],{"type":382,"value":390},{"type":373,"tag":671,"props":5016,"children":5017},{"style":684},[5018],{"type":382,"value":904},{"type":373,"tag":671,"props":5020,"children":5021},{"class":673,"line":940},[5022],{"type":373,"tag":671,"props":5023,"children":5024},{"style":690},[5025],{"type":382,"value":987},{"type":373,"tag":671,"props":5027,"children":5028},{"class":673,"line":957},[5029],{"type":373,"tag":671,"props":5030,"children":5031},{"emptyLinePlaceholder":753},[5032],{"type":382,"value":756},{"type":373,"tag":671,"props":5034,"children":5035},{"class":673,"line":965},[5036,5040,5044,5048,5052,5056,5060,5064,5068,5072,5077,5081,5085,5089],{"type":373,"tag":671,"props":5037,"children":5038},{"style":763},[5039],{"type":382,"value":1004},{"type":373,"tag":671,"props":5041,"children":5042},{"style":678},[5043],{"type":382,"value":1495},{"type":373,"tag":671,"props":5045,"children":5046},{"style":690},[5047],{"type":382,"value":1053},{"type":373,"tag":671,"props":5049,"children":5050},{"style":1864},[5051],{"type":382,"value":2023},{"type":373,"tag":671,"props":5053,"children":5054},{"style":763},[5055],{"type":382,"value":2028},{"type":373,"tag":671,"props":5057,"children":5058},{"style":678},[5059],{"type":382,"value":2033},{"type":373,"tag":671,"props":5061,"children":5062},{"style":690},[5063],{"type":382,"value":634},{"type":373,"tag":671,"props":5065,"children":5066},{"style":678},[5067],{"type":382,"value":2042},{"type":373,"tag":671,"props":5069,"children":5070},{"style":690},[5071],{"type":382,"value":1882},{"type":373,"tag":671,"props":5073,"children":5074},{"style":1864},[5075],{"type":382,"value":5076},"messageID",{"type":373,"tag":671,"props":5078,"children":5079},{"style":763},[5080],{"type":382,"value":2744},{"type":373,"tag":671,"props":5082,"children":5083},{"style":690},[5084],{"type":382,"value":2047},{"type":373,"tag":671,"props":5086,"children":5087},{"style":763},[5088],{"type":382,"value":2052},{"type":373,"tag":671,"props":5090,"children":5091},{"style":690},[5092],{"type":382,"value":1110},{"type":373,"tag":671,"props":5094,"children":5095},{"class":673,"line":981},[5096,5101,5105,5109,5113],{"type":373,"tag":671,"props":5097,"children":5098},{"style":690},[5099],{"type":382,"value":5100},"    message, err ",{"type":373,"tag":671,"props":5102,"children":5103},{"style":763},[5104],{"type":382,"value":1028},{"type":373,"tag":671,"props":5106,"children":5107},{"style":690},[5108],{"type":382,"value":2430},{"type":373,"tag":671,"props":5110,"children":5111},{"style":678},[5112],{"type":382,"value":4891},{"type":373,"tag":671,"props":5114,"children":5115},{"style":690},[5116],{"type":382,"value":5117},"(messageID)\n",{"type":373,"tag":671,"props":5119,"children":5120},{"class":673,"line":990},[5121,5125,5129,5133,5137],{"type":373,"tag":671,"props":5122,"children":5123},{"style":763},[5124],{"type":382,"value":1090},{"type":373,"tag":671,"props":5126,"children":5127},{"style":690},[5128],{"type":382,"value":1095},{"type":373,"tag":671,"props":5130,"children":5131},{"style":763},[5132],{"type":382,"value":1100},{"type":373,"tag":671,"props":5134,"children":5135},{"style":696},[5136],{"type":382,"value":1105},{"type":373,"tag":671,"props":5138,"children":5139},{"style":690},[5140],{"type":382,"value":1110},{"type":373,"tag":671,"props":5142,"children":5143},{"class":673,"line":998},[5144,5148],{"type":373,"tag":671,"props":5145,"children":5146},{"style":763},[5147],{"type":382,"value":2826},{"type":373,"tag":671,"props":5149,"children":5150},{"style":690},[5151],{"type":382,"value":2831},{"type":373,"tag":671,"props":5153,"children":5154},{"class":673,"line":1017},[5155],{"type":373,"tag":671,"props":5156,"children":5157},{"style":690},[5158],{"type":382,"value":1138},{"type":373,"tag":671,"props":5160,"children":5161},{"class":673,"line":1084},[5162,5166,5170,5174,5178,5182,5187,5192,5196,5201,5205,5210,5214,5218,5223,5227],{"type":373,"tag":671,"props":5163,"children":5164},{"style":690},[5165],{"type":382,"value":3057},{"type":373,"tag":671,"props":5167,"children":5168},{"style":678},[5169],{"type":382,"value":3062},{"type":373,"tag":671,"props":5171,"children":5172},{"style":690},[5173],{"type":382,"value":1053},{"type":373,"tag":671,"props":5175,"children":5176},{"style":684},[5177],{"type":382,"value":1758},{"type":373,"tag":671,"props":5179,"children":5180},{"style":696},[5181],{"type":382,"value":2491},{"type":373,"tag":671,"props":5183,"children":5184},{"style":696},[5185],{"type":382,"value":5186}," %s",{"type":373,"tag":671,"props":5188,"children":5189},{"style":684},[5190],{"type":382,"value":5191}," for ",{"type":373,"tag":671,"props":5193,"children":5194},{"style":696},[5195],{"type":382,"value":2491},{"type":373,"tag":671,"props":5197,"children":5198},{"style":684},[5199],{"type":382,"value":5200},", addressed to ",{"type":373,"tag":671,"props":5202,"children":5203},{"style":696},[5204],{"type":382,"value":1950},{"type":373,"tag":671,"props":5206,"children":5207},{"style":684},[5208],{"type":382,"value":5209}," endpoint(s)",{"type":373,"tag":671,"props":5211,"children":5212},{"style":696},[5213],{"type":382,"value":3093},{"type":373,"tag":671,"props":5215,"children":5216},{"style":684},[5217],{"type":382,"value":1758},{"type":373,"tag":671,"props":5219,"children":5220},{"style":690},[5221],{"type":382,"value":5222},", message.ID, message.EventType, message.Consumer, ",{"type":373,"tag":671,"props":5224,"children":5225},{"style":678},[5226],{"type":382,"value":1973},{"type":373,"tag":671,"props":5228,"children":5229},{"style":690},[5230],{"type":382,"value":5231},"(message.EndpointIDs))\n",{"type":373,"tag":671,"props":5233,"children":5234},{"class":673,"line":1113},[5235,5239,5244,5248,5252],{"type":373,"tag":671,"props":5236,"children":5237},{"style":763},[5238],{"type":382,"value":2389},{"type":373,"tag":671,"props":5240,"children":5241},{"style":690},[5242],{"type":382,"value":5243}," _, d ",{"type":373,"tag":671,"props":5245,"children":5246},{"style":763},[5247],{"type":382,"value":1028},{"type":373,"tag":671,"props":5249,"children":5250},{"style":763},[5251],{"type":382,"value":2403},{"type":373,"tag":671,"props":5253,"children":5254},{"style":690},[5255],{"type":382,"value":5256}," message.Deliveries {\n",{"type":373,"tag":671,"props":5258,"children":5259},{"class":673,"line":1132},[5260,5265,5269,5273,5278,5282,5286,5290,5295,5299,5304,5309,5313],{"type":373,"tag":671,"props":5261,"children":5262},{"style":690},[5263],{"type":382,"value":5264},"        fmt.",{"type":373,"tag":671,"props":5266,"children":5267},{"style":678},[5268],{"type":382,"value":3062},{"type":373,"tag":671,"props":5270,"children":5271},{"style":690},[5272],{"type":382,"value":1053},{"type":373,"tag":671,"props":5274,"children":5275},{"style":684},[5276],{"type":382,"value":5277},"\"  endpoint ",{"type":373,"tag":671,"props":5279,"children":5280},{"style":696},[5281],{"type":382,"value":2491},{"type":373,"tag":671,"props":5283,"children":5284},{"style":684},[5285],{"type":382,"value":2185},{"type":373,"tag":671,"props":5287,"children":5288},{"style":696},[5289],{"type":382,"value":2491},{"type":373,"tag":671,"props":5291,"children":5292},{"style":684},[5293],{"type":382,"value":5294},", last status ",{"type":373,"tag":671,"props":5296,"children":5297},{"style":696},[5298],{"type":382,"value":1950},{"type":373,"tag":671,"props":5300,"children":5301},{"style":684},[5302],{"type":382,"value":5303},", retries ",{"type":373,"tag":671,"props":5305,"children":5306},{"style":696},[5307],{"type":382,"value":5308},"%d\\n",{"type":373,"tag":671,"props":5310,"children":5311},{"style":684},[5312],{"type":382,"value":1758},{"type":373,"tag":671,"props":5314,"children":5315},{"style":690},[5316],{"type":382,"value":5317},", d.OutputID, d.Status, d.StatusCode, d.Retries)\n",{"type":373,"tag":671,"props":5319,"children":5320},{"class":673,"line":1141},[5321],{"type":373,"tag":671,"props":5322,"children":5323},{"style":690},[5324],{"type":382,"value":1138},{"type":373,"tag":671,"props":5326,"children":5327},{"class":673,"line":1173},[5328,5332,5336,5341,5346,5350],{"type":373,"tag":671,"props":5329,"children":5330},{"style":763},[5331],{"type":382,"value":1090},{"type":373,"tag":671,"props":5333,"children":5334},{"style":678},[5335],{"type":382,"value":1151},{"type":373,"tag":671,"props":5337,"children":5338},{"style":690},[5339],{"type":382,"value":5340},"(message.UnavailableEndpointIDs) ",{"type":373,"tag":671,"props":5342,"children":5343},{"style":763},[5344],{"type":382,"value":5345},">",{"type":373,"tag":671,"props":5347,"children":5348},{"style":696},[5349],{"type":382,"value":3780},{"type":373,"tag":671,"props":5351,"children":5352},{"style":690},[5353],{"type":382,"value":1110},{"type":373,"tag":671,"props":5355,"children":5356},{"class":673,"line":1198},[5357,5361,5365,5369,5374,5378,5383,5387,5391],{"type":373,"tag":671,"props":5358,"children":5359},{"style":690},[5360],{"type":382,"value":5264},{"type":373,"tag":671,"props":5362,"children":5363},{"style":678},[5364],{"type":382,"value":3062},{"type":373,"tag":671,"props":5366,"children":5367},{"style":690},[5368],{"type":382,"value":1053},{"type":373,"tag":671,"props":5370,"children":5371},{"style":684},[5372],{"type":382,"value":5373},"\"  still loading: ",{"type":373,"tag":671,"props":5375,"children":5376},{"style":696},[5377],{"type":382,"value":3743},{"type":373,"tag":671,"props":5379,"children":5380},{"style":684},[5381],{"type":382,"value":5382}," (ask again shortly)",{"type":373,"tag":671,"props":5384,"children":5385},{"style":696},[5386],{"type":382,"value":3093},{"type":373,"tag":671,"props":5388,"children":5389},{"style":684},[5390],{"type":382,"value":1758},{"type":373,"tag":671,"props":5392,"children":5393},{"style":690},[5394],{"type":382,"value":5395},", message.UnavailableEndpointIDs)\n",{"type":373,"tag":671,"props":5397,"children":5398},{"class":673,"line":1206},[5399],{"type":373,"tag":671,"props":5400,"children":5401},{"style":690},[5402],{"type":382,"value":1138},{"type":373,"tag":671,"props":5404,"children":5405},{"class":673,"line":1214},[5406],{"type":373,"tag":671,"props":5407,"children":5408},{"emptyLinePlaceholder":753},[5409],{"type":382,"value":756},{"type":373,"tag":671,"props":5411,"children":5412},{"class":673,"line":1257},[5413],{"type":373,"tag":671,"props":5414,"children":5415},{"style":850},[5416],{"type":382,"value":5417},"    // Recent failures on the first endpoint, for a support ticket.\n",{"type":373,"tag":671,"props":5419,"children":5420},{"class":673,"line":1276},[5421,5425,5429,5434,5438,5442],{"type":373,"tag":671,"props":5422,"children":5423},{"style":763},[5424],{"type":382,"value":1090},{"type":373,"tag":671,"props":5426,"children":5427},{"style":678},[5428],{"type":382,"value":1151},{"type":373,"tag":671,"props":5430,"children":5431},{"style":690},[5432],{"type":382,"value":5433},"(message.EndpointIDs) ",{"type":373,"tag":671,"props":5435,"children":5436},{"style":763},[5437],{"type":382,"value":5345},{"type":373,"tag":671,"props":5439,"children":5440},{"style":696},[5441],{"type":382,"value":3780},{"type":373,"tag":671,"props":5443,"children":5444},{"style":690},[5445],{"type":382,"value":1110},{"type":373,"tag":671,"props":5447,"children":5448},{"class":673,"line":1299},[5449,5454,5458,5462,5466,5470,5474,5478,5482,5487],{"type":373,"tag":671,"props":5450,"children":5451},{"style":690},[5452],{"type":382,"value":5453},"        failed, err ",{"type":373,"tag":671,"props":5455,"children":5456},{"style":763},[5457],{"type":382,"value":1028},{"type":373,"tag":671,"props":5459,"children":5460},{"style":690},[5461],{"type":382,"value":2430},{"type":373,"tag":671,"props":5463,"children":5464},{"style":678},[5465],{"type":382,"value":4899},{"type":373,"tag":671,"props":5467,"children":5468},{"style":690},[5469],{"type":382,"value":1053},{"type":373,"tag":671,"props":5471,"children":5472},{"style":763},[5473],{"type":382,"value":2443},{"type":373,"tag":671,"props":5475,"children":5476},{"style":678},[5477],{"type":382,"value":2033},{"type":373,"tag":671,"props":5479,"children":5480},{"style":690},[5481],{"type":382,"value":634},{"type":373,"tag":671,"props":5483,"children":5484},{"style":678},[5485],{"type":382,"value":5486},"OutboundDeliveryListOptions",{"type":373,"tag":671,"props":5488,"children":5489},{"style":690},[5490],{"type":382,"value":2091},{"type":373,"tag":671,"props":5492,"children":5493},{"class":673,"line":1316},[5494,5499,5503],{"type":373,"tag":671,"props":5495,"children":5496},{"style":690},[5497],{"type":382,"value":5498},"            EndpointID: message.EndpointIDs[",{"type":373,"tag":671,"props":5500,"children":5501},{"style":696},[5502],{"type":382,"value":1363},{"type":373,"tag":671,"props":5504,"children":5505},{"style":690},[5506],{"type":382,"value":5507},"],\n",{"type":373,"tag":671,"props":5509,"children":5510},{"class":673,"line":1339},[5511,5516,5520],{"type":373,"tag":671,"props":5512,"children":5513},{"style":690},[5514],{"type":382,"value":5515},"            Status:     ",{"type":373,"tag":671,"props":5517,"children":5518},{"style":763},[5519],{"type":382,"value":1877},{"type":373,"tag":671,"props":5521,"children":5522},{"style":690},[5523],{"type":382,"value":5524},"(webhookrelay.RequestStatusFailed),\n",{"type":373,"tag":671,"props":5526,"children":5527},{"class":673,"line":1388},[5528,5533,5538],{"type":373,"tag":671,"props":5529,"children":5530},{"style":690},[5531],{"type":382,"value":5532},"            Limit:      ",{"type":373,"tag":671,"props":5534,"children":5535},{"style":696},[5536],{"type":382,"value":5537},"10",{"type":373,"tag":671,"props":5539,"children":5540},{"style":690},[5541],{"type":382,"value":2119},{"type":373,"tag":671,"props":5543,"children":5544},{"class":673,"line":1405},[5545],{"type":373,"tag":671,"props":5546,"children":5547},{"style":690},[5548],{"type":382,"value":4617},{"type":373,"tag":671,"props":5550,"children":5551},{"class":673,"line":1444},[5552,5556,5560,5564,5568],{"type":373,"tag":671,"props":5553,"children":5554},{"style":763},[5555],{"type":382,"value":1618},{"type":373,"tag":671,"props":5557,"children":5558},{"style":690},[5559],{"type":382,"value":1095},{"type":373,"tag":671,"props":5561,"children":5562},{"style":763},[5563],{"type":382,"value":1100},{"type":373,"tag":671,"props":5565,"children":5566},{"style":696},[5567],{"type":382,"value":1105},{"type":373,"tag":671,"props":5569,"children":5570},{"style":690},[5571],{"type":382,"value":1110},{"type":373,"tag":671,"props":5573,"children":5574},{"class":673,"line":1461},[5575,5579],{"type":373,"tag":671,"props":5576,"children":5577},{"style":763},[5578],{"type":382,"value":2469},{"type":373,"tag":671,"props":5580,"children":5581},{"style":690},[5582],{"type":382,"value":2831},{"type":373,"tag":671,"props":5584,"children":5585},{"class":673,"line":1481},[5586],{"type":373,"tag":671,"props":5587,"children":5588},{"style":690},[5589],{"type":382,"value":1704},{"type":373,"tag":671,"props":5591,"children":5592},{"class":673,"line":1510},[5593,5597,5601,5605,5610,5614,5619,5623,5627,5631,5635,5640,5644],{"type":373,"tag":671,"props":5594,"children":5595},{"style":690},[5596],{"type":382,"value":5264},{"type":373,"tag":671,"props":5598,"children":5599},{"style":678},[5600],{"type":382,"value":3062},{"type":373,"tag":671,"props":5602,"children":5603},{"style":690},[5604],{"type":382,"value":1053},{"type":373,"tag":671,"props":5606,"children":5607},{"style":684},[5608],{"type":382,"value":5609},"\"  ",{"type":373,"tag":671,"props":5611,"children":5612},{"style":696},[5613],{"type":382,"value":1950},{"type":373,"tag":671,"props":5615,"children":5616},{"style":684},[5617],{"type":382,"value":5618}," recent failed deliveries on ",{"type":373,"tag":671,"props":5620,"children":5621},{"style":696},[5622],{"type":382,"value":3103},{"type":373,"tag":671,"props":5624,"children":5625},{"style":684},[5626],{"type":382,"value":1758},{"type":373,"tag":671,"props":5628,"children":5629},{"style":690},[5630],{"type":382,"value":1882},{"type":373,"tag":671,"props":5632,"children":5633},{"style":678},[5634],{"type":382,"value":1973},{"type":373,"tag":671,"props":5636,"children":5637},{"style":690},[5638],{"type":382,"value":5639},"(failed), message.EndpointIDs[",{"type":373,"tag":671,"props":5641,"children":5642},{"style":696},[5643],{"type":382,"value":1363},{"type":373,"tag":671,"props":5645,"children":5646},{"style":690},[5647],{"type":382,"value":1385},{"type":373,"tag":671,"props":5649,"children":5650},{"class":673,"line":1527},[5651],{"type":373,"tag":671,"props":5652,"children":5653},{"style":690},[5654],{"type":382,"value":1138},{"type":373,"tag":671,"props":5656,"children":5657},{"class":673,"line":1548},[5658,5662],{"type":373,"tag":671,"props":5659,"children":5660},{"style":763},[5661],{"type":382,"value":2534},{"type":373,"tag":671,"props":5663,"children":5664},{"style":696},[5665],{"type":382,"value":2539},{"type":373,"tag":671,"props":5667,"children":5668},{"class":673,"line":1565},[5669],{"type":373,"tag":671,"props":5670,"children":5671},{"style":690},[5672],{"type":382,"value":1836},{"type":373,"tag":565,"props":5674,"children":5676},{"id":5675},"_5-report-failing-endpoints-and-recover-after-an-outage",[5677],{"type":382,"value":5678},"5. Report failing endpoints and recover after an outage",{"type":373,"tag":374,"props":5680,"children":5681},{},[5682,5684,5690,5692,5698,5700,5705],{"type":382,"value":5683},"An endpoint becomes ",{"type":373,"tag":385,"props":5685,"children":5687},{"className":5686},[],[5688],{"type":382,"value":5689},"failing",{"type":382,"value":5691}," after 5 failed attempts in a row or one exhausted delivery; a ",{"type":373,"tag":385,"props":5693,"children":5695},{"className":5694},[],[5696],{"type":382,"value":5697},"410 Gone",{"type":382,"value":5699}," response disables it. Run ",{"type":373,"tag":385,"props":5701,"children":5703},{"className":5702},[],[5704],{"type":382,"value":5689},{"type":382,"value":5706}," from a cron job and tell the customer before they notice.",{"type":373,"tag":661,"props":5708,"children":5710},{"className":839,"code":5709,"language":713,"meta":345,"style":345},"// health.go\npackage main\n\nimport (\n    \"fmt\"\n    \"time\"\n\n    \"github.com/webhookrelay/webhookrelay-go\"\n)\n\nfunc failing(api *webhookrelay.API) error {\n    health, err := api.GetOutboundHealth()\n    if err != nil {\n        return err\n    }\n    fmt.Printf(\"since %s: %d attempts, %d failures; endpoints by state: %v\\n\",\n        health.Since.Format(time.RFC3339), health.Stats.Attempts, health.Stats.Failures, health.Endpoints)\n    if health.Endpoints[webhookrelay.OutboundEndpointStateFailing] == 0 {\n        return nil\n    }\n    endpoints, err := api.ListAllOutboundEndpoints(&webhookrelay.OutboundEndpointListOptions{\n        State: webhookrelay.OutboundEndpointStateFailing,\n        Limit: 20,\n    })\n    if err != nil {\n        return err\n    }\n    for _, e := range endpoints {\n        var failures int64\n        if e.Stats != nil {\n            failures = e.Stats.Failures\n        }\n        fmt.Printf(\"%s %s failing since %v, %d failures in 24h\\n\", e.Consumer, e.URL, e.FailingSince, failures)\n    }\n    return nil\n}\n\n// recoverSince re-sends deliveries whose retries ran out since the outage began.\n// Every copy keeps its original webhook-id, so deduplicating receivers stay correct.\nfunc recoverSince(api *webhookrelay.API, endpointID string, since time.Time) error {\n    task, err := api.RecoverOutboundDeliveries(endpointID, since)\n    if err != nil {\n        return err\n    }\n    for task.Status == \"pending\" || task.Status == \"running\" {\n        time.Sleep(2 * time.Second)\n        if task, err = api.GetOutboundRecoveryTask(task.ID); err != nil {\n            return err\n        }\n    }\n    fmt.Printf(\"recovery %s: %s, %d deliveries re-sent %s\\n\", task.ID, task.Status, task.Processed, task.Error)\n    return nil\n}\n",[5711],{"type":373,"tag":385,"props":5712,"children":5713},{"__ignoreMap":345},[5714,5722,5733,5740,5751,5766,5781,5788,5803,5810,5817,5864,5889,5912,5923,5930,5989,6007,6031,6042,6049,6095,6103,6120,6127,6150,6161,6168,6193,6209,6233,6250,6257,6319,6326,6337,6344,6351,6359,6367,6450,6476,6499,6510,6517,6560,6589,6631,6642,6649,6656,6714,6725],{"type":373,"tag":671,"props":5715,"children":5716},{"class":673,"line":674},[5717],{"type":373,"tag":671,"props":5718,"children":5719},{"style":850},[5720],{"type":382,"value":5721},"// health.go\n",{"type":373,"tag":671,"props":5723,"children":5724},{"class":673,"line":707},[5725,5729],{"type":373,"tag":671,"props":5726,"children":5727},{"style":763},[5728],{"type":382,"value":861},{"type":373,"tag":671,"props":5730,"children":5731},{"style":678},[5732],{"type":382,"value":866},{"type":373,"tag":671,"props":5734,"children":5735},{"class":673,"line":731},[5736],{"type":373,"tag":671,"props":5737,"children":5738},{"emptyLinePlaceholder":753},[5739],{"type":382,"value":756},{"type":373,"tag":671,"props":5741,"children":5742},{"class":673,"line":749},[5743,5747],{"type":373,"tag":671,"props":5744,"children":5745},{"style":763},[5746],{"type":382,"value":881},{"type":373,"tag":671,"props":5748,"children":5749},{"style":690},[5750],{"type":382,"value":886},{"type":373,"tag":671,"props":5752,"children":5753},{"class":673,"line":759},[5754,5758,5762],{"type":373,"tag":671,"props":5755,"children":5756},{"style":684},[5757],{"type":382,"value":894},{"type":373,"tag":671,"props":5759,"children":5760},{"style":678},[5761],{"type":382,"value":899},{"type":373,"tag":671,"props":5763,"children":5764},{"style":684},[5765],{"type":382,"value":904},{"type":373,"tag":671,"props":5767,"children":5768},{"class":673,"line":784},[5769,5773,5777],{"type":373,"tag":671,"props":5770,"children":5771},{"style":684},[5772],{"type":382,"value":894},{"type":373,"tag":671,"props":5774,"children":5775},{"style":678},[5776],{"type":382,"value":950},{"type":373,"tag":671,"props":5778,"children":5779},{"style":684},[5780],{"type":382,"value":904},{"type":373,"tag":671,"props":5782,"children":5783},{"class":673,"line":923},[5784],{"type":373,"tag":671,"props":5785,"children":5786},{"emptyLinePlaceholder":753},[5787],{"type":382,"value":756},{"type":373,"tag":671,"props":5789,"children":5790},{"class":673,"line":940},[5791,5795,5799],{"type":373,"tag":671,"props":5792,"children":5793},{"style":684},[5794],{"type":382,"value":894},{"type":373,"tag":671,"props":5796,"children":5797},{"style":678},[5798],{"type":382,"value":390},{"type":373,"tag":671,"props":5800,"children":5801},{"style":684},[5802],{"type":382,"value":904},{"type":373,"tag":671,"props":5804,"children":5805},{"class":673,"line":957},[5806],{"type":373,"tag":671,"props":5807,"children":5808},{"style":690},[5809],{"type":382,"value":987},{"type":373,"tag":671,"props":5811,"children":5812},{"class":673,"line":965},[5813],{"type":373,"tag":671,"props":5814,"children":5815},{"emptyLinePlaceholder":753},[5816],{"type":382,"value":756},{"type":373,"tag":671,"props":5818,"children":5819},{"class":673,"line":981},[5820,5824,5828,5832,5836,5840,5844,5848,5852,5856,5860],{"type":373,"tag":671,"props":5821,"children":5822},{"style":763},[5823],{"type":382,"value":1004},{"type":373,"tag":671,"props":5825,"children":5826},{"style":678},[5827],{"type":382,"value":1541},{"type":373,"tag":671,"props":5829,"children":5830},{"style":690},[5831],{"type":382,"value":1053},{"type":373,"tag":671,"props":5833,"children":5834},{"style":1864},[5835],{"type":382,"value":2023},{"type":373,"tag":671,"props":5837,"children":5838},{"style":763},[5839],{"type":382,"value":2028},{"type":373,"tag":671,"props":5841,"children":5842},{"style":678},[5843],{"type":382,"value":2033},{"type":373,"tag":671,"props":5845,"children":5846},{"style":690},[5847],{"type":382,"value":634},{"type":373,"tag":671,"props":5849,"children":5850},{"style":678},[5851],{"type":382,"value":2042},{"type":373,"tag":671,"props":5853,"children":5854},{"style":690},[5855],{"type":382,"value":2047},{"type":373,"tag":671,"props":5857,"children":5858},{"style":763},[5859],{"type":382,"value":2052},{"type":373,"tag":671,"props":5861,"children":5862},{"style":690},[5863],{"type":382,"value":1110},{"type":373,"tag":671,"props":5865,"children":5866},{"class":673,"line":990},[5867,5872,5876,5880,5885],{"type":373,"tag":671,"props":5868,"children":5869},{"style":690},[5870],{"type":382,"value":5871},"    health, err ",{"type":373,"tag":671,"props":5873,"children":5874},{"style":763},[5875],{"type":382,"value":1028},{"type":373,"tag":671,"props":5877,"children":5878},{"style":690},[5879],{"type":382,"value":2430},{"type":373,"tag":671,"props":5881,"children":5882},{"style":678},[5883],{"type":382,"value":5884},"GetOutboundHealth",{"type":373,"tag":671,"props":5886,"children":5887},{"style":690},[5888],{"type":382,"value":3635},{"type":373,"tag":671,"props":5890,"children":5891},{"class":673,"line":998},[5892,5896,5900,5904,5908],{"type":373,"tag":671,"props":5893,"children":5894},{"style":763},[5895],{"type":382,"value":1090},{"type":373,"tag":671,"props":5897,"children":5898},{"style":690},[5899],{"type":382,"value":1095},{"type":373,"tag":671,"props":5901,"children":5902},{"style":763},[5903],{"type":382,"value":1100},{"type":373,"tag":671,"props":5905,"children":5906},{"style":696},[5907],{"type":382,"value":1105},{"type":373,"tag":671,"props":5909,"children":5910},{"style":690},[5911],{"type":382,"value":1110},{"type":373,"tag":671,"props":5913,"children":5914},{"class":673,"line":1017},[5915,5919],{"type":373,"tag":671,"props":5916,"children":5917},{"style":763},[5918],{"type":382,"value":2826},{"type":373,"tag":671,"props":5920,"children":5921},{"style":690},[5922],{"type":382,"value":2831},{"type":373,"tag":671,"props":5924,"children":5925},{"class":673,"line":1084},[5926],{"type":373,"tag":671,"props":5927,"children":5928},{"style":690},[5929],{"type":382,"value":1138},{"type":373,"tag":671,"props":5931,"children":5932},{"class":673,"line":1113},[5933,5937,5941,5945,5950,5954,5958,5962,5967,5971,5976,5981,5985],{"type":373,"tag":671,"props":5934,"children":5935},{"style":690},[5936],{"type":382,"value":3057},{"type":373,"tag":671,"props":5938,"children":5939},{"style":678},[5940],{"type":382,"value":3062},{"type":373,"tag":671,"props":5942,"children":5943},{"style":690},[5944],{"type":382,"value":1053},{"type":373,"tag":671,"props":5946,"children":5947},{"style":684},[5948],{"type":382,"value":5949},"\"since ",{"type":373,"tag":671,"props":5951,"children":5952},{"style":696},[5953],{"type":382,"value":2491},{"type":373,"tag":671,"props":5955,"children":5956},{"style":684},[5957],{"type":382,"value":2185},{"type":373,"tag":671,"props":5959,"children":5960},{"style":696},[5961],{"type":382,"value":1950},{"type":373,"tag":671,"props":5963,"children":5964},{"style":684},[5965],{"type":382,"value":5966}," attempts, ",{"type":373,"tag":671,"props":5968,"children":5969},{"style":696},[5970],{"type":382,"value":1950},{"type":373,"tag":671,"props":5972,"children":5973},{"style":684},[5974],{"type":382,"value":5975}," failures; endpoints by state: ",{"type":373,"tag":671,"props":5977,"children":5978},{"style":696},[5979],{"type":382,"value":5980},"%v\\n",{"type":373,"tag":671,"props":5982,"children":5983},{"style":684},[5984],{"type":382,"value":1758},{"type":373,"tag":671,"props":5986,"children":5987},{"style":690},[5988],{"type":382,"value":2119},{"type":373,"tag":671,"props":5990,"children":5991},{"class":673,"line":1132},[5992,5997,6002],{"type":373,"tag":671,"props":5993,"children":5994},{"style":690},[5995],{"type":382,"value":5996},"        health.Since.",{"type":373,"tag":671,"props":5998,"children":5999},{"style":678},[6000],{"type":382,"value":6001},"Format",{"type":373,"tag":671,"props":6003,"children":6004},{"style":690},[6005],{"type":382,"value":6006},"(time.RFC3339), health.Stats.Attempts, health.Stats.Failures, health.Endpoints)\n",{"type":373,"tag":671,"props":6008,"children":6009},{"class":673,"line":1141},[6010,6014,6019,6023,6027],{"type":373,"tag":671,"props":6011,"children":6012},{"style":763},[6013],{"type":382,"value":1090},{"type":373,"tag":671,"props":6015,"children":6016},{"style":690},[6017],{"type":382,"value":6018}," health.Endpoints[webhookrelay.OutboundEndpointStateFailing] ",{"type":373,"tag":671,"props":6020,"children":6021},{"style":763},[6022],{"type":382,"value":1656},{"type":373,"tag":671,"props":6024,"children":6025},{"style":696},[6026],{"type":382,"value":3780},{"type":373,"tag":671,"props":6028,"children":6029},{"style":690},[6030],{"type":382,"value":1110},{"type":373,"tag":671,"props":6032,"children":6033},{"class":673,"line":1173},[6034,6038],{"type":373,"tag":671,"props":6035,"children":6036},{"style":763},[6037],{"type":382,"value":2826},{"type":373,"tag":671,"props":6039,"children":6040},{"style":696},[6041],{"type":382,"value":2539},{"type":373,"tag":671,"props":6043,"children":6044},{"class":673,"line":1198},[6045],{"type":373,"tag":671,"props":6046,"children":6047},{"style":690},[6048],{"type":382,"value":1138},{"type":373,"tag":671,"props":6050,"children":6051},{"class":673,"line":1206},[6052,6057,6061,6065,6070,6074,6078,6082,6086,6091],{"type":373,"tag":671,"props":6053,"children":6054},{"style":690},[6055],{"type":382,"value":6056},"    endpoints, err ",{"type":373,"tag":671,"props":6058,"children":6059},{"style":763},[6060],{"type":382,"value":1028},{"type":373,"tag":671,"props":6062,"children":6063},{"style":690},[6064],{"type":382,"value":2430},{"type":373,"tag":671,"props":6066,"children":6067},{"style":678},[6068],{"type":382,"value":6069},"ListAllOutboundEndpoints",{"type":373,"tag":671,"props":6071,"children":6072},{"style":690},[6073],{"type":382,"value":1053},{"type":373,"tag":671,"props":6075,"children":6076},{"style":763},[6077],{"type":382,"value":2443},{"type":373,"tag":671,"props":6079,"children":6080},{"style":678},[6081],{"type":382,"value":2033},{"type":373,"tag":671,"props":6083,"children":6084},{"style":690},[6085],{"type":382,"value":634},{"type":373,"tag":671,"props":6087,"children":6088},{"style":678},[6089],{"type":382,"value":6090},"OutboundEndpointListOptions",{"type":373,"tag":671,"props":6092,"children":6093},{"style":690},[6094],{"type":382,"value":2091},{"type":373,"tag":671,"props":6096,"children":6097},{"class":673,"line":1214},[6098],{"type":373,"tag":671,"props":6099,"children":6100},{"style":690},[6101],{"type":382,"value":6102},"        State: webhookrelay.OutboundEndpointStateFailing,\n",{"type":373,"tag":671,"props":6104,"children":6105},{"class":673,"line":1257},[6106,6111,6116],{"type":373,"tag":671,"props":6107,"children":6108},{"style":690},[6109],{"type":382,"value":6110},"        Limit: ",{"type":373,"tag":671,"props":6112,"children":6113},{"style":696},[6114],{"type":382,"value":6115},"20",{"type":373,"tag":671,"props":6117,"children":6118},{"style":690},[6119],{"type":382,"value":2119},{"type":373,"tag":671,"props":6121,"children":6122},{"class":673,"line":1276},[6123],{"type":373,"tag":671,"props":6124,"children":6125},{"style":690},[6126],{"type":382,"value":3008},{"type":373,"tag":671,"props":6128,"children":6129},{"class":673,"line":1299},[6130,6134,6138,6142,6146],{"type":373,"tag":671,"props":6131,"children":6132},{"style":763},[6133],{"type":382,"value":1090},{"type":373,"tag":671,"props":6135,"children":6136},{"style":690},[6137],{"type":382,"value":1095},{"type":373,"tag":671,"props":6139,"children":6140},{"style":763},[6141],{"type":382,"value":1100},{"type":373,"tag":671,"props":6143,"children":6144},{"style":696},[6145],{"type":382,"value":1105},{"type":373,"tag":671,"props":6147,"children":6148},{"style":690},[6149],{"type":382,"value":1110},{"type":373,"tag":671,"props":6151,"children":6152},{"class":673,"line":1316},[6153,6157],{"type":373,"tag":671,"props":6154,"children":6155},{"style":763},[6156],{"type":382,"value":2826},{"type":373,"tag":671,"props":6158,"children":6159},{"style":690},[6160],{"type":382,"value":2831},{"type":373,"tag":671,"props":6162,"children":6163},{"class":673,"line":1339},[6164],{"type":373,"tag":671,"props":6165,"children":6166},{"style":690},[6167],{"type":382,"value":1138},{"type":373,"tag":671,"props":6169,"children":6170},{"class":673,"line":1388},[6171,6175,6180,6184,6188],{"type":373,"tag":671,"props":6172,"children":6173},{"style":763},[6174],{"type":382,"value":2389},{"type":373,"tag":671,"props":6176,"children":6177},{"style":690},[6178],{"type":382,"value":6179}," _, e ",{"type":373,"tag":671,"props":6181,"children":6182},{"style":763},[6183],{"type":382,"value":1028},{"type":373,"tag":671,"props":6185,"children":6186},{"style":763},[6187],{"type":382,"value":2403},{"type":373,"tag":671,"props":6189,"children":6190},{"style":690},[6191],{"type":382,"value":6192}," endpoints {\n",{"type":373,"tag":671,"props":6194,"children":6195},{"class":673,"line":1405},[6196,6200,6205],{"type":373,"tag":671,"props":6197,"children":6198},{"style":763},[6199],{"type":382,"value":1591},{"type":373,"tag":671,"props":6201,"children":6202},{"style":690},[6203],{"type":382,"value":6204}," failures ",{"type":373,"tag":671,"props":6206,"children":6207},{"style":763},[6208],{"type":382,"value":4221},{"type":373,"tag":671,"props":6210,"children":6211},{"class":673,"line":1444},[6212,6216,6221,6225,6229],{"type":373,"tag":671,"props":6213,"children":6214},{"style":763},[6215],{"type":382,"value":1618},{"type":373,"tag":671,"props":6217,"children":6218},{"style":690},[6219],{"type":382,"value":6220}," e.Stats ",{"type":373,"tag":671,"props":6222,"children":6223},{"style":763},[6224],{"type":382,"value":1100},{"type":373,"tag":671,"props":6226,"children":6227},{"style":696},[6228],{"type":382,"value":1105},{"type":373,"tag":671,"props":6230,"children":6231},{"style":690},[6232],{"type":382,"value":1110},{"type":373,"tag":671,"props":6234,"children":6235},{"class":673,"line":1461},[6236,6241,6245],{"type":373,"tag":671,"props":6237,"children":6238},{"style":690},[6239],{"type":382,"value":6240},"            failures ",{"type":373,"tag":671,"props":6242,"children":6243},{"style":763},[6244],{"type":382,"value":776},{"type":373,"tag":671,"props":6246,"children":6247},{"style":690},[6248],{"type":382,"value":6249}," e.Stats.Failures\n",{"type":373,"tag":671,"props":6251,"children":6252},{"class":673,"line":1481},[6253],{"type":373,"tag":671,"props":6254,"children":6255},{"style":690},[6256],{"type":382,"value":1704},{"type":373,"tag":671,"props":6258,"children":6259},{"class":673,"line":1510},[6260,6264,6268,6272,6276,6280,6284,6289,6293,6297,6301,6306,6310,6314],{"type":373,"tag":671,"props":6261,"children":6262},{"style":690},[6263],{"type":382,"value":5264},{"type":373,"tag":671,"props":6265,"children":6266},{"style":678},[6267],{"type":382,"value":3062},{"type":373,"tag":671,"props":6269,"children":6270},{"style":690},[6271],{"type":382,"value":1053},{"type":373,"tag":671,"props":6273,"children":6274},{"style":684},[6275],{"type":382,"value":1758},{"type":373,"tag":671,"props":6277,"children":6278},{"style":696},[6279],{"type":382,"value":2491},{"type":373,"tag":671,"props":6281,"children":6282},{"style":696},[6283],{"type":382,"value":5186},{"type":373,"tag":671,"props":6285,"children":6286},{"style":684},[6287],{"type":382,"value":6288}," failing since ",{"type":373,"tag":671,"props":6290,"children":6291},{"style":696},[6292],{"type":382,"value":3743},{"type":373,"tag":671,"props":6294,"children":6295},{"style":684},[6296],{"type":382,"value":1882},{"type":373,"tag":671,"props":6298,"children":6299},{"style":696},[6300],{"type":382,"value":1950},{"type":373,"tag":671,"props":6302,"children":6303},{"style":684},[6304],{"type":382,"value":6305}," failures in 24h",{"type":373,"tag":671,"props":6307,"children":6308},{"style":696},[6309],{"type":382,"value":3093},{"type":373,"tag":671,"props":6311,"children":6312},{"style":684},[6313],{"type":382,"value":1758},{"type":373,"tag":671,"props":6315,"children":6316},{"style":690},[6317],{"type":382,"value":6318},", e.Consumer, e.URL, e.FailingSince, failures)\n",{"type":373,"tag":671,"props":6320,"children":6321},{"class":673,"line":1527},[6322],{"type":373,"tag":671,"props":6323,"children":6324},{"style":690},[6325],{"type":382,"value":1138},{"type":373,"tag":671,"props":6327,"children":6328},{"class":673,"line":1548},[6329,6333],{"type":373,"tag":671,"props":6330,"children":6331},{"style":763},[6332],{"type":382,"value":2534},{"type":373,"tag":671,"props":6334,"children":6335},{"style":696},[6336],{"type":382,"value":2539},{"type":373,"tag":671,"props":6338,"children":6339},{"class":673,"line":1565},[6340],{"type":373,"tag":671,"props":6341,"children":6342},{"style":690},[6343],{"type":382,"value":1836},{"type":373,"tag":671,"props":6345,"children":6346},{"class":673,"line":1585},[6347],{"type":373,"tag":671,"props":6348,"children":6349},{"emptyLinePlaceholder":753},[6350],{"type":382,"value":756},{"type":373,"tag":671,"props":6352,"children":6353},{"class":673,"line":1612},[6354],{"type":373,"tag":671,"props":6355,"children":6356},{"style":850},[6357],{"type":382,"value":6358},"// recoverSince re-sends deliveries whose retries ran out since the outage began.\n",{"type":373,"tag":671,"props":6360,"children":6361},{"class":673,"line":1667},[6362],{"type":373,"tag":671,"props":6363,"children":6364},{"style":850},[6365],{"type":382,"value":6366},"// Every copy keeps its original webhook-id, so deduplicating receivers stay correct.\n",{"type":373,"tag":671,"props":6368,"children":6369},{"class":673,"line":1698},[6370,6374,6378,6382,6386,6390,6394,6398,6402,6406,6411,6415,6419,6424,6429,6433,6438,6442,6446],{"type":373,"tag":671,"props":6371,"children":6372},{"style":763},[6373],{"type":382,"value":1004},{"type":373,"tag":671,"props":6375,"children":6376},{"style":678},[6377],{"type":382,"value":1682},{"type":373,"tag":671,"props":6379,"children":6380},{"style":690},[6381],{"type":382,"value":1053},{"type":373,"tag":671,"props":6383,"children":6384},{"style":1864},[6385],{"type":382,"value":2023},{"type":373,"tag":671,"props":6387,"children":6388},{"style":763},[6389],{"type":382,"value":2028},{"type":373,"tag":671,"props":6391,"children":6392},{"style":678},[6393],{"type":382,"value":2033},{"type":373,"tag":671,"props":6395,"children":6396},{"style":690},[6397],{"type":382,"value":634},{"type":373,"tag":671,"props":6399,"children":6400},{"style":678},[6401],{"type":382,"value":2042},{"type":373,"tag":671,"props":6403,"children":6404},{"style":690},[6405],{"type":382,"value":1882},{"type":373,"tag":671,"props":6407,"children":6408},{"style":1864},[6409],{"type":382,"value":6410},"endpointID",{"type":373,"tag":671,"props":6412,"children":6413},{"style":763},[6414],{"type":382,"value":2744},{"type":373,"tag":671,"props":6416,"children":6417},{"style":690},[6418],{"type":382,"value":1882},{"type":373,"tag":671,"props":6420,"children":6421},{"style":1864},[6422],{"type":382,"value":6423},"since",{"type":373,"tag":671,"props":6425,"children":6426},{"style":678},[6427],{"type":382,"value":6428}," time",{"type":373,"tag":671,"props":6430,"children":6431},{"style":690},[6432],{"type":382,"value":634},{"type":373,"tag":671,"props":6434,"children":6435},{"style":678},[6436],{"type":382,"value":6437},"Time",{"type":373,"tag":671,"props":6439,"children":6440},{"style":690},[6441],{"type":382,"value":2047},{"type":373,"tag":671,"props":6443,"children":6444},{"style":763},[6445],{"type":382,"value":2052},{"type":373,"tag":671,"props":6447,"children":6448},{"style":690},[6449],{"type":382,"value":1110},{"type":373,"tag":671,"props":6451,"children":6452},{"class":673,"line":1707},[6453,6458,6462,6466,6471],{"type":373,"tag":671,"props":6454,"children":6455},{"style":690},[6456],{"type":382,"value":6457},"    task, err ",{"type":373,"tag":671,"props":6459,"children":6460},{"style":763},[6461],{"type":382,"value":1028},{"type":373,"tag":671,"props":6463,"children":6464},{"style":690},[6465],{"type":382,"value":2430},{"type":373,"tag":671,"props":6467,"children":6468},{"style":678},[6469],{"type":382,"value":6470},"RecoverOutboundDeliveries",{"type":373,"tag":671,"props":6472,"children":6473},{"style":690},[6474],{"type":382,"value":6475},"(endpointID, since)\n",{"type":373,"tag":671,"props":6477,"children":6478},{"class":673,"line":1720},[6479,6483,6487,6491,6495],{"type":373,"tag":671,"props":6480,"children":6481},{"style":763},[6482],{"type":382,"value":1090},{"type":373,"tag":671,"props":6484,"children":6485},{"style":690},[6486],{"type":382,"value":1095},{"type":373,"tag":671,"props":6488,"children":6489},{"style":763},[6490],{"type":382,"value":1100},{"type":373,"tag":671,"props":6492,"children":6493},{"style":696},[6494],{"type":382,"value":1105},{"type":373,"tag":671,"props":6496,"children":6497},{"style":690},[6498],{"type":382,"value":1110},{"type":373,"tag":671,"props":6500,"children":6501},{"class":673,"line":1774},[6502,6506],{"type":373,"tag":671,"props":6503,"children":6504},{"style":763},[6505],{"type":382,"value":2826},{"type":373,"tag":671,"props":6507,"children":6508},{"style":690},[6509],{"type":382,"value":2831},{"type":373,"tag":671,"props":6511,"children":6512},{"class":673,"line":1782},[6513],{"type":373,"tag":671,"props":6514,"children":6515},{"style":690},[6516],{"type":382,"value":1138},{"type":373,"tag":671,"props":6518,"children":6519},{"class":673,"line":1806},[6520,6524,6529,6533,6538,6543,6547,6551,6556],{"type":373,"tag":671,"props":6521,"children":6522},{"style":763},[6523],{"type":382,"value":2389},{"type":373,"tag":671,"props":6525,"children":6526},{"style":690},[6527],{"type":382,"value":6528}," task.Status ",{"type":373,"tag":671,"props":6530,"children":6531},{"style":763},[6532],{"type":382,"value":1656},{"type":373,"tag":671,"props":6534,"children":6535},{"style":684},[6536],{"type":382,"value":6537}," \"pending\"",{"type":373,"tag":671,"props":6539,"children":6540},{"style":763},[6541],{"type":382,"value":6542}," ||",{"type":373,"tag":671,"props":6544,"children":6545},{"style":690},[6546],{"type":382,"value":6528},{"type":373,"tag":671,"props":6548,"children":6549},{"style":763},[6550],{"type":382,"value":1656},{"type":373,"tag":671,"props":6552,"children":6553},{"style":684},[6554],{"type":382,"value":6555}," \"running\"",{"type":373,"tag":671,"props":6557,"children":6558},{"style":690},[6559],{"type":382,"value":1110},{"type":373,"tag":671,"props":6561,"children":6562},{"class":673,"line":1822},[6563,6568,6572,6576,6580,6584],{"type":373,"tag":671,"props":6564,"children":6565},{"style":690},[6566],{"type":382,"value":6567},"        time.",{"type":373,"tag":671,"props":6569,"children":6570},{"style":678},[6571],{"type":382,"value":3797},{"type":373,"tag":671,"props":6573,"children":6574},{"style":690},[6575],{"type":382,"value":1053},{"type":373,"tag":671,"props":6577,"children":6578},{"style":696},[6579],{"type":382,"value":1239},{"type":373,"tag":671,"props":6581,"children":6582},{"style":763},[6583],{"type":382,"value":2028},{"type":373,"tag":671,"props":6585,"children":6586},{"style":690},[6587],{"type":382,"value":6588}," time.Second)\n",{"type":373,"tag":671,"props":6590,"children":6591},{"class":673,"line":1830},[6592,6596,6601,6605,6609,6614,6619,6623,6627],{"type":373,"tag":671,"props":6593,"children":6594},{"style":763},[6595],{"type":382,"value":1618},{"type":373,"tag":671,"props":6597,"children":6598},{"style":690},[6599],{"type":382,"value":6600}," task, err ",{"type":373,"tag":671,"props":6602,"children":6603},{"style":763},[6604],{"type":382,"value":776},{"type":373,"tag":671,"props":6606,"children":6607},{"style":690},[6608],{"type":382,"value":2430},{"type":373,"tag":671,"props":6610,"children":6611},{"style":678},[6612],{"type":382,"value":6613},"GetOutboundRecoveryTask",{"type":373,"tag":671,"props":6615,"children":6616},{"style":690},[6617],{"type":382,"value":6618},"(task.ID); err ",{"type":373,"tag":671,"props":6620,"children":6621},{"style":763},[6622],{"type":382,"value":1100},{"type":373,"tag":671,"props":6624,"children":6625},{"style":696},[6626],{"type":382,"value":1105},{"type":373,"tag":671,"props":6628,"children":6629},{"style":690},[6630],{"type":382,"value":1110},{"type":373,"tag":671,"props":6632,"children":6633},{"class":673,"line":1839},[6634,6638],{"type":373,"tag":671,"props":6635,"children":6636},{"style":763},[6637],{"type":382,"value":2469},{"type":373,"tag":671,"props":6639,"children":6640},{"style":690},[6641],{"type":382,"value":2831},{"type":373,"tag":671,"props":6643,"children":6644},{"class":673,"line":1847},[6645],{"type":373,"tag":671,"props":6646,"children":6647},{"style":690},[6648],{"type":382,"value":1704},{"type":373,"tag":671,"props":6650,"children":6651},{"class":673,"line":1900},[6652],{"type":373,"tag":671,"props":6653,"children":6654},{"style":690},[6655],{"type":382,"value":1138},{"type":373,"tag":671,"props":6657,"children":6658},{"class":673,"line":1926},[6659,6663,6667,6671,6676,6680,6684,6688,6692,6696,6701,6705,6709],{"type":373,"tag":671,"props":6660,"children":6661},{"style":690},[6662],{"type":382,"value":3057},{"type":373,"tag":671,"props":6664,"children":6665},{"style":678},[6666],{"type":382,"value":3062},{"type":373,"tag":671,"props":6668,"children":6669},{"style":690},[6670],{"type":382,"value":1053},{"type":373,"tag":671,"props":6672,"children":6673},{"style":684},[6674],{"type":382,"value":6675},"\"recovery ",{"type":373,"tag":671,"props":6677,"children":6678},{"style":696},[6679],{"type":382,"value":2491},{"type":373,"tag":671,"props":6681,"children":6682},{"style":684},[6683],{"type":382,"value":2185},{"type":373,"tag":671,"props":6685,"children":6686},{"style":696},[6687],{"type":382,"value":2491},{"type":373,"tag":671,"props":6689,"children":6690},{"style":684},[6691],{"type":382,"value":1882},{"type":373,"tag":671,"props":6693,"children":6694},{"style":696},[6695],{"type":382,"value":1950},{"type":373,"tag":671,"props":6697,"children":6698},{"style":684},[6699],{"type":382,"value":6700}," deliveries re-sent ",{"type":373,"tag":671,"props":6702,"children":6703},{"style":696},[6704],{"type":382,"value":3103},{"type":373,"tag":671,"props":6706,"children":6707},{"style":684},[6708],{"type":382,"value":1758},{"type":373,"tag":671,"props":6710,"children":6711},{"style":690},[6712],{"type":382,"value":6713},", task.ID, task.Status, task.Processed, task.Error)\n",{"type":373,"tag":671,"props":6715,"children":6716},{"class":673,"line":1981},[6717,6721],{"type":373,"tag":671,"props":6718,"children":6719},{"style":763},[6720],{"type":382,"value":2534},{"type":373,"tag":671,"props":6722,"children":6723},{"style":696},[6724],{"type":382,"value":2539},{"type":373,"tag":671,"props":6726,"children":6727},{"class":673,"line":1989},[6728],{"type":373,"tag":671,"props":6729,"children":6730},{"style":690},[6731],{"type":382,"value":1836},{"type":373,"tag":374,"props":6733,"children":6734},{},[6735],{"type":382,"value":6736},"Two related calls cover the other recovery cases:",{"type":373,"tag":572,"props":6738,"children":6739},{},[6740,6751],{"type":373,"tag":576,"props":6741,"children":6742},{},[6743,6749],{"type":373,"tag":385,"props":6744,"children":6746},{"className":6745},[],[6747],{"type":382,"value":6748},"api.RetryOutboundDelivery(endpointID, messageID)",{"type":382,"value":6750}," re-sends one message to one endpoint now.",{"type":373,"tag":576,"props":6752,"children":6753},{},[6754,6760,6762,6768],{"type":373,"tag":385,"props":6755,"children":6757},{"className":6756},[],[6758],{"type":382,"value":6759},"api.ReplayMissingOutboundDeliveries(endpointID, since)",{"type":382,"value":6761}," sends messages that were skipped while the endpoint was paused or disabled. Call ",{"type":373,"tag":385,"props":6763,"children":6765},{"className":6764},[],[6766],{"type":382,"value":6767},"api.ResumeOutboundEndpoint(endpointID)",{"type":382,"value":6769}," first.",{"type":373,"tag":565,"props":6771,"children":6773},{"id":6772},"run-it",[6774],{"type":382,"value":6775},"Run it",{"type":373,"tag":661,"props":6777,"children":6779},{"className":663,"code":6778,"language":665,"meta":345,"style":345},"go mod tidy\ngo run . catalog\ngo run . onboard customer_42 Acme https://bin.webhookrelay.com/v1/webhooks/YOUR_BIN_ID\nDATABASE_URL=postgres://localhost/app go run . outbox   # after inserting a row into webhook_outbox\ngo run . inspect MESSAGE_ID\ngo run . failing\ngo run . recover ENDPOINT_ID 2026-10-24T00:00:00Z\n",[6780],{"type":373,"tag":385,"props":6781,"children":6782},{"__ignoreMap":345},[6783,6799,6821,6855,6895,6919,6939],{"type":373,"tag":671,"props":6784,"children":6785},{"class":673,"line":674},[6786,6790,6794],{"type":373,"tag":671,"props":6787,"children":6788},{"style":678},[6789],{"type":382,"value":713},{"type":373,"tag":671,"props":6791,"children":6792},{"style":684},[6793],{"type":382,"value":718},{"type":373,"tag":671,"props":6795,"children":6796},{"style":684},[6797],{"type":382,"value":6798}," tidy\n",{"type":373,"tag":671,"props":6800,"children":6801},{"class":673,"line":707},[6802,6806,6811,6816],{"type":373,"tag":671,"props":6803,"children":6804},{"style":678},[6805],{"type":382,"value":713},{"type":373,"tag":671,"props":6807,"children":6808},{"style":684},[6809],{"type":382,"value":6810}," run",{"type":373,"tag":671,"props":6812,"children":6813},{"style":684},[6814],{"type":382,"value":6815}," .",{"type":373,"tag":671,"props":6817,"children":6818},{"style":684},[6819],{"type":382,"value":6820}," catalog\n",{"type":373,"tag":671,"props":6822,"children":6823},{"class":673,"line":731},[6824,6828,6832,6836,6840,6845,6850],{"type":373,"tag":671,"props":6825,"children":6826},{"style":678},[6827],{"type":382,"value":713},{"type":373,"tag":671,"props":6829,"children":6830},{"style":684},[6831],{"type":382,"value":6810},{"type":373,"tag":671,"props":6833,"children":6834},{"style":684},[6835],{"type":382,"value":6815},{"type":373,"tag":671,"props":6837,"children":6838},{"style":684},[6839],{"type":382,"value":1353},{"type":373,"tag":671,"props":6841,"children":6842},{"style":684},[6843],{"type":382,"value":6844}," customer_42",{"type":373,"tag":671,"props":6846,"children":6847},{"style":684},[6848],{"type":382,"value":6849}," Acme",{"type":373,"tag":671,"props":6851,"children":6852},{"style":684},[6853],{"type":382,"value":6854}," https://bin.webhookrelay.com/v1/webhooks/YOUR_BIN_ID\n",{"type":373,"tag":671,"props":6856,"children":6857},{"class":673,"line":749},[6858,6863,6867,6872,6877,6881,6885,6890],{"type":373,"tag":671,"props":6859,"children":6860},{"style":690},[6861],{"type":382,"value":6862},"DATABASE_URL",{"type":373,"tag":671,"props":6864,"children":6865},{"style":763},[6866],{"type":382,"value":776},{"type":373,"tag":671,"props":6868,"children":6869},{"style":684},[6870],{"type":382,"value":6871},"postgres://localhost/app",{"type":373,"tag":671,"props":6873,"children":6874},{"style":678},[6875],{"type":382,"value":6876}," go",{"type":373,"tag":671,"props":6878,"children":6879},{"style":684},[6880],{"type":382,"value":6810},{"type":373,"tag":671,"props":6882,"children":6883},{"style":684},[6884],{"type":382,"value":6815},{"type":373,"tag":671,"props":6886,"children":6887},{"style":684},[6888],{"type":382,"value":6889}," outbox",{"type":373,"tag":671,"props":6891,"children":6892},{"style":850},[6893],{"type":382,"value":6894},"   # after inserting a row into webhook_outbox\n",{"type":373,"tag":671,"props":6896,"children":6897},{"class":673,"line":759},[6898,6902,6906,6910,6914],{"type":373,"tag":671,"props":6899,"children":6900},{"style":678},[6901],{"type":382,"value":713},{"type":373,"tag":671,"props":6903,"children":6904},{"style":684},[6905],{"type":382,"value":6810},{"type":373,"tag":671,"props":6907,"children":6908},{"style":684},[6909],{"type":382,"value":6815},{"type":373,"tag":671,"props":6911,"children":6912},{"style":684},[6913],{"type":382,"value":1495},{"type":373,"tag":671,"props":6915,"children":6916},{"style":684},[6917],{"type":382,"value":6918}," MESSAGE_ID\n",{"type":373,"tag":671,"props":6920,"children":6921},{"class":673,"line":784},[6922,6926,6930,6934],{"type":373,"tag":671,"props":6923,"children":6924},{"style":678},[6925],{"type":382,"value":713},{"type":373,"tag":671,"props":6927,"children":6928},{"style":684},[6929],{"type":382,"value":6810},{"type":373,"tag":671,"props":6931,"children":6932},{"style":684},[6933],{"type":382,"value":6815},{"type":373,"tag":671,"props":6935,"children":6936},{"style":684},[6937],{"type":382,"value":6938}," failing\n",{"type":373,"tag":671,"props":6940,"children":6941},{"class":673,"line":923},[6942,6946,6950,6954,6959,6964],{"type":373,"tag":671,"props":6943,"children":6944},{"style":678},[6945],{"type":382,"value":713},{"type":373,"tag":671,"props":6947,"children":6948},{"style":684},[6949],{"type":382,"value":6810},{"type":373,"tag":671,"props":6951,"children":6952},{"style":684},[6953],{"type":382,"value":6815},{"type":373,"tag":671,"props":6955,"children":6956},{"style":684},[6957],{"type":382,"value":6958}," recover",{"type":373,"tag":671,"props":6960,"children":6961},{"style":684},[6962],{"type":382,"value":6963}," ENDPOINT_ID",{"type":373,"tag":671,"props":6965,"children":6966},{"style":684},[6967],{"type":382,"value":6968}," 2026-10-24T00:00:00Z\n",{"type":373,"tag":374,"props":6970,"children":6971},{},[6972,6974,6980,6982,6988,6989,6995,6996,7002,7003,7009,7010,7016,7018,7023,7025,7030],{"type":382,"value":6973},"Each delivery arrives as a ",{"type":373,"tag":385,"props":6975,"children":6977},{"className":6976},[],[6978],{"type":382,"value":6979},"POST",{"type":382,"value":6981}," with ",{"type":373,"tag":385,"props":6983,"children":6985},{"className":6984},[],[6986],{"type":382,"value":6987},"webhook-id",{"type":382,"value":1882},{"type":373,"tag":385,"props":6990,"children":6992},{"className":6991},[],[6993],{"type":382,"value":6994},"webhook-timestamp",{"type":382,"value":1882},{"type":373,"tag":385,"props":6997,"children":6999},{"className":6998},[],[7000],{"type":382,"value":7001},"webhook-signature",{"type":382,"value":1882},{"type":373,"tag":385,"props":7004,"children":7006},{"className":7005},[],[7007],{"type":382,"value":7008},"webhook-event-type",{"type":382,"value":4860},{"type":373,"tag":385,"props":7011,"children":7013},{"className":7012},[],[7014],{"type":382,"value":7015},"webhook-consumer",{"type":382,"value":7017}," headers. Send customers their ",{"type":373,"tag":385,"props":7019,"children":7021},{"className":7020},[],[7022],{"type":382,"value":2572},{"type":382,"value":7024}," secret and the ",{"type":373,"tag":404,"props":7026,"children":7027},{"href":71},[7028],{"type":382,"value":7029},"receiving guide",{"type":382,"value":7031},", which includes a standard-library Go verifier.",{"type":373,"tag":565,"props":7033,"children":7035},{"id":7034},"next-steps",[7036],{"type":382,"value":7037},"Next steps",{"type":373,"tag":572,"props":7039,"children":7040},{},[7041,7050,7059,7070,7079],{"type":373,"tag":576,"props":7042,"children":7043},{},[7044,7048],{"type":373,"tag":404,"props":7045,"children":7046},{"href":68},[7047],{"type":382,"value":69},{"type":382,"value":7049},": REST reference for every call used here.",{"type":373,"tag":576,"props":7051,"children":7052},{},[7053,7057],{"type":373,"tag":404,"props":7054,"children":7055},{"href":74},[7056],{"type":382,"value":75},{"type":382,"value":7058},": statuses, endpoint states, Functions and limits.",{"type":373,"tag":576,"props":7060,"children":7061},{},[7062,7068],{"type":373,"tag":404,"props":7063,"children":7065},{"href":7064},"/blog/webhook-system-design/",[7066],{"type":382,"value":7067},"Webhook system design",{"type":382,"value":7069},": why the outbox, per-endpoint lanes and retry schedule look the way they do.",{"type":373,"tag":576,"props":7071,"children":7072},{},[7073,7078],{"type":373,"tag":404,"props":7074,"children":7075},{"href":203},[7076],{"type":382,"value":7077},"Send webhooks from Node.js / TypeScript",{"type":382,"value":634},{"type":373,"tag":576,"props":7080,"children":7081},{},[7082,7087],{"type":373,"tag":404,"props":7083,"children":7084},{"href":406},[7085],{"type":382,"value":7086},"Webhooks as a service pricing and plans",{"type":382,"value":634},{"type":373,"tag":7089,"props":7090,"children":7091},"style",{},[7092],{"type":382,"value":7093},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":345,"searchDepth":731,"depth":731,"links":7095},[7096,7097,7098,7099,7100,7101,7102,7103],{"id":567,"depth":707,"text":570},{"id":806,"depth":707,"text":809},{"id":2550,"depth":707,"text":2553},{"id":3138,"depth":707,"text":3141},{"id":4879,"depth":707,"text":4882},{"id":5675,"depth":707,"text":5678},{"id":6772,"depth":707,"text":6775},{"id":7034,"depth":707,"text":7037},"markdown","content:docs:tutorials:outbound:2.send-webhooks-go.md","content","docs/tutorials/outbound/2.send-webhooks-go.md","docs/tutorials/outbound/2.send-webhooks-go","md",{"loc":206},1792946448181]