open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.08k stars 592 forks source link

feat: chatwoot integration should work for outgoing messages also #2934

Open infiniziconsulting opened 1 year ago

infiniziconsulting commented 1 year ago

Are you using the latest version of the library?

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Business account

Mode

EASY API/CLI

Current Behavior

I am trying to integrate whatsapp with chatwoot. Open-wa is able to connect to chatwoot as it was able to update the webhoot.

Issue is that, it is not able to create conversation. I tried checking logs also and could not see any request going to chatwoot.

I am using self-hosted chatwoot from last 6 months.

Expected Behavior

When sending message via whatsapp, conversation should be created on chatwoot

Steps To Reproduce

Always

create() code OR full CLI command + CONFIG

No response

DEBUG INFO

✓ Version: 4.48.0
✓ Found session data file: /var/www/whatsapp/session.data.json
✓ Page loaded
┌─────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│       (index)       │                                                                   Values                                                                   │
├─────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│     WA_VERSION      │                                                                 '2.2241.7'                                                                 │
│       PAGE_UA       │ 'WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36' │
│ WA_AUTOMATE_VERSION │                                                                  '4.48.0'                                                                  │
│   BROWSER_VERSION   │                                                       'HeadlessChrome/103.0.5058.0'                                                        │
│         OS          │                                                                'Linux 5.15'                                                                │
│      START_TS       │                                                               1667223351280                                                                │
│      RAM_INFO       │                                                      'Total: 2.07 GB | Free: 1.50 GB'                                                      │
│    PPTR_VERSION     │                                                                  '15.0.0'                                                                  │
└─────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
✓ Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2241.7%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.48.0%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/103.0.5058.0%22,%0A%20%20%22START_TS%22:%201667223351280,%0A%20%20%22RAM_INFO%22:%20%22Total:%202.07%20GB%20%7C%20Free:%201.50%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2215.0.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20true%0A%7D&enviro=-%20OS:%20Linux%205.15%0A-%20Node:%2012.22.9%0A-%20npm:%208.5.1&labels=CLI,MD
✓ Launch inject: 1117ms
✓ Authenticated
✓ Session ready for injection
✓ Launch inject: 852ms
✓ Launch inject: 1457ms
✓ WAPI Reinjected
✓ Client is ready
✓ Downloaded patches in 0.242s
✓ Patches Installed: 43f33
✓ Client loaded for business account [MD] with 192 contacts, 1 chats & 1 messages in 22.782s
┌───────────────────────────────────────────────────────┐
│                                                       │
│   Use the link below to easily report issues:👇👇👇   │
│                                                       │
└───────────────────────────────────────────────────────┘
✓ https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2241.7%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.48.0%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/103.0.5058.0%22,%0A%20%20%22START_TS%22:%201667223351280,%0A%20%20%22RAM_INFO%22:%20%22Total:%202.07%20GB%20%7C%20Free:%201.50%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2215.0.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20true,%0A%20%20%22PATCH_HASH%22:%20%2243f33%22,%0A%20%20%22LAUNCH_TIME_MS%22:%2022782,%0A%20%20%22ACC_TYPE%22:%20%22BUSINESS%22,%0A%20%20%22chats%22:%201,%0A%20%20%22messages%22:%201,%0A%20%20%22contacts%22:%20192,%0A%20%20%22isBiz%22:%20true,%0A%20%20%22isMd%22:%20true,%0A%20%20%22INSTANCE_ID%22:%20%22949a6845-83cd-4f3f-ad1b-a13d22d9e16e%22%0A%7D&enviro=-%20OS:%20Linux%205.15%0A-%20Node:%2012.22.9%0A-%20npm:%208.5.1&labels=CLI,MD,BHA
✓ 🚀 @OPEN-WA ready for account: 2904
✓ Chatwoot handler set up successfully
✓ API Explorer set up successfully
✓ Port 3000 is now free.
✓ 
    API Explorer (​http://localhost:3000/api-docs/ ​)
✓ 
• Listening on port 3000!
✓ Use this link to get a license: https://get.openwa.dev/l/447480542904

Environment

- OS: Ubuntu
- Node: 12.22.9
- npm: 8.5.1

Screenshots/Logs

npx @open-wa/wa-automate -p 3000 --api-host "http://localhost:3000" --chatwoot-url "https://www.example.com/api/v1/accounts/2/inboxes/12" --chatwoot-api-access-token "ZkoU9292wpGqhx2P5bDSUiN1qjB"

I am running above command to run the open-wa

Anything else?

I am running chatwoot and open-wa on two different servers

smashah commented 1 year ago

Issue is that, it is not able to create conversation

Can you be more specific about this please?

sending message via whatsapp, conversation should be created on chatwoot

So you create a message on whatsapp web or mobile? Or via EASY API request? Does the conversation get created when an incoming message is detected?

At the moment only incoming messages get sent to chatwoot via the built-in integration.

infiniziconsulting commented 1 year ago

I have tried to send message via easy-api and whatsapp mobole both. Incoming message is received on receiver's whatsapp but nothing happens on chatwoot. It seems like open-wa is not sending request to chatwoot.

smashah commented 1 year ago

@infiniziconsulting the chatwoot integration sends incoming messages to chatwoot. And chatwoot messages out to the recipient.

Sending outgoing messages from the host account to chatwoot is not implemented. I'm curious how you did not notice this for 6 months?

infiniziconsulting commented 1 year ago

I am not using open-wa and chatwoot integration for 6 months. I m using chatwoot for different activities like sms and email. This is my first time integration of open-wa and chatwoot.

My point was that I m not new to chatwoot and there is no issue in working of chatwoot.

infiniziconsulting commented 1 year ago

I am also using open-wa from last 18 months but using it with normal webhook and it also works fine so I m pretty sure that open-wa should also work with chatwoot but I m not getting the result.

I might not be using correct keywords to explain my issue so let me try again.

When I m sending whatsapp message from my phone to client for the first time so ideally, I should see new conversation created on chatwoot but it is not happening.

I also created client's contact in chatwoot and tried same thinking now new conversation will create but it didnt.

smashah commented 1 year ago

@infiniziconsulting I understand the problem you're facing. This is not a but. The chatwoot integration lacks the feature you're requesting.

No worries, I will implement it.

smashah commented 1 year ago

hey @infiniziconsulting please try the latest version 4.50.0 and report back any further issues

thanks

lazmo88 commented 7 months ago

hey @infiniziconsulting please try the latest version 4.50.0 and report back any further issues

thanks

Latest version tested and behaviour seems bit unexpected. If I reply to existing WA conversation that is only WhatsApp via WhatsApp (mobile or web) it will create a new Chatwoot conversation, but for our own WA number (sender) not the WA recipient.

What I mean with existing WA conversation are chats started prior to connecting wa-automate to Chatwoot.

lazmo88 commented 7 months ago

hey @infiniziconsulting please try the latest version 4.50.0 and report back any further issues

thanks

Latest version tested and behaviour seems bit unexpected. If I reply to existing WA conversation that is only WhatsApp via WhatsApp (mobile or web) it will create a new Chatwoot conversation, but for our own WA number (sender) not the WA recipient.

What I mean with existing WA conversation are chats started prior to connecting wa-automate to Chatwoot.

And now when I reply from connected mobile device, outgoing messages are sent as duplicates. Am I the only one with these issues? @smashah

smashah commented 7 months ago

TODO