odoo-addon-mail-gateway-whatsapp 16.0.1.1.0.9__py3-none-any.whl → 17.0.1.0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/mail_gateway_whatsapp/README.rst +61 -45
- odoo/addons/mail_gateway_whatsapp/__manifest__.py +2 -6
- odoo/addons/mail_gateway_whatsapp/i18n/es.po +124 -136
- odoo/addons/mail_gateway_whatsapp/i18n/it.po +3 -13
- odoo/addons/mail_gateway_whatsapp/i18n/mail_gateway_whatsapp.pot +2 -23
- odoo/addons/mail_gateway_whatsapp/models/__init__.py +1 -1
- odoo/addons/mail_gateway_whatsapp/models/{mail_channel.py → discuss_channel.py} +5 -8
- odoo/addons/mail_gateway_whatsapp/models/mail_gateway_whatsapp.py +21 -33
- odoo/addons/mail_gateway_whatsapp/models/mail_thread.py +3 -7
- odoo/addons/mail_gateway_whatsapp/readme/CONFIGURE.md +35 -0
- odoo/addons/mail_gateway_whatsapp/readme/CONTRIBUTORS.md +7 -0
- odoo/addons/mail_gateway_whatsapp/readme/{CREDITS.rst → CREDITS.md} +2 -1
- odoo/addons/mail_gateway_whatsapp/readme/{DESCRIPTION.rst → DESCRIPTION.md} +2 -2
- odoo/addons/mail_gateway_whatsapp/readme/ROADMAP.md +4 -0
- odoo/addons/mail_gateway_whatsapp/readme/USAGE.md +3 -0
- odoo/addons/mail_gateway_whatsapp/static/description/index.html +55 -40
- odoo/addons/mail_gateway_whatsapp/static/src/components/message/message.xml +2 -2
- odoo/addons/mail_gateway_whatsapp/static/src/components/message/message_patch.esm.js +17 -0
- odoo/addons/mail_gateway_whatsapp/static/src/components/phone_field/phone_field.esm.js +1 -1
- odoo/addons/mail_gateway_whatsapp/static/src/components/phone_field/phone_field.xml +2 -2
- odoo/addons/mail_gateway_whatsapp/static/src/components/send_whatsapp_button/send_whatsapp_button.esm.js +3 -3
- odoo/addons/mail_gateway_whatsapp/tests/test_mail_gateway_whatsapp.py +10 -8
- odoo/addons/mail_gateway_whatsapp/tools/const.py +1 -1
- odoo/addons/mail_gateway_whatsapp/views/mail_gateway.xml +7 -10
- odoo/addons/mail_gateway_whatsapp/views/mail_whatsapp_template_views.xml +11 -26
- odoo/addons/mail_gateway_whatsapp/wizards/mail_compose_gateway_message.py +1 -3
- odoo/addons/mail_gateway_whatsapp/wizards/mail_compose_gateway_message.xml +2 -6
- odoo/addons/mail_gateway_whatsapp/wizards/whatsapp_composer.py +1 -2
- odoo/addons/mail_gateway_whatsapp/wizards/whatsapp_composer.xml +4 -11
- {odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.9.dist-info → odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info}/METADATA +69 -52
- odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info/RECORD +46 -0
- {odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.9.dist-info → odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info}/WHEEL +1 -1
- odoo_addon_mail_gateway_whatsapp-17.0.1.0.0.2.dist-info/top_level.txt +1 -0
- odoo/addons/mail_gateway_whatsapp/i18n/es_VE.po +0 -1181
- odoo/addons/mail_gateway_whatsapp/readme/CONFIGURE.rst +0 -31
- odoo/addons/mail_gateway_whatsapp/readme/CONTRIBUTORS.rst +0 -5
- odoo/addons/mail_gateway_whatsapp/readme/ROADMAP.rst +0 -4
- odoo/addons/mail_gateway_whatsapp/readme/USAGE.rst +0 -3
- odoo/addons/mail_gateway_whatsapp/static/src/models/message.esm.js +0 -21
- odoo/addons/mail_gateway_whatsapp/static/src/models/message_view.esm.js +0 -25
- odoo/addons/mail_gateway_whatsapp/static/src/models/notification.esm.js +0 -25
- odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.9.dist-info/RECORD +0 -49
- odoo_addon_mail_gateway_whatsapp-16.0.1.1.0.9.dist-info/top_level.txt +0 -1
|
@@ -6,7 +6,7 @@ msgid ""
|
|
|
6
6
|
msgstr ""
|
|
7
7
|
"Project-Id-Version: Odoo Server 16.0\n"
|
|
8
8
|
"Report-Msgid-Bugs-To: \n"
|
|
9
|
-
"PO-Revision-Date: 2025-
|
|
9
|
+
"PO-Revision-Date: 2025-01-09 13:06+0000\n"
|
|
10
10
|
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
|
|
11
11
|
"Language-Team: none\n"
|
|
12
12
|
"Language: it\n"
|
|
@@ -14,7 +14,7 @@ msgstr ""
|
|
|
14
14
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
15
15
|
"Content-Transfer-Encoding: \n"
|
|
16
16
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
|
17
|
-
"X-Generator: Weblate 5.
|
|
17
|
+
"X-Generator: Weblate 5.6.2\n"
|
|
18
18
|
|
|
19
19
|
#. module: mail_gateway_whatsapp
|
|
20
20
|
#: model_terms:ir.ui.view,arch_db:mail_gateway_whatsapp.mail_gateway_form_view
|
|
@@ -111,7 +111,7 @@ msgstr "Azerbaigiano"
|
|
|
111
111
|
#. module: mail_gateway_whatsapp
|
|
112
112
|
#: model_terms:ir.ui.view,arch_db:mail_gateway_whatsapp.view_mail_whatsapp_template_form
|
|
113
113
|
msgid "Back to draft"
|
|
114
|
-
msgstr "
|
|
114
|
+
msgstr "Ritorna a bozza"
|
|
115
115
|
|
|
116
116
|
#. module: mail_gateway_whatsapp
|
|
117
117
|
#: model:ir.model.fields.selection,name:mail_gateway_whatsapp.selection__mail_whatsapp_template__language__bn
|
|
@@ -699,21 +699,11 @@ msgstr "Contenuto messaggio"
|
|
|
699
699
|
msgid "Message Delivery error"
|
|
700
700
|
msgstr "Errore di consegna messaggio"
|
|
701
701
|
|
|
702
|
-
#. module: mail_gateway_whatsapp
|
|
703
|
-
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_search
|
|
704
|
-
msgid "Message Search"
|
|
705
|
-
msgstr "Ricerca messaggio"
|
|
706
|
-
|
|
707
702
|
#. module: mail_gateway_whatsapp
|
|
708
703
|
#: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_content
|
|
709
704
|
msgid "Message content, to be used only in searches"
|
|
710
705
|
msgstr "Contenuto messaggio, da utilizzare solo nelle ricerche"
|
|
711
706
|
|
|
712
|
-
#. module: mail_gateway_whatsapp
|
|
713
|
-
#: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_search
|
|
714
|
-
msgid "Message search, to be used only in searches"
|
|
715
|
-
msgstr "Ricerca messaggio, da utilizzare solo nelle ricerche"
|
|
716
|
-
|
|
717
707
|
#. module: mail_gateway_whatsapp
|
|
718
708
|
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_ids
|
|
719
709
|
msgid "Messages"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
#
|
|
5
5
|
msgid ""
|
|
6
6
|
msgstr ""
|
|
7
|
-
"Project-Id-Version: Odoo Server
|
|
7
|
+
"Project-Id-Version: Odoo Server 17.0\n"
|
|
8
8
|
"Report-Msgid-Bugs-To: \n"
|
|
9
9
|
"Last-Translator: \n"
|
|
10
10
|
"Language-Team: \n"
|
|
@@ -254,7 +254,7 @@ msgid "Disabled"
|
|
|
254
254
|
msgstr ""
|
|
255
255
|
|
|
256
256
|
#. module: mail_gateway_whatsapp
|
|
257
|
-
#: model:ir.model,name:mail_gateway_whatsapp.
|
|
257
|
+
#: model:ir.model,name:mail_gateway_whatsapp.model_discuss_channel
|
|
258
258
|
msgid "Discussion Channel"
|
|
259
259
|
msgstr ""
|
|
260
260
|
|
|
@@ -570,12 +570,6 @@ msgstr ""
|
|
|
570
570
|
msgid "Lao"
|
|
571
571
|
msgstr ""
|
|
572
572
|
|
|
573
|
-
#. module: mail_gateway_whatsapp
|
|
574
|
-
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_mail_whatsapp_template____last_update
|
|
575
|
-
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_whatsapp_composer____last_update
|
|
576
|
-
msgid "Last Modified on"
|
|
577
|
-
msgstr ""
|
|
578
|
-
|
|
579
573
|
#. module: mail_gateway_whatsapp
|
|
580
574
|
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_mail_whatsapp_template__write_uid
|
|
581
575
|
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_whatsapp_composer__write_uid
|
|
@@ -623,11 +617,6 @@ msgstr ""
|
|
|
623
617
|
msgid "Mail WhatsApp template"
|
|
624
618
|
msgstr ""
|
|
625
619
|
|
|
626
|
-
#. module: mail_gateway_whatsapp
|
|
627
|
-
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_main_attachment_id
|
|
628
|
-
msgid "Main Attachment"
|
|
629
|
-
msgstr ""
|
|
630
|
-
|
|
631
620
|
#. module: mail_gateway_whatsapp
|
|
632
621
|
#: model:ir.model.fields.selection,name:mail_gateway_whatsapp.selection__mail_whatsapp_template__language__ms
|
|
633
622
|
msgid "Malay"
|
|
@@ -663,21 +652,11 @@ msgstr ""
|
|
|
663
652
|
msgid "Message Delivery error"
|
|
664
653
|
msgstr ""
|
|
665
654
|
|
|
666
|
-
#. module: mail_gateway_whatsapp
|
|
667
|
-
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_search
|
|
668
|
-
msgid "Message Search"
|
|
669
|
-
msgstr ""
|
|
670
|
-
|
|
671
655
|
#. module: mail_gateway_whatsapp
|
|
672
656
|
#: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_content
|
|
673
657
|
msgid "Message content, to be used only in searches"
|
|
674
658
|
msgstr ""
|
|
675
659
|
|
|
676
|
-
#. module: mail_gateway_whatsapp
|
|
677
|
-
#: model:ir.model.fields,help:mail_gateway_whatsapp.field_res_partner__message_search
|
|
678
|
-
msgid "Message search, to be used only in searches"
|
|
679
|
-
msgstr ""
|
|
680
|
-
|
|
681
660
|
#. module: mail_gateway_whatsapp
|
|
682
661
|
#: model:ir.model.fields,field_description:mail_gateway_whatsapp.field_res_partner__message_ids
|
|
683
662
|
msgid "Messages"
|
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
3
3
|
|
|
4
4
|
from odoo import models
|
|
5
|
-
from odoo.
|
|
5
|
+
from odoo.tools.misc import file_path
|
|
6
6
|
|
|
7
7
|
from odoo.addons.base.models.avatar_mixin import get_hsl_from_seed
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
11
|
-
|
|
12
|
-
_inherit = "mail.channel"
|
|
10
|
+
class DiscussChannel(models.Model):
|
|
11
|
+
_inherit = "discuss.channel"
|
|
13
12
|
|
|
14
13
|
def _generate_avatar_gateway(self):
|
|
15
14
|
if self.gateway_id.gateway_type == "whatsapp":
|
|
16
|
-
path =
|
|
17
|
-
|
|
18
|
-
)
|
|
19
|
-
with open(path, "r") as f:
|
|
15
|
+
path = file_path("mail_gateway_whatsapp/static/description/icon.svg")
|
|
16
|
+
with open(path) as f:
|
|
20
17
|
avatar = f.read()
|
|
21
18
|
|
|
22
19
|
bgcolor = get_hsl_from_seed(self.uuid)
|
|
@@ -88,13 +88,10 @@ class MailGatewayWhatsappService(models.AbstractModel):
|
|
|
88
88
|
image_id = message.get(key).get("id")
|
|
89
89
|
if image_id:
|
|
90
90
|
image_info_request = requests.get(
|
|
91
|
-
"https://graph.facebook.com/
|
|
92
|
-
|
|
93
|
-
chat.gateway_id.whatsapp_version,
|
|
94
|
-
image_id,
|
|
95
|
-
),
|
|
91
|
+
f"https://graph.facebook.com/"
|
|
92
|
+
f"v{chat.gateway_id.whatsapp_version}/{image_id}",
|
|
96
93
|
headers={
|
|
97
|
-
"Authorization": "Bearer
|
|
94
|
+
"Authorization": f"Bearer {chat.gateway_id.token}",
|
|
98
95
|
},
|
|
99
96
|
timeout=10,
|
|
100
97
|
proxies=self._get_proxies(),
|
|
@@ -127,17 +124,19 @@ class MailGatewayWhatsappService(models.AbstractModel):
|
|
|
127
124
|
if message.get("location"):
|
|
128
125
|
body += (
|
|
129
126
|
'<a target="_blank" href="https://www.google.com/'
|
|
130
|
-
'maps/search/?api=1&query
|
|
131
|
-
|
|
132
|
-
message["location"]["latitude"],
|
|
133
|
-
message["location"]["longitude"],
|
|
134
|
-
)
|
|
127
|
+
f'maps/search/?api=1&query={message["location"]["latitude"]},'
|
|
128
|
+
f'{message["location"]["longitude"]}">Location</a>'
|
|
135
129
|
)
|
|
136
130
|
if message.get("contacts"):
|
|
137
131
|
pass
|
|
138
132
|
if len(body) > 0 or attachments:
|
|
139
133
|
author = self._get_author(chat.gateway_id, value)
|
|
140
|
-
|
|
134
|
+
if author._name == "mail.guest":
|
|
135
|
+
chat = chat.with_user(self.env.ref("base.public_user").id).with_context(
|
|
136
|
+
guest=author
|
|
137
|
+
)
|
|
138
|
+
# TODO: Check the sudo...
|
|
139
|
+
new_message = chat.sudo().message_post(
|
|
141
140
|
body=body,
|
|
142
141
|
author_id=author and author._name == "res.partner" and author.id,
|
|
143
142
|
gateway_type="whatsapp",
|
|
@@ -208,13 +207,10 @@ class MailGatewayWhatsappService(models.AbstractModel):
|
|
|
208
207
|
)
|
|
209
208
|
|
|
210
209
|
response = requests.post(
|
|
211
|
-
"https://graph.facebook.com/
|
|
212
|
-
|
|
213
|
-
gateway.whatsapp_version,
|
|
214
|
-
gateway.whatsapp_from_phone,
|
|
215
|
-
),
|
|
210
|
+
f"https://graph.facebook.com/"
|
|
211
|
+
f"v{gateway.whatsapp_version}/{gateway.whatsapp_from_phone}/media",
|
|
216
212
|
headers={
|
|
217
|
-
"Authorization": "Bearer
|
|
213
|
+
"Authorization": f"Bearer {gateway.token}",
|
|
218
214
|
"content-type": m.content_type,
|
|
219
215
|
},
|
|
220
216
|
data=m,
|
|
@@ -223,12 +219,9 @@ class MailGatewayWhatsappService(models.AbstractModel):
|
|
|
223
219
|
)
|
|
224
220
|
response.raise_for_status()
|
|
225
221
|
response = requests.post(
|
|
226
|
-
"https://graph.facebook.com/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
gateway.whatsapp_from_phone,
|
|
230
|
-
),
|
|
231
|
-
headers={"Authorization": "Bearer %s" % gateway.token},
|
|
222
|
+
f"https://graph.facebook.com/"
|
|
223
|
+
f"v{gateway.whatsapp_version}/{gateway.whatsapp_from_phone}/messages",
|
|
224
|
+
headers={"Authorization": f"Bearer {gateway.token}"},
|
|
232
225
|
json=self._send_payload(
|
|
233
226
|
record.gateway_channel_id,
|
|
234
227
|
media_id=response.json()["id"],
|
|
@@ -243,12 +236,9 @@ class MailGatewayWhatsappService(models.AbstractModel):
|
|
|
243
236
|
body = self._get_message_body(record)
|
|
244
237
|
if body:
|
|
245
238
|
response = requests.post(
|
|
246
|
-
"https://graph.facebook.com/
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
gateway.whatsapp_from_phone,
|
|
250
|
-
),
|
|
251
|
-
headers={"Authorization": "Bearer %s" % gateway.token},
|
|
239
|
+
f"https://graph.facebook.com/"
|
|
240
|
+
f"v{gateway.whatsapp_version}/{gateway.whatsapp_from_phone}/messages",
|
|
241
|
+
headers={"Authorization": f"Bearer {gateway.token}"},
|
|
252
242
|
json=self._send_payload(record.gateway_channel_id, body=body),
|
|
253
243
|
timeout=10,
|
|
254
244
|
proxies=self._get_proxies(),
|
|
@@ -264,9 +254,7 @@ class MailGatewayWhatsappService(models.AbstractModel):
|
|
|
264
254
|
_("Unable to send the whatsapp message")
|
|
265
255
|
) from exc
|
|
266
256
|
else:
|
|
267
|
-
_logger.warning(
|
|
268
|
-
"Issue sending message with id {}: {}".format(record.id, exc)
|
|
269
|
-
)
|
|
257
|
+
_logger.warning(f"Issue sending message with id {record.id}: {exc}")
|
|
270
258
|
record.sudo().write(
|
|
271
259
|
{"notification_status": "exception", "failure_reason": exc}
|
|
272
260
|
)
|
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
from odoo import _, models
|
|
5
5
|
from odoo.exceptions import UserError
|
|
6
6
|
|
|
7
|
-
from odoo.addons.phone_validation.tools import phone_validation
|
|
8
|
-
|
|
9
7
|
|
|
10
8
|
class MailThread(models.AbstractModel):
|
|
11
|
-
|
|
12
9
|
_inherit = "mail.thread"
|
|
13
10
|
|
|
14
11
|
def _get_whatsapp_channel_vals(self, token, gateway, partner):
|
|
@@ -22,12 +19,11 @@ class MailThread(models.AbstractModel):
|
|
|
22
19
|
return result
|
|
23
20
|
|
|
24
21
|
def _whatsapp_get_channel(self, field_name, gateway):
|
|
25
|
-
|
|
26
|
-
sanitize_res = phone_validation.phone_sanitize_numbers_w_record([phone], self)
|
|
27
|
-
sanitized_number = sanitize_res[phone].get("sanitized")
|
|
22
|
+
sanitized_number = self._phone_format(number=self[field_name])
|
|
28
23
|
if not sanitized_number:
|
|
29
24
|
raise UserError(_("Phone cannot be sanitized"))
|
|
30
|
-
|
|
25
|
+
# Avoid the plus sign prefix to match the whatsapp token
|
|
26
|
+
sanitized_number = sanitized_number.replace("+", "")
|
|
31
27
|
partner = self._whatsapp_get_partner()
|
|
32
28
|
if not self.env["res.partner.gateway.channel"].search(
|
|
33
29
|
[
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
## First steps
|
|
2
|
+
|
|
3
|
+
You need to create a WhatsApp Business Account (WABA), a Meta App and
|
|
4
|
+
define a phone number. You can follow this
|
|
5
|
+
[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®ion=emea&scrolled=false&session_id=1jLoVJNU6iVMaw3ml&site=developers).
|
|
6
|
+
|
|
7
|
+
If you create a test Business Account, passwords will change every 24
|
|
8
|
+
hours.
|
|
9
|
+
|
|
10
|
+
In order to make the webhook accessible, the system must be public.
|
|
11
|
+
|
|
12
|
+
## Configure the gateway
|
|
13
|
+
|
|
14
|
+
Once you have created the Meta App, you need to add the gateway and
|
|
15
|
+
webhook. In order to make it you must follow this steps:
|
|
16
|
+
|
|
17
|
+
- Access Settings \> Emails \> Mail Gateway
|
|
18
|
+
- Create a Gateway of type WhatsApp
|
|
19
|
+
|
|
20
|
+
> - Use the Meta App authentication key as Token field
|
|
21
|
+
> - Use the Meta App Phone Number ID as Whatsapp from Phone field
|
|
22
|
+
> - Use the Meta Account Business ID as Whatsapp account field (only if
|
|
23
|
+
> you need sync templates)
|
|
24
|
+
> - Write your own Webhook key
|
|
25
|
+
> - Use the Application Secret Key on Whatsapp Security Key. It will be
|
|
26
|
+
> used in order to validate the data
|
|
27
|
+
> - Press the Integrate Webhook Key. In this case, it will not integrate
|
|
28
|
+
> it, we need to make it manually
|
|
29
|
+
> - Copy the webhook URL
|
|
30
|
+
|
|
31
|
+
- Access [Facebook Apps website](https://developers.facebook.com/apps/)
|
|
32
|
+
- Access your App then Whatsapp \> Configuration
|
|
33
|
+
- Create your webhook using your URL and put the Whatsapp Security Key
|
|
34
|
+
as validation Key
|
|
35
|
+
- Administer the Webhook and activate the messages webhook
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
This work has been funded by AEOdoo (Asociación Española de Odoo -
|
|
1
|
+
This work has been funded by AEOdoo (Asociación Española de Odoo -
|
|
2
|
+
<https://www.aeodoo.org>)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
5
5
|
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
|
6
|
-
<title>
|
|
6
|
+
<title>README.rst</title>
|
|
7
7
|
<style type="text/css">
|
|
8
8
|
|
|
9
9
|
/*
|
|
@@ -360,19 +360,24 @@ ul.auto-toc {
|
|
|
360
360
|
</style>
|
|
361
361
|
</head>
|
|
362
362
|
<body>
|
|
363
|
-
<div class="document"
|
|
364
|
-
<h1 class="title">Mail Whatsapp Gateway</h1>
|
|
363
|
+
<div class="document">
|
|
365
364
|
|
|
365
|
+
|
|
366
|
+
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
|
|
367
|
+
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
|
|
368
|
+
</a>
|
|
369
|
+
<div class="section" id="mail-whatsapp-gateway">
|
|
370
|
+
<h1>Mail Whatsapp Gateway</h1>
|
|
366
371
|
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
367
372
|
!! This file is generated by oca-gen-addon-readme !!
|
|
368
373
|
!! changes will be overwritten. !!
|
|
369
374
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
370
|
-
!! source digest: sha256:
|
|
375
|
+
!! source digest: sha256:abc9cf8f5146c06cb1a2171d01ee1797a2f5a092bc0dd29c5e39106dadc14efd
|
|
371
376
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
|
372
|
-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/
|
|
377
|
+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/17.0/mail_gateway_whatsapp"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_gateway_whatsapp"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
|
373
378
|
<p>This module allows to respond whatsapp chats.</p>
|
|
374
|
-
<p>This way, a group of users can respond customers or any other set
|
|
375
|
-
|
|
379
|
+
<p>This way, a group of users can respond customers or any other set of
|
|
380
|
+
partners in an integrated way.</p>
|
|
376
381
|
<p><strong>Table of contents</strong></p>
|
|
377
382
|
<div class="contents local topic" id="contents">
|
|
378
383
|
<ul class="simple">
|
|
@@ -394,76 +399,84 @@ of partners in an integrated way.</p>
|
|
|
394
399
|
</ul>
|
|
395
400
|
</div>
|
|
396
401
|
<div class="section" id="configuration">
|
|
397
|
-
<
|
|
402
|
+
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
|
|
398
403
|
<div class="section" id="first-steps">
|
|
399
|
-
<
|
|
400
|
-
<p>You need to create a WhatsApp Business Account (WABA), a Meta App and
|
|
401
|
-
You can follow this
|
|
402
|
-
<
|
|
404
|
+
<h3><a class="toc-backref" href="#toc-entry-2">First steps</a></h3>
|
|
405
|
+
<p>You need to create a WhatsApp Business Account (WABA), a Meta App and
|
|
406
|
+
define a phone number. You can follow this
|
|
407
|
+
<a class="reference external" href="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">steps</a>.</p>
|
|
408
|
+
<p>If you create a test Business Account, passwords will change every 24
|
|
409
|
+
hours.</p>
|
|
403
410
|
<p>In order to make the webhook accessible, the system must be public.</p>
|
|
404
411
|
</div>
|
|
405
412
|
<div class="section" id="configure-the-gateway">
|
|
406
|
-
<
|
|
407
|
-
<p>Once you have created the Meta App, you need to add the gateway and
|
|
408
|
-
In order to make it you must follow this steps:</p>
|
|
413
|
+
<h3><a class="toc-backref" href="#toc-entry-3">Configure the gateway</a></h3>
|
|
414
|
+
<p>Once you have created the Meta App, you need to add the gateway and
|
|
415
|
+
webhook. In order to make it you must follow this steps:</p>
|
|
409
416
|
<ul class="simple">
|
|
410
|
-
<li>Access
|
|
411
|
-
<li>Create a Gateway of type
|
|
417
|
+
<li>Access Settings > Emails > Mail Gateway</li>
|
|
418
|
+
<li>Create a Gateway of type WhatsApp</li>
|
|
412
419
|
</ul>
|
|
420
|
+
<!-- -->
|
|
413
421
|
<blockquote>
|
|
414
422
|
<ul class="simple">
|
|
415
|
-
<li>Use the Meta App authentication key as
|
|
416
|
-
<li>Use the Meta App Phone Number ID as
|
|
417
|
-
<li>Use the Meta Account Business ID as
|
|
418
|
-
|
|
419
|
-
<li>
|
|
420
|
-
<li>
|
|
423
|
+
<li>Use the Meta App authentication key as Token field</li>
|
|
424
|
+
<li>Use the Meta App Phone Number ID as Whatsapp from Phone field</li>
|
|
425
|
+
<li>Use the Meta Account Business ID as Whatsapp account field (only if
|
|
426
|
+
you need sync templates)</li>
|
|
427
|
+
<li>Write your own Webhook key</li>
|
|
428
|
+
<li>Use the Application Secret Key on Whatsapp Security Key. It will be
|
|
429
|
+
used in order to validate the data</li>
|
|
430
|
+
<li>Press the Integrate Webhook Key. In this case, it will not
|
|
431
|
+
integrate it, we need to make it manually</li>
|
|
421
432
|
<li>Copy the webhook URL</li>
|
|
422
433
|
</ul>
|
|
423
434
|
</blockquote>
|
|
424
435
|
<ul class="simple">
|
|
425
|
-
<li>Access <a class="reference external" href="https://developers.facebook.com/apps/">Facebook Apps
|
|
426
|
-
|
|
427
|
-
<li>
|
|
436
|
+
<li>Access <a class="reference external" href="https://developers.facebook.com/apps/">Facebook Apps
|
|
437
|
+
website</a></li>
|
|
438
|
+
<li>Access your App then Whatsapp > Configuration</li>
|
|
439
|
+
<li>Create your webhook using your URL and put the Whatsapp Security Key
|
|
440
|
+
as validation Key</li>
|
|
428
441
|
<li>Administer the Webhook and activate the messages webhook</li>
|
|
429
442
|
</ul>
|
|
430
443
|
</div>
|
|
431
444
|
</div>
|
|
432
445
|
<div class="section" id="usage">
|
|
433
|
-
<
|
|
446
|
+
<h2><a class="toc-backref" href="#toc-entry-4">Usage</a></h2>
|
|
434
447
|
<ol class="arabic simple">
|
|
435
|
-
<li>Access
|
|
448
|
+
<li>Access Gateway</li>
|
|
436
449
|
<li>Wait until someone starts a conversation.</li>
|
|
437
450
|
<li>Now you will be able to respond and receive messages to this person.</li>
|
|
438
451
|
</ol>
|
|
439
452
|
</div>
|
|
440
453
|
<div class="section" id="known-issues-roadmap">
|
|
441
|
-
<
|
|
454
|
+
<h2><a class="toc-backref" href="#toc-entry-5">Known issues / Roadmap</a></h2>
|
|
442
455
|
<p><strong>WhatsApp templates</strong></p>
|
|
443
456
|
<ul class="simple">
|
|
444
|
-
<li>Add support for
|
|
445
|
-
<li>Add support for
|
|
457
|
+
<li>Add support for Variables</li>
|
|
458
|
+
<li>Add support for Buttons</li>
|
|
446
459
|
</ul>
|
|
447
460
|
</div>
|
|
448
461
|
<div class="section" id="bug-tracker">
|
|
449
|
-
<
|
|
462
|
+
<h2><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h2>
|
|
450
463
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
|
451
464
|
In case of trouble, please check there if your issue has already been reported.
|
|
452
465
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
|
453
|
-
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway_whatsapp%0Aversion:%
|
|
466
|
+
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_gateway_whatsapp%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
|
454
467
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
|
455
468
|
</div>
|
|
456
469
|
<div class="section" id="credits">
|
|
457
|
-
<
|
|
470
|
+
<h2><a class="toc-backref" href="#toc-entry-7">Credits</a></h2>
|
|
458
471
|
<div class="section" id="authors">
|
|
459
|
-
<
|
|
472
|
+
<h3><a class="toc-backref" href="#toc-entry-8">Authors</a></h3>
|
|
460
473
|
<ul class="simple">
|
|
461
474
|
<li>Creu Blanca</li>
|
|
462
475
|
<li>Dixmit</li>
|
|
463
476
|
</ul>
|
|
464
477
|
</div>
|
|
465
478
|
<div class="section" id="contributors">
|
|
466
|
-
<
|
|
479
|
+
<h3><a class="toc-backref" href="#toc-entry-9">Contributors</a></h3>
|
|
467
480
|
<ul>
|
|
468
481
|
<li><p class="first">Olga Marco <<a class="reference external" href="mailto:olga.marco@creublanca.es">olga.marco@creublanca.es</a>></p>
|
|
469
482
|
</li>
|
|
@@ -479,11 +492,12 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|
|
479
492
|
</ul>
|
|
480
493
|
</div>
|
|
481
494
|
<div class="section" id="other-credits">
|
|
482
|
-
<
|
|
483
|
-
<p>This work has been funded by AEOdoo (Asociación Española de Odoo -
|
|
495
|
+
<h3><a class="toc-backref" href="#toc-entry-10">Other credits</a></h3>
|
|
496
|
+
<p>This work has been funded by AEOdoo (Asociación Española de Odoo -
|
|
497
|
+
<a class="reference external" href="https://www.aeodoo.org">https://www.aeodoo.org</a>)</p>
|
|
484
498
|
</div>
|
|
485
499
|
<div class="section" id="maintainers">
|
|
486
|
-
<
|
|
500
|
+
<h3><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h3>
|
|
487
501
|
<p>This module is maintained by the OCA.</p>
|
|
488
502
|
<a class="reference external image-reference" href="https://odoo-community.org">
|
|
489
503
|
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
|
@@ -491,10 +505,11 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|
|
491
505
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|
492
506
|
mission is to support the collaborative development of Odoo features and
|
|
493
507
|
promote its widespread use.</p>
|
|
494
|
-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/
|
|
508
|
+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/17.0/mail_gateway_whatsapp">OCA/social</a> project on GitHub.</p>
|
|
495
509
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
|
496
510
|
</div>
|
|
497
511
|
</div>
|
|
498
512
|
</div>
|
|
513
|
+
</div>
|
|
499
514
|
</body>
|
|
500
515
|
</html>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
2
|
<templates xml:space="preserve">
|
|
3
|
-
<t t-inherit="mail.
|
|
3
|
+
<t t-inherit="mail.Message.notification" t-inherit-mode="extension">
|
|
4
4
|
<xpath expr="//div" position="after">
|
|
5
5
|
<i
|
|
6
6
|
class="fa fa-whatsapp text-info"
|
|
7
|
-
t-if="
|
|
7
|
+
t-if="message.gateway_type === 'whatsapp' and message.notifications.length === 0"
|
|
8
8
|
/>
|
|
9
9
|
</xpath>
|
|
10
10
|
</t>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* @odoo-module */
|
|
2
|
+
import {Message} from "@mail/core/common/message";
|
|
3
|
+
import {patch} from "@web/core/utils/patch";
|
|
4
|
+
import {url} from "@web/core/utils/urls";
|
|
5
|
+
|
|
6
|
+
patch(Message.prototype, {
|
|
7
|
+
get authorAvatarUrl() {
|
|
8
|
+
if (
|
|
9
|
+
this.message.gateway_type &&
|
|
10
|
+
this.message.gateway_type.includes("whatsapp") &&
|
|
11
|
+
!["partner", "guest"].includes(this.message.author?.type)
|
|
12
|
+
) {
|
|
13
|
+
return url("/mail_gateway_whatsapp/static/description/icon.png");
|
|
14
|
+
}
|
|
15
|
+
return super.authorAvatarUrl;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import {PhoneField} from "@web/views/fields/phone/phone_field";
|
|
4
4
|
import {SendWhatsappButton} from "@mail_gateway_whatsapp/components/send_whatsapp_button/send_whatsapp_button.esm";
|
|
5
5
|
import {patch} from "@web/core/utils/patch";
|
|
6
|
-
patch(PhoneField,
|
|
6
|
+
patch(PhoneField, {
|
|
7
7
|
components: {
|
|
8
8
|
...PhoneField.components,
|
|
9
9
|
SendWhatsappButton,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
<t t-inherit="web.PhoneField" t-inherit-mode="extension">
|
|
5
5
|
<xpath expr="//div[hasclass('o_phone_content')]//a" position="after">
|
|
6
|
-
<t t-if="props.enableButton and props.
|
|
6
|
+
<t t-if="props.enableButton and props.record.data[props.name].length > 0">
|
|
7
7
|
<SendWhatsappButton t-props="props" />
|
|
8
8
|
</t>
|
|
9
9
|
</xpath>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
<t t-inherit="web.FormPhoneField" t-inherit-mode="extension">
|
|
13
13
|
<xpath expr="//div[hasclass('o_phone_content')]" position="inside">
|
|
14
|
-
<t t-if="props.enableButton and props.
|
|
14
|
+
<t t-if="props.enableButton and props.record.data[props.name].length > 0">
|
|
15
15
|
<SendWhatsappButton t-props="props" />
|
|
16
16
|
</t>
|
|
17
17
|
</xpath>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** @odoo-module **/
|
|
2
2
|
|
|
3
3
|
import {useService} from "@web/core/utils/hooks";
|
|
4
|
-
|
|
4
|
+
import {_t} from "@web/core/l10n/translation";
|
|
5
5
|
const {Component, status} = owl;
|
|
6
6
|
|
|
7
7
|
export class SendWhatsappButton extends Component {
|
|
8
8
|
setup() {
|
|
9
9
|
this.action = useService("action");
|
|
10
10
|
this.user = useService("user");
|
|
11
|
-
this.title =
|
|
11
|
+
this.title = _t("Send Whatsapp Message");
|
|
12
12
|
}
|
|
13
13
|
get phoneHref() {
|
|
14
|
-
return "sms:" + this.props.
|
|
14
|
+
return "sms:" + this.props.record.data[this.props.name].replace(/\s+/g, "");
|
|
15
15
|
}
|
|
16
16
|
async onClick() {
|
|
17
17
|
await this.props.record.save();
|