[18.0][ADD] mail_gateway_telegram_standalone: New Module - Telegram Bot Integration#1824
Conversation
|
Hey @rousseldenis @pedrobaeza @alexey-pelykh - could you take a look at this when you have a chance? It’s the Telegram base module we talked about. |
|
I'm wondering: why not using |
mail_gateway_telegram handles chat with customers, while this sends outbound alerts to the chat. |
|
In fact, you can use it as you want. Check for example #1796, where we add the possibility for automations, and programatically sending of messages (this time, for WhatsApp, but it can be done the same for Telegram). |
Thanks for the feedback, @pedrobaeza. I want to make sure I’m heading in the right direction before I refactor. Is the following logic correct for the OCA standard? Inheritance: I will change the module to inherit from mail_gateway_telegram. Feature Set: I noticed the 'Update Webhook' button in the existing module. My 'Fetch Chats' logic uses getUpdates to proactively populate authorized Chat IDs. I propose adding this as a 'Discovery' feature alongside the existing webhook setup. Use Case: I will provide a simplified send_message API. This allows other functional modules (like sale or purchase) to send outbound alerts to these discovered chats without needing the full mail-thread overhead. Does this sound like the right architectural approach for Odoo 18.0?
|
|
Well, I think you can expand |
Hi @pedrobaeza, I've refactored the module to extend mail_gateway as suggested. However, during testing, I found that the "Fetch Chats" feature (getUpdates) fails when a Webhook is active, as Telegram doesn't allow both simultaneously. How would you suggest avoiding this conflict to stay aligned with OCA standards?
|
|
I would say to issue an exception in that case |
|
Hi @pedrobaeza, Thanks for the guidance. I have just pushed the refactored code: Inheritance: The module now correctly extends mail_gateway. Conflict Handling: As suggested, I've implemented a check so that if a Webhook is active, the "Fetch Chats" (getUpdates) method will raise a UserError/Exception explaining that Telegram doesn't support both simultaneously. Ready for your review whenever you have a moment! |
|
Thanks for all the changes. I think the only thing that rests is to rename the module to accommodate it to the new structure. |
Hi @pedrobaeza, That makes sense. Given that this module now serves as the foundation for others (providing the core API and discovery tools for modules like sale_telegram or purchase_telegram), what do you think about mail_gateway_telegram_base? If that works for you, I'll go ahead and perform the rename! |
|
I don't like too much |
Understood. I will proceed with your suggestion and rename the module to |
|
Hi @pedrobaeza, I've updated the module name to |
|
@rousseldenis PTAL? Thanks! |
|
This PR has the |
|
/ocabot merge nobump |
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
Congratulations, your PR was merged at 66251e2. Thanks a lot for contributing to OCA. ❤️ |


This PR introduces the
mail_gateway_telegram_standalonemodule for Odoo 18.0.Following the architectural advice from previous reviews in the
sale-workflowrepository (OCA/sale-workflow#3664), I have implemented this as a standalone base module withinsocial. This provides a reusable engine for Telegram integrations across the ecosystem.Key Features
/getUpdatesTelegram API to automatically populate authorized Chat IDs.send_message()method that other modules (Sales, Purchase, etc.) can call easily.rainbow_man.@rousseldenis, @pedrobaeza, and @alexey-pelykh