odoo/enterprise#46942

Created by fw-bot
Merged at 482e86743558a42d96e8e22f4c7459ac0157bef7

Statuses:

label
odoo-dev:master-saas-16.3-integrate-whatsapp-reth-5t1j-fw
head
026938a265ce4490626e95b8f288e3f42e5eed1d
merged
2 years ago by Marketing, Thibault Delavallee (tde)
odoo/odoo odoo/enterprise odoo/documentation
saas-16.3 #131688 #45601
saas-16.4 #133973 #46704 #5721
17.0
18.0
saas-18.2
saas-18.3
saas-18.4
19.0
master #134377 #46942 #5730

[FW][ADD] whatsapp(_*): integrate WhatsApp

RATIONALE

WhatsApp is commonly used as a communication mechanism in a lot of countries
and a lot of businesses. Integrating it in Odoo is necessary to keep in touch
with the way people communicate nowaday.

SPECIFICATIONS

WhatsApp offers an API to send and receive messages. A new button is available
in Discuss to send WhatsApp messages. Customers answers are routed back to
Odoo with some configuration.

Due to some limitations it is implemented using 'discuss.channel' channels to
communicate between responsible (sales persons, ...) and customers. It is not
possible to discuss on records like Inbox / email as no context is provided.

Communication is done using two means: templates, validated on WhatsApp side
and free communication. Various rules exist to limit spam and unwanted message
sending, that are more or less implemented in this PR.

TECHNICAL SPECIFICATIONS

WhatsApp template

  • Send Whatsapp from any document by creating a WhatsApp template for that
    document;
  • We can only send a template if the user replies then we can do a normal
    message for 24 hours of the last message from the user;
  • it has fields that are required by https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates
  • select a model where this applied;
  • if a document PDF need to be attached then select the report id;
  • for dynamic values, you can use a User name, User mobile, Free text, Field
    of model;
  • Send for approval after creating it OR if it is already created in WhatsApp
    then use sync from WhatsApp phone;
  • If we send a message from the list view it will be sent by scheduled action

WhatsApp Phone Configuration

  • Add a new model where we add all configuration details
  • Also, add allowed companies and notify users to send notification
  • sync templates from WhatsApp in one click

Receive message

  • if we send any templates in the past 15 days then we create a new mail
    channel with the last template message document (In this case we also
    post one message in the document that the new channel is created)
  • else we create a channel with notify user set in WhatsApp phone configuration
  • We support text, documents, images, audio, video, location

Reaction to messages

  • right now we only support received Reaction

Send messages

  • Whatsapp is only allowed to send messages if there is any message from the
    user in the past 24 hours so we block type in channel if there is no replay
    from the user in the past 24 hours
  • We can send text, documents, images, audio and video

Blacklist by Whatsapp user

  • Use phone blacklist to block user
  • If the user sends text like "STOP", "UNSUBSCRIBE" and "STOP PROMOTIONS"
    (support translation)
  • blacklist so now from odoo we can't send a message to that user until the
    user sends another message or anyone manually change in Blacklist
  • this is used because if we do not stop the message if the user does not
    need it then if that user is reported the same to WhatsApp that WhatsApp number may be blocked
  • opt-out required for maintained good quality https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates

Bridge modules are added for account, delivery, payment and sale

  • add method overrides to use WA templates and whitelist fields to use
    in dynamic statements;
  • add starting template;

Add WhatsApp as a communication mean next to mail, sms or push notifications
in events.

Integrate in POS configuration.

As with automatic mailing, we can now automate sending of SO in eCommerce
using WhatsApp.

task-2377154 (Add WhatsApp Support)

Co-authored-by: Akshat Trivedi <aktr@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
Co-authored-by: Gitashri Mantha <gman@odoo.com>
Co-authored-by: Jigar Vaghela <jva@odoo.com>
Co-authored-by: Kashyap Patel <kasp@odoo.com>
Co-authored-by: Khushi Vakil <khva@odoo.com>
Co-authored-by: Nishant Jain <niai@odoo.com>
Co-authored-by: Prakash Prajapati <ppr@odoo.com>
Co-authored-by: Priyanshi patel <prpa@odoo.com>
Co-authored-by: Rahul Prajapati <rapr@odoo.com>
Co-authored-by: Renaud Thiry <reth@odoo.com>
Co-authored-by: Shreya Patel <shpa@odoo.com>
Co-authored-by: Stéphane Debauche <std@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
Co-authored-by: Zeel Patel <zepa@odoo.com>

Forward-Port-Of: #46704
Forward-Port-Of: #45601