Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2518174
[FIX] mail_gateway: process webhooks as the webhook user
DucTruongKomit Oct 2, 2026
b04d7f8
[IMP] mail_gateway: only allow gateway users as webhook user
DucTruongKomit Oct 2, 2026
525af48
[ADD] mail_broker_whatsapp
olgamarcocb May 25, 2022
ce3517d
[IMP] mail_broker_whatsapp: Improve phone widget
etobella Jul 11, 2022
2b86327
[IMP] mail_broker_whatsapp: Manage change of version of Facebook API
marcelsavegnago Nov 14, 2022
80dfba6
[FIX] mail_broker_whatsapp: pre-commit changes
etobella Nov 30, 2022
2c86701
[IMP] mail_broker_whatsapp: Black, isort, prettier
etobella Feb 19, 2024
0a12ae4
[MIG] mail_broker_whatsapp: Migration to 16.0
etobella Feb 21, 2024
332a6ab
Added translation using Weblate (Italian)
mymage May 27, 2024
6b9c8bb
Added translation using Weblate (Spanish)
FranciscoFactorLibre Oct 3, 2024
0703e54
Translated using Weblate (Spanish)
PabloMartin32 Nov 14, 2024
ee9258e
[IMP] mail_gateway_whatsapp: Add support for WhatsApp templates If th…
carlos-lopez-tecnativa Nov 12, 2024
6896cd8
[IMP] mail_gateway: Fine-tune default values for gateway behavior rel…
carlos-lopez-tecnativa Nov 18, 2024
b92622b
Translated using Weblate (Italian)
mymage Jan 9, 2025
cd44483
[IMP] mail_gateway_whatsapp: pre-commit auto fixes
chienandalu Mar 18, 2025
ff55fac
[MIG] mail_gateway_whatsapp: Migration to 17.0
chienandalu Mar 18, 2025
b17ebb2
[IMP] mail_gateway_whatsapp: pre-commit auto fixes
CarlosRoca13 Aug 6, 2025
523b1ca
[MIG] mail_gateway_whatsapp: Migration to 18.0
CarlosRoca13 Aug 8, 2025
e868fca
[IMP] mail_gateway_whatsapp: Handle webhook updates for message statu…
carlos-lopez-tecnativa Sep 2, 2025
c5fd8ac
[IMP] mail_gateway_whatsapp: Handle errors when the message is not se…
carlos-lopez-tecnativa Feb 2, 2026
8a1bd0b
[IMP] mail_gateway_whatsapp: Add support for buttons and variables in…
carlos-lopez-tecnativa Sep 11, 2025
a3bf485
[IMP] mail_gateway_whatsapp: Add support for messages in server actions
pedrobaeza Dec 24, 2025
4f39b29
[FIX] mail_gateway_whatsapp: Avoid singleton error when creating channel
pedrobaeza Feb 25, 2026
33f6451
Translated using Weblate (Italian)
mymage Mar 2, 2026
a31d6a9
Use the existing template to process imported data.
bartacruz Mar 25, 2026
c3793e4
[18.0][FIX] mail_gateway_whatsapp: Mark incomming audios as voice. Wi…
bartacruz Mar 28, 2026
86f9339
Translated using Weblate (Spanish)
Ed-Spain Apr 12, 2026
eee8d52
[FIX] mail_gateway_whatsapp: Add parent_id when message is a response.
bartacruz Apr 9, 2026
7728a45
[FIX] mail_gateway_whatsapp: put captions of attachments into message…
bartacruz Mar 28, 2026
fcc4267
Added translation using Weblate (Galician)
chavaone Apr 23, 2026
c48240b
Translated using Weblate (Spanish)
Ed-Spain May 7, 2026
03c2acb
Added translation using Weblate (Portuguese (Brazil))
rodmad85 May 19, 2026
c017cfa
[IMP] mail_gateway_whatsapp: Update partner mobile when merging guest…
marcelsavegnago Oct 31, 2025
b3b9f5f
Translated using Weblate (Italian)
mymage Jun 30, 2026
3595f86
[FIX] mail_gateway_whatsapp: limit the gateway token searches to one …
Adridot Aug 21, 2026
d29ab38
[FIX] mail_gateway_whatsapp: preserve incoming text layout
Adridot Aug 19, 2026
bc2383b
[IMP] mail_gateway_whatsapp: convert the text formatting both ways
Adridot Sep 2, 2026
b2377f3
[MIG] mail_gateway_whatsapp: Migration to 19.0
DucTruongKomit Jun 2, 2026
351b74f
[FIX] mail_gateway_whatsapp: use notification_ids in the message temp…
CarlosRoca13 Oct 27, 2026
38688c5
[IMP] mail_gateway_whatsapp: Improve access
etobella Oct 26, 2026
ac6a407
[IMP] mail_gateway_whatsapp: add status whatsapp to track real messag…
CarlosRoca13 Oct 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mail_gateway/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Configuration
- Go to ``Settings / Technical / Email / Gateway``
- Create a gateway. Follow the instruction of the specific tab in order
to integrate it.
- The Webhook User processes the incoming messages. Keep the default
user (OdooBot) or choose a user of the ``Gateway / User`` group.
- Start receiving notifications

