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

About protecting starting a session with the same name #315

Closed borsatti2 closed 2 months ago

borsatti2 commented 2 months ago

You could create a system that if you try to create a session with the same name, it returns a failure, if the session exists and they are not active, then close it and open a new one, if there is one active (connected) then, do not perform any action

patron:PRO

allburov commented 2 months ago

Fixed in 2024.5.3 (WAHA Plus)

if there is one active (connected) then, do not perform any action

If you perform two POST /api/sessions request with the same name, like

{
  "name": "sessionname",
}

It return response with status code 422 and payload:

{
  "statusCode": 422,
  "message": "Session 'default3' is already started.",
  "error": "Unprocessable Entity"
}

patron:PRO

allburov commented 2 months ago

If the session exists and it's STOPPED - we restart it

patron:PRO