[CW-2823] WhatsApp Interactive Messages with Button Texts Over Limit are Incorrectly Handled
- Dominant language
- Ruby
- Stars
- 36.8k
- Forks
- 8.9k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 98
Description
### Describe the bug
When using the Chatwoot API to send "Options" type [interactive messages](https://www.chatwoot.com/docs/product/others/interactive-messages/) for a WhatsApp inbox, if the button text exceeds the [WhatsApp Cloud API limit of 24 characters](https://developers.facebook.com/docs/whatsapp/guides/interactive-messages/), Chatwoot still creates the message in the conversation without returning an error. The HTTP response suggests that the message was successfully created; however, the "successfully sent" icon is not displayed in the conversation, and the recipient does not receive the message. This behavior is misleading because it implies successful message delivery when, in fact, the message was never sent due to the exceeded character limit set by WhatsApp Cloud API.
This issue could lead to confusion for the support agents as they might believe the message was sent successfully when it was not. This validation should probably be dealt with within Chatwoot to maintain message delivery integrity and user expectations.
### To Reproduce
Steps to reproduce the behavior:
1. Set up a WhatsApp type inbox in Chatwoot.
2. Use the Chatwoot API to send an interactive message with "Options" that include button texts exceeding 24 characters.
3. Observe that the API response indicates the message was created successfully.
4. Check the conversation in Chatwoot web app and notice the message appears there.
5. Observe that the "successfully sent" icon is missing beside the created message.
6. The client does not receive any message on their end.
### Expected behavior
The expected behavior would be for the Chatwoot API to validate the length of the button text against WhatsApp Cloud API's character limit before attempting to send the message. If the button text exceeds the 20-character limit, the API should return an error, and the message should not be created in the conversation within Chatwoot since it violates the constraints of the WhatsApp Cloud API and will not be sent.
### Environment
Docker
### Cloud Provider
AWS
### Platform
Browser
### Operating system
_No response_
### Browser and version
_No response_
### Docker (if applicable)
_No response_
### Additional context
I'm running the following image on a Docker Swarm setup: chatwoot/chatwoot:v3.2.0-ce
[CW-2823](https://linear.app/chatwoot/issue/CW-2823/whatsapp-interactive-messages-with-button-texts-over-limit-are)
Contributor guide
Research direction
Start at the Chatwoot API entry point for WhatsApp "Options" interactive messages and trace how button text is handled before message creation. Compare the stated 24-character WhatsApp Cloud API limit with the expected behavior, then verify that an over-limit request returns an error and does not create a conversation message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100