devlikeapro / waha

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

Add filter by session name to /api/sessions #300

Closed allburov closed 2 months ago

allburov commented 2 months ago

It would be useful to have the ability to filter the result of "/api/session" end point with a single session name. With this feautures i'm able to know the state of the session.

Originally posted by @giovannicarella in https://github.com/devlikeapro/whatsapp-http-api/discussions/299

devlikepro commented 2 months ago

Hi! Added in 2024.4.4 (WAHA Plus).

Make sure to update the image and restart the container.


Get session

To get information about a specific session - call GET /api/sessions/{session}.

{
  "name": "default",
  "status": "WORKING",
  "config": {
    "proxy": null,
    "webhooks": [
      {
        "url": "https://httpbin.org/post",
        "events": [
          "message",
          "session.status"
        ],
        "hmac": null,
        "retries": null,
        "customHeaders": null
      }
    ],
    "debug": false
  },
  "me": {
    "id": "79111111@c.us",
    "pushName": "WAHA"
  },
  "engine": {
    "engine": "NOWEB"
  }
}

patron:PRO

MadhabaPatra commented 1 month ago

Hi @devlikepro / @allburov

If the {session} is not available, we should return a 404 error, similar to how it's handled in sessions/{session}/me.

data: {
  statusCode: 404,
  message: "We didn't find a session with name '{session}'. Please start it first by using POST /sessions/start request",
  error: 'Not Found'
}

This ensures consistency in error handling across endpoints and provides clear guidance to users when a session is not found.

devlikepro commented 1 month ago

@MadhabaPatra yep, totally agree!Created a new issue for that, #333

patron:PRO