GithubHelp home page GithubHelp logo

devlikeapro / whatsapp-http-api Goto Github PK

View Code? Open in Web Editor NEW
732.0 22.0 229.0 23.97 MB

WhatsApp HTTP API (REST API) that you can configure in a click!

Home Page: https://waha.devlike.pro/

License: Apache License 2.0

JavaScript 0.48% TypeScript 98.08% Dockerfile 0.86% Makefile 0.58%
whatsapp http-api bot whatsapp-api whatsapp-bot python-bot ai-bot whatsapp-web whatsapp-automation whatsapp-chat

whatsapp-http-api's People

Contributors

allburov avatar dependabot[bot] avatar felipeveiga avatar gqlxj1987 avatar sunilsankar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whatsapp-http-api's Issues

Failed when starting using compose

If I start from compose, it show like this:
But if start from "run -it", it does not have a problem...

image

Edit : the problem is cannot access to WA web. Also when I tried to ping to WhatsApp, it does not respond.

Whatsapp sesion FAILED (instantly after scanning qr code)

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 )

How to authenticate?

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.

send message to groups

hi, there is no endpoint to send messages to groups.
and there is no way to get the chat id of groups.

Can't send message

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.

Send messages to a group

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

Send image

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.

Send an image

Can someon tell me how to send an image using API? Thanks before.

About WhatsApp Status Check - /api/checkNumberStatus

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 ?

SS-Swagger UI-Google Chrome-19-11 at 17

Thank you,
SFN

Waha Plus - session crashed, unable to restart

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]).
image

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
image
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"
image

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

Run on Mac Silicon processor

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!

error after the qr code scan , before the authentication

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)

How to send buttons?

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 :)

Donation

boosty and petrion show me renew every month

Get info about Groups

According to people needs - we should add endpoints to control Groups
#33

  • Create group
  • List of all groups
  • Get group
  • Delete group
  • Leave group
  • Group - setDescription
  • Group - setSubject
  • Invite - get invite code
  • Invite - Revoke invite code
  • Participants - add participants to group
  • Participants - promote participants to admin
  • Participants - demote participants to user

Get Info User

How to get information about a user by number? avatar, online status

Send location when using default engine

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?

Memory utilization is going up continusly

I was checking the memory graphs in AWS where I have deployed WAHA and I found that it's consuming more memory day after day

Are you aware of that? Is there something I can do to free up some memory?

Screenshot 2023-02-01 at 17 04 52

The peak down you see on 1/28 is because the session was closed.

improvement - phone number check

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.

Any platform using the API

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?

diazzaid / whatsapp-api-venom throws info: [sessionName] Error no open browser....

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

Contact email?

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

send text message not working

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)

Weird error caused a running session to stop

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

is there a way to add/change the webhook url after the user authentication ?

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 )

Multiple Sessions / High Consume CPU and RAM

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.

SS-Portainer  local-Google Chrome-20-11 at 15

SS-Swagger UI-Google Chrome-20-11 at 15

Also you can check log files which i added here.

_WAHA_logs (1).txt

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
SS-Swagger UI-Google Chrome-20-11 at 16

SS-Swagger UI-Google Chrome-20-11 at 16

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

Error from nowhere. Not avaliable to send any msg on plus.

"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.

WaHa Plus - disable webhook retires

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 ?

Venom engine - can not send messages

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

WhatsApp Notification

Hi,

I am using VENOM core and i just remark when i scan qr, my phone whatsapp notifications becoming silent ?

Thank you

lost session

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.