chatwoot icon indicating copy to clipboard operation
chatwoot copied to clipboard

Whatsapp Cloud API inbox does not send messages

Open eduardosantanna opened this issue 2 years ago • 12 comments

Describe the bug

I can receive messages normally through the test number, but when I respond to the contact through chatwoot, message is not forwarded.

To Reproduce

Standard deployment with docker, nginx and whatsapp api, as instructed in the documentation.

Expected behavior

Receive and be able to respond to messages received via WhatsApp cloud api inbox normally.

### Environment

Docker

### Cloud Provider

None

### Platform

Browser

### Operating system

Windows 10 64Bits

### Browser and version

Google Chrome

### Docker (if applicable)

- Docker Version
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:32:48 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.24.2 (124339)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:32:16 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

- Docker info
 Version:    24.0.6
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.22.0-desktop.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.8
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.7
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 6
  Running: 5
  Paused: 0
  Stopped: 1
 Images: 15
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
 Kernel Version: 5.15.90.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.701GiB
 Name: docker-desktop
 ID: b0dc62cb-3536-48ec-a145-e7405c4637e7
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: daemon is not using the default seccomp profile

- docker-compose version
Docker Compose version v2.22.0-desktop.2

Additional context

Hello, I'm configuring an instance of chatwoot next to the WhatsApp cloud api, but I'm running into a problem that I can't find a solution for in any way: I can receive messages normally through the test number, but when I respond to the contact through chatwoot, message is not forwarded. I'm using the permanent token and testing it through postman, I can forward messages without any problems. Does anyone have any idea why this is happening or if it could be a Chatwoot incompatibility bug with the current WhatsApp API version?

No response

eduardosantanna avatar Oct 23 '23 14:10 eduardosantanna

@eduardosantanna There is no information here that helps us to debug what is going on. It feels like an issue with the setup. Please provide relevant logs so that we can help better.

pranavrajs avatar Oct 24 '23 19:10 pranavrajs

@eduardosantanna There is no information here that helps us to debug what is going on. It feels like an issue with the setup. Please provide relevant logs so that we can help better.

For some reason I was unable to forward messages using the test number, even though the number started the contact window. It was necessary to add a number to the account and also a payment method for the messages to be forwarded.

eduardosantanna avatar Oct 24 '23 22:10 eduardosantanna

@pranavrajs Do you have any idea why this happens? Could it be some blockage on the part of Meta or some internal chatwoot bug with the use of test numbers?

image

I can receive messages normally on chatwoot, but I cannot send any messages via chatwoot. This occurs using the WhatsApp Cloud API test number.

In the print I am using Chatwoot's own cloud environment, but the error is also repeated in the local environment. In this cloud environment, the only thing I did was add the number of tests input box.

eduardosantanna avatar Nov 15 '23 14:11 eduardosantanna

I have the same problem in version 3.3.1

AdrianoABC2 avatar Dec 07 '23 17:12 AdrianoABC2

Does anyone recommend another version you're working on? If I change to another one, will I lose my chat history and/or files?

klebinhopk avatar Dec 10 '23 13:12 klebinhopk

Hi everyone, I had the same problem than you. If you are using the whatsapp api directly, their test API allows up to 5 phone numbers that needs to be autenticated. I realized that the authorized number works for receive messages but the responses for chatwoot cannot be correctly sent because the sender number is comming with an additional digit from whatsapp API. (in my case adds an additional "9" after the country code)

Heres the log trail from the task processing: 2024-03-02 11:56:33 E, [2024-03-02T14:56:33.859705 #1] ERROR -- : [ActiveJob] [SendReplyJob] [20fda24e-fdbe-465f-ae57-c1d0584d4337] {"error":{"message":"(#131030) Recipient phone number not in allowed list","type":"OAuthException","code":131030,"error_data":{"messaging_product":"whatsapp","details":"El n\u00famero de tel\u00e9fono del destinatario no est\u00e1 en la lista de autorizados: Agrega el n\u00famero de tel\u00e9fono del destinatario a la lista de destinatarios y vuelve a intentarlo."},"fbtrace_id":"Awzdg1gNrK8-3Nab9hrmPsM"}'

I fixed this in other project by deleted the additional digit that is comming from whatsapp, to ensure that the message is sent to the authorized phone previously configured.

I don't know if chatwoot will consider this use case in the future, I hope so because it will really useful for non productive environments.

TTomas78 avatar Mar 02 '24 20:03 TTomas78

I'm having the same problem :/

montenegromatheus avatar Mar 10 '24 21:03 montenegromatheus

hey @eduardosantanna! were you able to make it work using the test number Meta provided you?

I'm getting the same issue with my local environment and even the cloud setup.

matisidler avatar Apr 19 '24 14:04 matisidler

Any solutions for this? Have the exact same problem on the web version tho I feel it has something to do with payment

kelvin00ng avatar Aug 07 '24 18:08 kelvin00ng

Any solutions for this? Have the exact same problem on the web version tho I feel it has something to do with payment

I solved it by not using the test number Meta provides you. I used my own number instead.

matisidler avatar Aug 07 '24 20:08 matisidler

Any solutions for this? Have the exact same problem on the web version tho I feel it has something to do with payment

I solved it by not using the test number Meta provides you. I used my own number instead.

Are you on the hacker plan on the cloud version? I am using my own number too but still face the same problem

kelvin00ng avatar Aug 08 '24 04:08 kelvin00ng

@eduardosantanna Eu consegui passar desse problema, coloquei um cartão de credito na conta da api, coloquei um numero de telefone meu mesmo. Apaguei a caixa de entrada no chatwoot e configurei de novo, e no painel do cloud api eu informei o novo token do webhook dentro do site da cloud api.

WandersonSilva2020 avatar Aug 12 '24 14:08 WandersonSilva2020

Closing this thread, as no issues were found with WhatsApp integration based on our investigations. The reports mostly stem from the following reasons, so please handle accordingly:

  • WhatsApp only allows sending outbound messages to verified numbers when using a test number (even within the 24-hour message window).
  • For numbers from Brazil, Mexico, or Argentina, ensure the correct additional digits are included. Please refer to the documentation: https://faq.whatsapp.com/640432094208718
  • For further details on inconsistencies with mobile numbers and WhatsApp IDs, see: https://support.gupshup.io/hc/en-us/articles/4407840924953

sojan-official avatar Oct 01 '24 21:10 sojan-official