$ show OCA/social
This is the OCA/social repository, a collection of 15 Odoo addon modules for Odoo 18.0 that extend the Odoo Discuss and mail systems with external messaging integrations and social profile features. The core module, `mail_gateway`, provides an abstract framework for integrating external chat platforms (Telegram, WhatsApp, Instagram) into Odoo Discuss via webhooks, enabling bidirectional communication. Concrete gateway modules (`mail_gateway_telegram`, `mail_gateway_whatsapp`, `mail_gateway_instagram`, and `mail_gateway_telegram_standalone`) implement provider-specific APIs, including message sending, template management (WhatsApp), and webhook verification. Additional modules add social media profile fields to partners and companies (LinkedIn, Mastodon), audit activity cancellations and unlinks, control mention suggestions, route unhandled emails to a default thread, and extend marketing campaigns with budget tracking. The repository follows standard OCA addon structure with Python models, XML views, OWL/JavaScript component patches, wizards, security rules, and translations. It is not a standalone application but a set of modules designed to be installed in an Odoo instance.
The LLM identified 3 files worth highlighting for reuse:
Defines the abstract base class `mail.gateway.abstract` that all gateway providers must implement. It declares the interface methods `_send`, `_receive_update`, `_verify_update`, `_get_channel`, `_get_author`, and `_post_process_message`. The concrete gateway is resolved dynamically via `self.env[f'mail.gateway.{gateway.gateway_type}']`, enabling clean polymorphic dispatch. This pattern is reusable for any Odoo module that needs to support multiple external service providers with a common interface.
Implements the public webhook endpoint at `/gateway/<usage>/<token>/update` that accepts GET (for verification challenges) and POST (for incoming updates) requests. It routes requests based on the gateway token, verifies HMAC signatures (for WhatsApp/Instagram) or secret tokens (for Telegram), and delegates processing to the appropriate gateway service. This controller is a reusable pattern for any Odoo module that needs to expose a secure, token-authenticated webhook for external API callbacks.
Models WhatsApp message templates with fields for body, header, footer, buttons (quick reply, call number, URL), variables, and language. Implements a state machine (draft, pending, approved, rejected, etc.) and provides methods to sync templates with the Meta WhatsApp Business API. Includes validation for button limits, placeholder rules, and unique names. This component is a well-structured example of managing external API entities with local state tracking and synchronization.