Commit Graph

6 Commits

Author SHA1 Message Date
Cayo P. R. Oliveira
76deea996d
chore: refactor incoming_message_baileys_service using composition and fix some failure points (#53)
* feat: implement connection update handling for Baileys

* feat: add message update handling for Baileys integration

* feat: implement message processing and handling for Baileys integration

* fix: clear message source ID from Redis when contact is not found

* fix: raise error when attachment file is not found during media handling

* refactor: reorganize includes in incoming_message_baileys_service

* feat: add helper methods for message handling in Baileys integration

* feat: include IncomingMessageServiceHelpers in MessagesUpdate module

* refactor: replace IncomingMessageServiceHelpers with BaileysHandlers::Helpers in connection_update, messages_update, and messages_upsert modules

* fix: mark message as unsupported when attachment file is not found

* refactor: remove unnecessary namespace for includes in IncomingMessageBaileysService

* refactor: add private visibility to methods in connection_update, helpers, messages_update, and messages_upsert modules

* refactor: preserve original message in handle_edited_content method

* fix: attachment error handling

* feat: implement conversation creation logic in set_conversation method

* refactor: remove unused error handling for attachment not found in messages update and upsert

* feat: update last seen timestamps in conversation on message status update

* feat: log warning for unsupported message update status in Baileys service

* chore: merge

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
2025-05-29 10:56:39 -03:00
Cayo P. R. Oliveira
8fc14186e0
feat: process Baileys attachments, fix contact name creation, and handle unsupported messages (#26)
* fix: return not_found status for missing messages in WhatsApp webhook

* feat: enhance message handling to support image attachments

* chore: Handle incoming whatsapp baileys service attachments and implement specs for images and videos

* fix: add file_content_type method to incoming baileys messages

* chore: specs for stickers, audio and files

* fix: handle media attachment errors

* chore: convert file_content_type to string when attaching media

* fix: add handling for attachment not found error in incoming message service

* chore: refactor file_content_type method and simplify filename method

* chore: update media attachment tests

* feat: baileys unsupported message alert (#27)

* feat: create alert message for unsupported message types

* chore: fail message when try send not supported type in baileys

* chore: add tests for unsupported message handling in Baileys service

* chore: correct spelling

* chore: NIT in spec name

* chore: remove unnecessary message reload in unsupported message type test

* feat: baileys support to send attachments (#28)

* feat: enhance message sending logic with support for attachments and interactive messages

* fix: update message format to use messageContent for text messages

* feat: attachment message sending

* fix: use strict encoding for attachment file download

* chore: streamline message sending logic and remove unused error classes

* chore: remove type from message sending logic

* chore: update message sending specs

* chore: raise MessageNotSentError instead of updating message status to failed

* chore: change baileys contact name preferences (#30)

* refactor: improve contact name handling and extraction from JID

* test: enhance message handling to update contact names based on pushName and verifiedBizName

* chore: update contact name condition to match phone number from JID

* chore: correct method name typo

* chore: correct variable names for phone number consistency in tests

* chore: update message payload structure and improve error handling in send_message

* test: re-add testing for error handling

* feat: enhance contact name handling and add self-message detection

* fix: ensure presence check for verified business name in contact name retrieval

* test: improve specs

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
Co-authored-by: Gabriel Jablonski <gabriel@fazer.ai>

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
Co-authored-by: Gabriel Jablonski <gabriel@fazer.ai>

* fix: try to disconnect baileys before destroy inbox (#29)

* fix: ensure proper disconnection of Baileys provider on channel destruction

* test: add callback tests for disconnecting channel provider in Whatsapp spec

* refactor: simplify condition for disconnecting Baileys provider on channel destruction

* refactor: enhance disconnect_channel_provider specs for Baileys provider

* test: verify channel destruction does not call disconnect_channel_provider

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>

---------

Co-authored-by: gabrieljablonski <contact@gabrieljablonski.com>
Co-authored-by: Gabriel Jablonski <gabriel@fazer.ai>
2025-04-25 16:39:17 -03:00
Cayo P. R. Oliveira
25670564eb
feat: add message update processing in IncomingMessageBaileysService (#20)
* feat: add message update processing in IncomingMessageBaileysService

* feat: implement message update handling in IncomingMessageBaileysService

* feat: add MessageNotFoundError for handling invalid update messages in IncomingMessageBaileysService

* chore: specs for message.update events and bug fixes

* chore: refactor message update handling in IncomingMessageBaileysService

* chore: nit remove redundant comment

* chore: enhance logging for unsupported message update statuses in IncomingMessageBaileysService and disabled metrics

* chore: message status update logic with transition checks

* chore: update status mapping for PENDING to sent in status_mapper

* chore: update status_mapper comments and fix case statement for status codes

* fix: logging for unsupported message updates in update_message_content method

* test: add specs for unsupported status transitions in messages.update event

* refactor: ensure message status is reloaded before assertion in messages.update event spec

* refactor: status variable in status_mapper method

* refactor: rename status_transition_allowed method to status_transition_allowed?

* refactor: streamline message creation in specs by using let! for setup

* feat: process webhook whatsapp await response (#21)

* feat: enhance WhatsApp webhook processing and error responses handling

* chore: correct spelling of 'WhatsApp' in webhook controller specs

* refactor: rename webhook processing method and improve error handling

* chore: update error handling in WhatsApp controller specs for specific exceptions

* refactor: remove handling for StandardError in WhatsApp controller specs

* refactor: simplify perform_whatsapp_events_job method

* chore: update response status from not_found to bad_request for invalid message

* refactor: update expectations for job processing in WhatsApp controller specs
2025-04-09 19:14:38 -03:00
Sojan Jose
29158e32fe
chore: Logger for non-existent WhatsApp channels (#11064)
- Add a warning logger for cases where we are getting webhook events for
inactive numbers.
- Add config to discard events for inactive numbers so that the meta
will stop sending events

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
2025-03-12 15:50:38 -07:00
Sojan Jose
a6c609f43d
feat: Support for Whatsapp Cloud API (#4938)
Ability to configure Whatsapp Cloud API Inboxes

fixes: #4712
2022-07-06 21:45:03 +02:00
Sojan Jose
bd7aeba484
chore: Provider API prototype (#3112)
Enabling Support for Whatsapp via 360Dialog as a prototype for the provider APIs. 

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-10-05 23:35:06 +05:30