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

How to run on a RPI3B

Open Tsjippy opened this issue 1 year ago • 4 comments

I love this package and it runs great on my windows machine.

But it doesnt work on my RPI3b.

I have locally used all changed from https://github.com/chrishubert/whatsapp-api/pull/280 and https://github.com/chrishubert/whatsapp-api/pull/289.

QR code generation worked one time but most of the times I get the "qr code not ready or already scanned" error. Even if I remove the whole sessions folder and start a new folder.

A visit to :3000/session/status/test makes the server crash.

I have this in my .env file:

## Application ##
PORT=3000 # OPTIONAL, DEFAULT 3000
API_KEY= # OPTIONAL, DEFAULT EMPTY
BASE_WEBHOOK_URL=http://localhost:3000/localCallbackExample # MANDATORY
ENABLE_LOCAL_CALLBACK_EXAMPLE=FALSE # OPTIONAL, DISABLE FOR PRODUCTION
RATE_LIMIT_MAX=1000 # OPTIONAL, THE MAXIUM NUMBER OF CONNECTIONS TO ALLOW PER TIME FRAME
RATE_LIMIT_WINDOW_MS=60000 # OPTIONAL, TIME FRAME FOR WHICH REQUESTS ARE CHECKED IN MS

## Client ##
MAX_ATTACHMENT_SIZE=10000000 # IF REACHED, MEDIA ATTACHMENT BODY WILL BE NULL
SET_MESSAGES_AS_SEEN=TRUE # WILL MARK THE MESSAGES AS READ AUTOMATICALLY
# ALL CALLBACKS: auth_failure|authenticated|call|change_state|disconnected|group_join|group_leave|group_update|loading_screen|media_uploaded|message|message_ack|message_create|message_reaction|message_revoke_everyone|qr|ready|contact_changed|unread_count|message_edit|message_ciphertext
DISABLED_CALLBACKS=message_ack|message_reaction|unread_count|message_edit|message_ciphertext  # PREVENT SENDING CERTAIN TYPES OF CALLBACKS BACK TO THE WEBHOOK
WEB_VERSION='2.2328.5' # OPTIONAL, THE VERSION OF WHATSAPP WEB TO USE
WEB_VERSION_CACHE_TYPE=none # OPTIONAL, DETERMINTES WHERE TO GET THE WHATSAPP WEB VERSION(local, remote or none), DEFAULT 'none'
RECOVER_SESSIONS=TRUE # OPTIONAL, SHOULD WE RECOVER THE SESSION IN CASE OF PAGE FAILURES
CHROME_BIN= /usr/bin/chromium-browser  # OPTIONAL, PATH TO CHROME BINARY
HEADLESS=TRUE # OPTIONAL, RUN CHROME IN HEADLESS MODE

## Session File Storage ##
SESSIONS_PATH=./sessions # OPTIONAL

ENABLE_SWAGGER_ENDPOINT=TRUE # OPTIONAL

So I feel there is still a lot to do to have it working on a rpi.

Tsjippy avatar Nov 18 '24 07:11 Tsjippy

Is there anything written to the server log during the crash?

avoylenko avatar Nov 18 '24 17:11 avoylenko

unfortunately not.

But I think the start up process is v ery power hungry. More than the rpi can handle. Would be great if we could turn off the callback(I don't care about receiving messages, I just want to send them) or something

Tsjippy avatar Nov 20 '24 07:11 Tsjippy

The browser is CPU/memory consuming process and turning off the callback won't change anything. Try to allocate more RAM by cutting the memory allocated to the GPU.

avoylenko avatar Nov 20 '24 08:11 avoylenko

ok thanks.

In the end I choose to use this: https://github.com/gajosu/whatsapp-ha-addon on my rpi4

thank you!

Tsjippy avatar Nov 20 '24 10:11 Tsjippy