Feature: Add Facebook Ads Message Template Support for Chatwoot Integration #1461
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
🚀 Feature: Add Facebook Ads Message Template Support for Chatwoot Integration
This PR adds support for displaying Facebook Ads messages that arrive via WhatsApp in the Chatwoot integration, allowing agents to view and respond specifically to customers interacting with ads.
📋 Overview
This feature implements a template system to process Facebook ad messages arriving through WhatsApp, including:
🔧 Technical Implementation
Main Changes
1. Message handler enhancements (
src/apps/chatroot/consumers/waha/message.any.ts)isFacebookAd()method to detect Facebook ad messagesextractAdReply()to extract ad data from the WhatsApp payloadextractAdData()to process and normalize ad datagetFacebookAdMessage()to generate a template-formatted message2. Template system extension (
src/apps/chatroot/i18n/templates.ts)WA_TO_CW_MESSAGE_FACEBOOK_AD3. Internationalization Support
en-US.yaml):pt-BR.yaml):Ad Detection
**4. Verification
extendedTextMessage.contextInfo.externalAdReply5. Data Processing
📝 Main Features
Automatic Detection
Formatted Display
Media Processing
Internationalization
🎯 Use Cases
Customer Service
🔄 Processing Flow
externalAdReplywithout a payload✅ Testing Considerations
screenshot:

I just hope you enjoy some of the code if it's useful.