Usage
Expand Down
11 changes: 6 additions & 5 deletions mail_gateway/controllers/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def post_update(self, usage, token, *args, **kwargs):
("Content-Type", "application/json"),
],
)
# Use update_env and not with_user: the ORM checks some accesses
# with the transaction user (e.g. res.partner forbids sudo commands)
request.update_env(user=bot_data["webhook_user_id"])
return (
request.env[f"mail.gateway.{usage}"]
.with_user(bot_data["webhook_user_id"])
.with_company(bot_data["company_id"])
._receive_get_update(bot_data, request, **kwargs)
)
Expand All @@ -61,10 +63,9 @@ def post_update(self, usage, token, *args, **kwargs):
or "utf-8"
)
jsonrequest = json.loads(request.httprequest.get_data().decode(charset))
dispatcher = (
request.env[f"mail.gateway.{usage}"]
.with_user(bot_data["webhook_user_id"])
.with_context(no_gateway_notification=True)
request.update_env(user=bot_data["webhook_user_id"])
dispatcher = request.env[f"mail.gateway.{usage}"].with_context(
no_gateway_notification=True
)
if not dispatcher._verify_update(bot_data, jsonrequest):
_logger.warning(
Expand Down
5 changes: 4 additions & 1 deletion mail_gateway/models/mail_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class MailGateway(models.Model):
webhook_user_id = fields.Many2one(
"res.users",
default=lambda self: self.env.ref("base.user_root"),
help="User that will create the messages",
domain=lambda self: [
("all_group_ids", "in", self.env.ref("mail_gateway.gateway_user").ids)
],
help="User that will create the messages. It must be a gateway user.",
)
member_ids = fields.Many2many("res.users")
company_id = fields.Many2one(
Expand Down
2 changes: 2 additions & 0 deletions mail_gateway/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
- Go to `Settings / Technical / Email / Gateway`
- Create a gateway. Follow the instruction of the specific tab in order
to integrate it.
- The Webhook User processes the incoming messages. Keep the default
user (OdooBot) or choose a user of the `Gateway / User` group.
- Start receiving notifications
2 changes: 2 additions & 0 deletions mail_gateway/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<li>Go to <tt class="docutils literal">Settings / Technical / Email / Gateway</tt></li>
<li>Create a gateway. Follow the instruction of the specific tab in order
to integrate it.</li>
<li>The Webhook User processes the incoming messages. Keep the default
user (OdooBot) or choose a user of the <tt class="docutils literal">Gateway / User</tt> group.</li>
<li>Start receiving notifications</li>
</ul>
</div>
Expand Down
159 changes: 159 additions & 0 deletions mail_gateway_whatsapp/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=====================
Mail Whatsapp Gateway
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:bab45b25e75f6aa13fc1517b883ac07ff3195d4b05611041681af9f9f1a6ad11
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github
:target: https://github.com/OCA/mail/tree/19.0/mail_gateway_whatsapp
:alt: OCA/mail
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/mail-19-0/mail-19-0-mail_gateway_whatsapp
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/mail&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to respond whatsapp chats.

This way, a group of users can respond customers or any other set of
partners in an integrated way.

**Table of contents**

.. contents::
:local:

Configuration
=============

First steps
-----------

You need to create a WhatsApp Business Account (WABA), a Meta App and
define a phone number. You can follow this
`steps <https://developers.facebook.com/micro_site/url/?click_from_context_menu=true&country=ES&destination=https%3A%2F%2Fwww.facebook.com%2Fbusiness%2Fhelp%2F2087193751603668&event_type=click&last_nav_impression_id=0m3TRxrxOlly1eRmB&max_percent_page_viewed=22&max_viewport_height_px=1326&max_viewport_width_px=2560&orig_http_referrer=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fwhatsapp%2Fcloud-api%2Fget-started-for-bsps%3Flocale%3Den_US&orig_request_uri=https%3A%2F%2Fdevelopers.facebook.com%2Fajax%2Fpagelet%2Fgeneric.php%2FDeveloperNotificationsPayloadPagelet%3Ffb_dtsg_ag%3D--sanitized--%26data%3D%257B%2522businessUserID%2522%253Anull%252C%2522cursor%2522%253Anull%252C%2522length%2522%253A15%252C%2522clientRequestID%2522%253A%2522js_k6%2522%257D%26__usid%3D6-Trd7hi4itpm%253APrd7ifiub2tvy%253A0-Ard7g9twdm0p1-RV%253D6%253AF%253D%26locale%3Den_US%26jazoest%3D24920&region=emea&scrolled=false&session_id=1jLoVJNU6iVMaw3ml&site=developers>`__.

If you create a test Business Account, passwords will change every 24
hours.

In order to make the webhook accessible, the system must be public.

Configure the gateway
---------------------

Once you have created the Meta App, you need to add the gateway and
webhook. In order to make it you must follow this steps:

- Access Settings > Emails > Mail Gateway
- Create a Gateway of type WhatsApp

..

- Use the Meta App authentication key as Token field
- Use the Meta App Phone Number ID as Whatsapp from Phone field
- Use the Meta Account Business ID as Whatsapp account field (only if
you need sync templates)
- Write your own Webhook key
- Use the Application Secret Key on Whatsapp Security Key. It will be
used in order to validate the data
- Press the Integrate Webhook Key. In this case, it will not
integrate it, we need to make it manually
- Copy the webhook URL

- Access `Facebook Apps
website <https://developers.facebook.com/apps/>`__
- Access your App then Whatsapp > Configuration
- Create your webhook using your URL and put the Whatsapp Security Key
as validation Key
- Administer the Webhook and activate the messages webhook

Usage
=====

1. Access Gateway
2. Wait until someone starts a conversation.
3. Now you will be able to respond and receive messages to this person.

The delivery status reported by WhatsApp (sent, delivered or read) is
shown in the message notification popover. Failed messages are marked as
errors with the reason returned by WhatsApp.

Known issues / Roadmap
======================

**WhatsApp templates**

- Add support for Variables
- Add support for Buttons

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/mail/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/mail/issues/new?body=module:%20mail_gateway_whatsapp%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Creu Blanca
* Dixmit

Contributors
------------

- Olga Marco <olga.marco@creublanca.es>

- Enric Tobella <etobella@creublanca.es>

- `Tecnativa <https://www.tecnativa.com>`__:

- Carlos Lopez

Other credits
-------------

This work has been funded by AEOdoo (Asociación Española de Odoo -
https://www.aeodoo.org)

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/mail <https://github.com/OCA/mail/tree/19.0/mail_gateway_whatsapp>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions mail_gateway_whatsapp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import models
from . import tools

# from . import services
from . import wizards
28 changes: 28 additions & 0 deletions mail_gateway_whatsapp/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2022 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Mail Whatsapp Gateway",
"summary": "Set a gateway for WhatsApp",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca, Dixmit, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/mail",
"depends": ["mail_gateway", "phone_validation"],
"external_dependencies": {"python": ["requests_toolbelt"]},
"data": [
"security/security.xml",
"security/ir.model.access.csv",
"views/ir_actions_server_views.xml",
"wizards/whatsapp_composer.xml",
"wizards/mail_compose_gateway_message.xml",
"views/mail_whatsapp_template_views.xml",
"views/mail_gateway.xml",
],
"assets": {
"web.assets_backend": [
"mail_gateway_whatsapp/static/src/components/**/*",
"mail_gateway_whatsapp/static/src/models/**/*",
],
},
}
Loading
Loading