whatsapp-http-api icon indicating copy to clipboard operation
whatsapp-http-api copied to clipboard

Session would not be saved if server down or docker stop suddenly

Open felixnguyen258 opened this issue 1 year ago • 2 comments

Hi

I face to an issue like the step procedure as below:

  1. Create and start new sessions named "session_test_01" and "session_test_02". OK image

  2. Scan QR Code to link WA account with WAHA app. OK image

  3. Stop docker - re-run docker. image

Cannot query previous session. image

Workaround: I tried to hard-code the configuration with <-e "WHATSAPP_START_SESSION=session_test_01, session_test_02"> in docker run command and it will add 2 sessions but the status is "SCAN_QR_CODE". image

Any advice for auto saving and auto init the previous session name list after instances down?

Thanks & Regards, Felix

felixnguyen258 avatar Aug 09 '23 14:08 felixnguyen258

Hi!

Any advice for auto saving

Could you share the command you run docker container with?

It should container -v pwd/.sessions:/app/.sessions. If it doesn't work - please replace pwd with the real path, like this way - -v /home/allburov/.sessions:/app/.sessions

docker run --rm -d -v /home/allburov/.sessions:/app/.sessions -p 3000:3000/tcp --name whatsapp-http-api devlikeapro/whatsapp-http-api-plus

Any advice for ... auto init the previous session name list after instances down

You can set WHATSAPP_RESTART_ALL_SESSIONS=True environment variable - on the container start it'll restart all STOPPED session. It can't actually track which session was running so it'll restart all sessions - you can see the list by using GET /api/sessions/all=True. If you don't want STOPPED session to be restart - you can logout it with POST /api/sessions/logout

Let me know if it helps!

allburov avatar Aug 10 '23 04:08 allburov

@felixnguyen258 Do you have any questions here or the suggestion helped?

patron:PRO

devlikepro avatar May 20 '24 04:05 devlikepro