Skip to content

Webhook hooks return 202 instead of 200, breaking Forward Email integration #22036

@jensb1

Description

@jensb1

Problem

The gateway's HTTP hook endpoint returns 202 Accepted for successfully dispatched webhook requests (server-http.js lines 81 and 128).

Forward Email (forwardemail.net), a popular email forwarding service, requires webhook endpoints to return 200 — any other status code is treated as a failure. This causes Forward Email to send 550 bounce notifications back to the original sender, even though the webhook was successfully received and processed.

The error in Forward Email's logs shows:

550 Message delivered to [email protected]; 202 Accepted Error for [email protected]
Webhook: 202 UND_ERR_RESPONSE

Root Cause

In dist/gateway/server-http.js:

// Line 81 (direct agent hook)
sendJson(res, 202, { ok: true, runId });

// Line 128 (mapped hook)
sendJson(res, 202, { ok: true, runId });

Forward Email's docs state:

Webhook HTTP requests will retry up to 3 times per SMTP connection attempt with a 60 second timeout. If a webhook does not respond with a 200 status code, the response will be stored in an error log.

Suggested Fix

Either:

  1. Change the default to 200 — semantically 200 OK is fine since the response body already includes { ok: true, runId } confirming acceptance
  2. Make it configurable — add a hooks.responseCode or per-mapping ackCode config option so users can set it to 200 for services that require it

Workaround

Manually patching server-http.js to return 200 instead of 202 fixes the issue, but the patch is lost on every npm update.

Environment

  • OpenClaw v2026.1.30
  • Forward Email webhook integration
  • Gateway behind Cloudflare tunnel

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions