OpenWA icon indicating copy to clipboard operation
OpenWA copied to clipboard

[Bug]: Issue with headers and secret values not being preserved during Webhook requests Swagger

Open onepay-ye opened this issue 3 months ago • 1 comments

Pre-flight

  • [x] I searched existing issues and this isn't a duplicate
  • [x] I'm on the latest released version (or noted my version below)

OpenWA version

0.23.3

Deployment

Docker Compose

Database

SQLite (default)

WhatsApp engine

whatsapp-web.js

What happened?

While testing the Webhook settings for my account, I encountered a critical issue regarding the failure to preserve authentication values and custom headers when the payload is sent in swagger api

Problem Details: When setting up the Webhook, I send the following configuration (as shown in the attached example), which contains a secret and custom headers. However, when an event occurs (such as receiving a message), I notice that the secret and X-Custom-Header values are never sent along with the HTTP request to my URL.

Example of the configuration sent:

{
  "url": "https://your-server.com/webhook",
  "events": ["message.received", "session.status"],
  "secret": "your-secret-key",
  "headers": {
    "X-Custom-Header": "value"
  },
  // ... remaining settings
}

Steps to reproduce

  • Ensure that the secret value is correctly sent in the request header or as part of the signature for request validation.
  • Ensure that all custom headers added in the Webhook settings are actually included in every HTTP request sent from your side.

Expected behavior

No response

Relevant logs


Environment / additional context

No response

onepay-ye avatar Aug 31 '26 10:08 onepay-ye

The secret and headers you send are stored, and they are sent. Two things hide that:

  • No response echoes them. Both fields are write-only by design, so neither the create response nor any read returns them.
  • The secret is never sent verbatim. It signs the body and travels as X-OpenWA-Signature: sha256=<hex>. Custom headers go out as-is, except content-type and x-openwa-* names, which are stripped so a custom header cannot shadow a system one.

There is a real bug behind your report, though. The secret example published in Swagger was your-secret-key, 15 characters, while the route enforces a 16-character minimum that the schema did not declare. Sending the example body unchanged answers 400. If that request failed and a later one succeeded without the secret, the webhook would have been registered unsigned, which matches what you are seeing.

#1511 fixes it: the example now satisfies the floor, and both length bounds are published so the constraint is visible before a request is sent. docs/06 and docs/07 understated it too, and both descriptions now say the fields are never returned and that the secret becomes the X-OpenWA-Signature header.

Could you confirm whether your create request returned 201 or 400? If it was 201, something else is going on and I would like to see it.

rmyndharis avatar Sep 02 '26 02:09 rmyndharis