devlikeapro / whatsapp-http-api Goto Github PK
View Code? Open in Web Editor NEWWhatsApp HTTP API (REST API) that you can configure in a click!
Home Page: https://waha.devlike.pro/
License: Apache License 2.0
WhatsApp HTTP API (REST API) that you can configure in a click!
Home Page: https://waha.devlike.pro/
License: Apache License 2.0
Please add list options and link preview url mate :D
version : latest@plus
when I scan the whatsapp qr code , this is what I get
{
"statusCode": 422,
"message": "The session under FAILED status. Please try to restart it.",
"error": "Unprocessable Entity"
}
this is happening with all new sessions , I tried restarting , but it does not work (I tried restarting , starting new sessions about 7-8 times )
hi every time that I check if a phone number is on whatsapp I get a 422
{
"statusCode": 422,
"message": "The method is not implemented by the engine.",
"error": "Unprocessable Entity"
}
I tried using both engines, but with VENOM , it's worse , it returns a 500
In the documentation you say โWe don't recommend expose the API in the internet without authentication!โ
I imagine that somebody has already done it.
Do you provide a way to do it or I should add the piece of code to do it? If so, please give me some guidance on how to do it.
hi, there is no endpoint to send messages to groups.
and there is no way to get the chat id of groups.
After trying to send a message, this error appears in the console
(node:26) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'get' of undefined
at Object.window.WAPI.window.WAPI.sendMessage (/app/node_modules/venom-bot/dist/lib/wapi/wapi.js:1:35932)
at puppeteer_evaluation_script:3:53
at ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:217:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:26) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Can you please add a password for accessing panel? So it prevent "unauthorized access"
Is it possible to send a message to a group?
I couldn't find it and I would find it very useful
I would use it by providing the group name and the message to send
I was wondering why send image is not implemented in the core version for the default account.
Please add it in the next update. Thanks.
Originally posted by mehmetcoskun February 13, 2023
Does buying WAHA Plus mean I have to buy it again every month to use it? the instructions on the website say this but I want to make sure :)
Thank You.
Can someon tell me how to send an image using API? Thanks before.
Hi Again,
First of all Thank you for quick response the issues @allburov If i am not misunderstanding /api/checkNumberStatus Check number status it's for the WA Number is Online / Offline status check ? If it's like that, it should return as a true if the wa number is online if not the number status false ?
Thank you,
SFN
I would like to send a text message to a group with number as "[email protected]", however it turns out "internal server error" and failed.
curl -X 'GET'
'http://xxxxxxx/api/sendText?phone=xxxxxxxxx%40g.us&text=test&sessionName=default'
-H 'accept: application/json'
Pull, start, login (from phone), get screenshot, send a text message)
a GET endpoint for messages (10 messages , or from 10-20 , 20-30 , 30-90 , to optimize the payload).
hi , I have 5 numbers running on waha plus
one number has high traffic (5 messages per minute inbound and outbound).
the session crashed a few minutes ago (I could not take a screenshot , [infinite spinning loop on swagger ui]).
so I decided to stop it and re-start it (with the same name) , and this is what it returns when I request a screenshot
so , the whatsapp spinner keeps spinning in an infinite loop , so it does not return any QR code (it's been like this for the past 20-30 mins)
note 1 :
the session is still "starting"
note 2:
I created a new session with a different name , and everything works perfectly fine , so the problem here is that if the session crashes, I cannot restart it with the same name
note 3 :
I have the plus version , so ,I can store sessions.
this is the command that I ran to create the docker container
docker run -it -v
pwd/.sessions:/app/.sessions -e WHATSAPP_HOOK_EVENTS=message -e WHATSAPP_HOOK_URL=http://XXX.XXX.XXX:XXXXX/api/post/ -it --rm -p XXXXX:3000/tcp --name docker_tmp_plus_kill devlikeapro/whatsapp-http-api-plus
I noticed that when trying to follow the steps on my Macbook pro M1 pro I'm having some issues.
When running
docker run -it --rm -p 127.0.0.1:3000:3000/tcp --name whatsapp-http-api devlikeapro/whatsapp-http-api
I received a warning
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
and when using the API, I got an error.
[Nest] 28 - 12/18/2022, 2:06:38 AM ERROR [WhatsappSession - default] Error: Failed to launch the browser process!
[1218/020638.479843:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Function not implemented (38)
Assertion failed: p_rcu_reader->depth != 0 (/qemu/include/qemu/rcu.h: rcu_read_unlock: 101)
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
After some research, I found that it's because my processor is not compatible with this app.
Then I began again adding some parameters to the commands.
First,
docker pull --platform linux/amd64 devlikeapro/whatsapp-http-api
Then I run
docker run --platform linux/amd64 -it --rm -p 127.0.0.1:3000:3000/tcp --name whatsapp-http-api devlikeapro/whatsapp-http-api
with any warning or error ๐ช
But when I tried to POST api/sessions/start
I got this error (the same error as before)
WhatsApp HTTP API is running on: http://[::1]:3000
[Nest] 28 - 12/18/2022, 1:48:28 AM LOG [SessionManager] 'default' - starting session...
[Nest] 28 - 12/18/2022, 1:48:28 AM LOG [Webhook - default] Configuring webhooks...
[Nest] 28 - 12/18/2022, 1:48:28 AM LOG [Webhook - default] Webhooks were configured.
[Nest] 28 - 12/18/2022, 1:48:29 AM ERROR [WhatsappSession - default] Error: Failed to launch the browser process!
[1218/014829.073020:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Function not implemented (38)
Assertion failed: p_rcu_reader->depth != 0 (/qemu/include/qemu/rcu.h: rcu_read_unlock: 101)
I think that the docker image is not ready to work with these kinds of processors. Could you make it work, please?
Thanks!
engine : default engine
waha details :
{
"version": "2022.12.11",
"tier": "CORE"
}
how to replicate : simple, start a session and scan a qr code, wait a few seconds and bam, red stuff on the console.
more details:
error that I get when I call the screenshot endpoint after scanning the qr code
{
"statusCode": 422,
"message": "The session under FAILED status. Please try to restart it.",
"error": "Unprocessable Entity"
}
error on the console:
ERROR [WhatsappSession - default] Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'LegacyPhoneFeatures')
at __puppeteer_evaluation_script__:13:76
possible solution :
pedroslopez/whatsapp-web.js#1913 (comment)
Can you give example of the json code via which we can send buttons along with a text?
Thanks for all the work and effort you have done till date :)
boosty and petrion show me renew every month
Something like this -ย https://medium.com/@Dee_Mayoor/apikey-authentication-for-nestjs-using-passport-js-6db467fc31f7ย
Key must be supported two formats:
X-WHATSAPP-TOKEN
?x-whatsapp-token
According to people needs - we should add endpoints to control Groups
#33
From #37 (comment)
To resolve this issue, it is recommended to ensure that the webhooks are fully initialized on the server before making the endpoints available for the , in order to avoid the freeze in the docker container.
No requests are allowed (except qr screenshot) to the session till it has been authorized and fully configured
How to get information about a user by number? avatar, online status
please fix sendlinkpreview and sendbuttons at default engine mate, its me hahaha
Hi! I'm having an issue when trying to hit the endpoint /api/sendLocation
I'm getting an error
{
"statusCode": 422,
"message": "The method is not implemented by the engine.",
"error": "Unprocessable Entity"
}
It seems that this feature is only supported by Venom engine and I'm using WebJS
Could you please make it work with both engines?
Hi, first of all, you did a great job here.
I cant get info from the API because my server runs over https and the API is http. Is there any documentation about ssl in api or swagger running in docker?
with the venom engine when you verify the existence of phone numbers it never returns a false , it simply times out.
in other words if the phone number is not on whatsapp it does not return a response.
Show QR and screenshot on Swagger page in order to avoid using console at all
I am not a hero with api's but do you know any platform that would make it easy to integrate this? something like chatwoot?
I get the below:
> [email protected] start
> nest start
[Nest] 74040 - 12/11/2021, 1:51:03 PM [NestFactory] Starting Nest application...
/\\\ /\\\ /\\\\\\\\\\ /\\\\\ /\\\ /\\\\\\\\ /\\\ \\\\
\/\\\ /\\\ \/\\\_____/ \/\\\ \\\ \/\\\ /\\\_____/\\\ \/\\\ \\ \\ \\\
\/\\\ /\\\ \/\\\ \/\\\ /\\\ \/\\\ \/\\\ \/\\\ \/\\\ \\\ \\\
\/\\\ /\\\ \/\\\\\\\\\\ \/\\\ /\\\ /\\\ \/\\\ \/\\\ \/\\\ \\\ \\\
\/\\\ \\\ \/\\\_____/ \/\\\ \/\\\ /\\\ \/\\\ \/\\\ \/\\\ \\\ \\\
\/\\\\\\ \/\\\ \/\\\ \ /\\\ \\\ \/\\\ \/\\\ \/\\\ \\\ \\\
\/_/\\\ \/\\\\\\\\\\ \/\\\ \/_\\\\\\ \/_/\\\\\\\\\ \/\\\ \\\ \\\
\/__/ \/________/ \/_/ \/____/ \/_______/ \/_/ \/_/ \/_/
info: [sessionName] Initializing browser wss...
[Nest] 74040 - 12/11/2021, 1:51:04 PM [InstanceLoader] ConfigHostModule dependencies initialized +337ms
[Nest] 74040 - 12/11/2021, 1:51:04 PM [InstanceLoader] ConfigModule dependencies initialized +1ms
[Nest] 74040 - 12/11/2021, 1:51:04 PM [InstanceLoader] WhatsappConfigService dependencies initialized +2ms
[Nest] 74040 - 12/11/2021, 1:51:04 PM [InstanceLoader] ServeStaticModule dependencies initialized +0ms
info: [sessionName] Error no open browser....
noOpenBrowser
[Nest] 74040 - 12/11/2021, 1:51:04 PM [ExceptionHandler] +89ms
I am not sure what to do? any help please.... thanks in advance
Hello! This project looks very cool and polished, but I'd like to send you a few questions via email with some concerns I have (I am deciding if I can use it for a client). Is there any email address where I could ask these questions?
Thanks
Getting error while installing through docker on fresh server.
I receive the below:
WhatsApp HTTP API is running on: http://[::1]:3000
[Nest] 28 - 12/11/2021, 9:55:14 AM [ExceptionsHandler] Evaluation failed: TypeError: Cannot read property 'default' of undefined
at __puppeteer_evaluation_script__:3:48 +53459ms
Error: Evaluation failed: TypeError: Cannot read property 'default' of undefined
at __puppeteer_evaluation_script__:3:48
at ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:217:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
[Nest] 28 - 12/11/2021, 9:55:28 AM [ExceptionsHandler] Evaluation failed: TypeError: Cannot read property 'attributes' of undefined
at Object.window.WAPI.window.WAPI.getHost (/app/node_modules/venom-bot/dist/lib/wapi/wapi.js:1:55001)
at __puppeteer_evaluation_script__:1:28 +14195ms
Error: Evaluation failed: TypeError: Cannot read property 'attributes' of undefined
at Object.window.WAPI.window.WAPI.getHost (/app/node_modules/venom-bot/dist/lib/wapi/wapi.js:1:55001)
at __puppeteer_evaluation_script__:1:28
at ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:217:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:28) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'sendChatStateComposing' of undefined
at Object.window.WAPI.window.WAPI.startTyping (/app/node_modules/venom-bot/dist/lib/wapi/wapi.js:1:42456)
at __puppeteer_evaluation_script__:3:37
at ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:217:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:28) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:28) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:28) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'get' of undefined
at Object.window.WAPI.window.WAPI.sendMessage (/app/node_modules/venom-bot/dist/lib/wapi/wapi.js:1:35932)
at __puppeteer_evaluation_script__:3:53
at ExecutionContext._evaluateInternal (/app/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:217:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:28) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
engine :web.js
version :core
steps to replicate : unknown , it just happened 10 hours after starting the session
error
{
"statusCode": 500,
"timestamp": "2023-01-15T17:46:27.248Z",
"exception": {
"stack": "Error: Protocol error: Connection closed. Most likely the page has been closed.\n at assert (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26:15)\n at Page.close (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2126:32)\n at WhatsappSessionWebJSCore.stop (/app/dist/core/session.webjs.core.js:39:38)\n at SessionManagerCore.stop (/app/dist/core/manager.core.js:92:23)\n at SessionsController.stop (/app/dist/api/sessions.controller.js:29:29)\n at /app/node_modules/@nestjs/core/router/router-execution-context.js:38:29\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async /app/node_modules/@nestjs/core/router/router-execution-context.js:46:28\n at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17",
"message": "Protocol error: Connection closed. Most likely the page has been closed.",
"name": "Error"
},
"request": {
"path": "/api/sessions/stop",
"method": "POST",
"body": {
"name": "default"
},
"query": {}
},
"version": {
"version": "2022.12.11",
"tier": "CORE"
}
}
in this case I am sending a request to STOP endpoint, but it's the same for all other endpoints
from what I know , in the core version , it is not possible .
in the plus version though , you can save the session , and restart the docker container with the new websocket url, is that right ?
another question , let's say that I have the plus version , and I host 5 phone numbers on it , is there a way to assign different web sockets to each ? (I don't want to make a proxy server that filters and forwards the messages to individual web sockets )
Do you have any plan for Heroku deployment?
Hi Again,
I just realize, if i have started one session and actively using than if i tried to create second or third sessions they are not starting always dropping to error and than i realize one thing more its consuming really high cpu and memory usage as you can see below screenshot attachments.
Also you can check log files which i added here.
Best Regards,
SFN
------- Update; I wouldn't like create for the same issue second part but you can check from here
When i create first session, there is not problem it's working but when i try to create second session it's not working usually
One little question โ If i would like to use for 100 session or more what's your idea for the same docker with multiple session RAM or CPU requirements ?
Thank you from now,
SFN
"statusCode": 500,
"timestamp": "2023-02-19T10:53:20.970Z",
"exception": {
"stack": "Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.\n at CDPSession.send (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:218:35)\n at ExecutionContext._evaluateInternal (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:204:50)\n at ExecutionContext.evaluate (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:27)\n at DOMWorld.evaluate (/app/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:97:24)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
"message": "Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.",
"name": "Error"
The api was working fine last night, when i wake up the bot isn't sending msgs anymore. That error is in place now.
hi
Q1 - is there a way to disable webhook retires on the plus version ? (web.js)
Q2 - how much time does the waha server wait before attempting again ? is it possible to increase/decrease this time ?
How to solve this?
{
"statusCode": 422,
"message": "The session under FAILED status. Please try to restart it.",
"error": "Unprocessable Entity"
}
Readme - add a simple example with "echo" python server
In order to show how to use env variables and hooks
hi , currently the docker container in unusable
1 - issues with the web.js engine (I opened another issues for that )
2 - cannot send messages with the venom engine (unlimited spin)
more detalis :
the venom engine works just fine , the only problem is that I cannot reply to customers
the get and the post endpoints, stopped working (unlimited spin)
I tried re-launching the container, but nothing changed
Hi,
I am using VENOM core and i just remark when i scan qr, my phone whatsapp notifications becoming silent ?
Thank you
I have tried both WhatsApp-http-api and whatsapp-api-venom (https://github.com/diazzaid/whatsapp-api-venom)
but it's still the same. please help me to resolve the issue!
{"statusCode":501,"message":"Not Implemented"}%
Thanks!๐
hello dear,
everthing works.
but when i resetart the server it lose the session.
i check the /app/tokens and its empty.
how can i keep the session ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.