devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
820 stars 249 forks source link

[BUG][NOWEB] - Webhook group.join, group.leave empty payload. #404

Open AliSot2000 opened 6 days ago

AliSot2000 commented 6 days ago

Describe the bug

The documents in the Webhooks state.changed, group.join and group.leave have a payload that doesn't specify the data format within it. It only says object.

Version

{
  "version": "2024.6.8",
  "engine": "NOWEB",
  "tier": "PLUS",
  "browser": "/usr/bin/chromium"
}

To Reproduce Steps to reproduce the behavior:

  1. Start a Docker container.
  2. Go to 'http://localhost:3000/#/webhooks/postgroup_join' or 'http://localhost:3000/#/webhooks/postgroup_leave' or 'http://localhost:3000/#/webhooks/poststate_change'
  3. Expand the documentation
  4. Scroll down to 'Request Body'
  5. Click on 'Schema'
  6. Observe the field payload only says object but no further documentation.

Expected behavior Have any documentation there.

Engine I'm using NOWEB engine.

EDIT: Forgot about the statet.changed webhook.

devlikepro commented 4 days ago

Forgot about the statet.changed webhook.

consider state.changed deprecated

For the rest - agree, we need to have the single right format for both engines, right now they send different payloads. May be we'll add new formatting to keep backward compatible old payload.

patron:PRO

AliSot2000 commented 4 days ago

If state.changed is deprecated, consider marking it as such in the openapi.json.

I'm not sure what kind of backend you're using. I've got some experience with FastAPI (Python). The Framework allows mark endpoints in native code as for example deprecated.

Alternatively, modify your openapi.json in the "webhooks" key like this:

{
      "session.status": {
            "post": {
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WAHAWebhookSessionStatus"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Return a 200 status to indicate that the data was received successfully"
                    }
                },
                "summary": "The event is triggered when the session status changes.",
                "deprecated": true
            }
        },