Skip to content

Commit 5a8b072

Browse files
[IMP] WhatsApp: Permanent Tokens + Code Errors
closes #12947 X-original-commit: 3fc6782 Signed-off-by: Justin Mallette (juma) <[email protected]>
1 parent a40d2ee commit 5a8b072

File tree

1 file changed

+47
-55
lines changed

1 file changed

+47
-55
lines changed

content/applications/productivity/whatsapp.rst

+47-55
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ database, which allows for the following:
2222
- Create new templates with dynamic placeholders/variables
2323
- Send pre-approved templates that use dynamic variables, such as:
2424

25-
- Quotations from the Sales app
26-
- Receipts and invoices from the Point of Sale app
27-
- Tickets from the Events app
25+
- Quotations from the **Sales** app
26+
- Receipts and invoices from the **Point of Sale** app
27+
- Tickets from the **Events** app
2828

2929
.. seealso::
3030
- `Meta Business: create message templates for the WhatsApp Business account
@@ -43,7 +43,7 @@ connection.
4343
The WhatsApp connector supports two flows: company initiated, and customer initiated. A company can
4444
initiate a discussion by sending a template to one or more people. Once the template is sent, the
4545
recipient can answer in order to trigger a discussion between the sender and the receiver (a
46-
*Discuss* chat window will pop up if the customer answers within 15 days).
46+
**Discuss** chat window appears if the customer answers within 15 days).
4747

4848
If the discussion is initiated by the client (e.g. by sending to the company's public WhatsApp
4949
number), then Odoo will open a group chat with all operators responsible for this WhatsApp channel.
@@ -93,11 +93,10 @@ account and to complete the setup process.
9393
To toggle to the business account navigate to the `Facebook Developer Console
9494
<https://developers.facebook.com>`_ and click on the *account name* in the upper right corner.
9595
Under the :guilabel:`Business Accounts` heading, click on the desired business that the WhatsApp
96-
configuration should take place in. This will be the account for which Odoo will send and receive
96+
configuration should take place in. This is the account for which Odoo will send and receive
9797
WhatsApp messages.
9898

9999
.. image:: whatsapp/toggle.png
100-
:align: center
101100
:alt: Toggle between Meta personal and business accounts.
102101

103102
.. important::
@@ -121,7 +120,7 @@ developer account.
121120
`Set up the WhatsApp Business Platform
122121
<https://www.facebookblueprint.com/student/collection/409587/path/360218>`_.
123122

124-
Click on :guilabel:`My Apps` in the top right corner after successfully signing in to the Meta
123+
Click on :guilabel:`My Apps` in the top-right corner after successfully signing in to the Meta
125124
developer account. This will redirect the administrator to all the apps the developer has configured
126125
in this specific developer account. Click on :guilabel:`Create App` to begin the process of
127126
configuring a new Meta application.
@@ -162,7 +161,7 @@ To accept the agreements, enter the Facebook password for security purposes, and
162161
for Developers` dashboard.
163162

164163
.. note::
165-
If the Meta business account is prohibited from advertising, claiming an app won't be allowed. To
164+
If the Meta business account is prohibited from advertising, claiming an app is not allowed. To
166165
resolve this issue navigate to `<https://business.facebook.com/business>`_ for assistance.
167166

168167
For more information, see `Meta's documentation on advertising restrictions
@@ -175,7 +174,7 @@ Now that the basic structure of the app has been created, a product will need to
175174
app. Begin by accessing the Meta app dashboard by navigating to
176175
`<https://developers.facebook.com/apps>`_, and clicking on the app that is being configured.
177176

178-
On the next page: since WhatsApp will be used, click :guilabel:`Set up` next to the box containing
177+
On the next page: since WhatsApp is used, click :guilabel:`Set up` next to the box containing
179178
WhatsApp, located towards the bottom of the page.
180179

181180
.. seealso::
@@ -202,11 +201,10 @@ is where to begin configuring the WhatsApp API by adding a phone number and then
202201
test message.
203202

204203
.. image:: whatsapp/quickstart.png
205-
:align: center
206204
:alt: Navigating to the WhatsApp quickstart wizard in Meta for Developer dashboard.
207205

208206
.. note::
209-
If the browser isn't on the :guilabel:`Quickstart` page for WhatsApp, navigate to
207+
If the browser is not on the :guilabel:`Quickstart` page for WhatsApp, navigate to
210208
`<https://developers.facebook.com/apps>`_ and click on the app that is being configured, (the
211209
app name is `Odoo` if the instructions above were followed).
212210

@@ -317,11 +315,10 @@ webhooks to receive messages` and click on :guilabel:`Configure webhooks`.
317315
hand menu.
318316

319317
.. image:: whatsapp/webhooks.png
320-
:align: center
321318
:alt: Manually navigating to the Whatsapp webhooks configuration.
322319

323320
On the :menuselection:`Webhook configuration` page, click on :guilabel:`Edit`, where both the
324-
:guilabel:`Callback URL` and :guilabel:`Webhook Verify Token` values from the Odoo will be added.
321+
:guilabel:`Callback URL` and :guilabel:`Webhook Verify Token` values from Odoo are added.
325322

326323
.. note::
327324
Both the :guilabel:`Callback URL` and :guilabel:`Webhook Verify Token` values were automatically
@@ -343,20 +340,19 @@ Webhook fields
343340

344341
Now input individual webhook fields into Meta's developer console, under the :guilabel:`Webhook
345342
fields` section. Click :guilabel:`Manage` and when the pop-up window appears, check the boxes in the
346-
:guilabel:`Subscribe` column for the following *field names*:
343+
:guilabel:`Subscribe` column for the following field names:
347344

348-
- account_update
349-
- message_template_quality_update
350-
- message_template_status_update
351-
- messages
352-
- template_category_update
345+
- `account_update`
346+
- `message_template_quality_update`
347+
- `message_template_status_update`
348+
- `messages`
349+
- `template_category_update`
353350

354351
After making the selections, click :guilabel:`Done`.
355352

356353
The finished :guilabel:`Webhooks` configuration will appear like this in the Meta developer console:
357354

358355
.. image:: whatsapp/webhooks-done.png
359-
:align: center
360356
:alt: WhatsApp webhooks set in the Meta developer console.
361357

362358
.. important::
@@ -413,7 +409,7 @@ depending on the verification method chosen. Enter that verification code into t
413409
:guilabel:`Verification code` field and click :guilabel:`Next` to finish.
414410

415411
.. warning::
416-
If a payment method hasn't been added this will be necessary to proceed. `Visit Meta's
412+
If a payment method has not been added, this is necessary to proceed. `Visit Meta's
417413
documentation on how to add a payment method in Meta's Business Manager
418414
<https://www.facebook.com/business/help/915454841921082?id=180505742745347>`_. This is part of
419415
Meta's fraud detection system, in order to ensure that the account/company are real a payment
@@ -442,22 +438,27 @@ clicking on :guilabel:`Add`.
442438

443439
Assets now must be added to the system user and then a permanent token can be generated.
444440

441+
.. warning::
442+
This is a mandatory step. If the permanent token is not added, the Odoo database shows a
443+
:ref:`token error <whatsapp/token_error>`.
444+
445445
Click on :guilabel:`Add assets`, and when the pop-up window appears select :guilabel:`Apps` under
446446
the :guilabel:`Select asset type`. Then, select the Odoo app and toggle the permissions to *On*
447447
under the :guilabel:`Full control` option. Set this new permission setting by clicking
448448
:guilabel:`Save Changes`, to which a confirmation window will appear, acknowledging the addition of
449449
the asset to the system user. Finish by clicking :guilabel:`Done`.
450450

451-
Next, the permanent token will be generated. Click on :guilabel:`Generate new token`, and a pop-up
451+
Next, the permanent token gets generated. Click on :guilabel:`Generate new token`, and a pop-up
452452
window will appear asking which app this token should be generated for. Select the :guilabel:`App`
453453
that this token is for. Then determine the expiration date of either :guilabel:`60 days` or
454454
:guilabel:`Never`.
455455

456456
Finally, when Meta asks which permissions should the system user allow, add all of the following
457457
permissions:
458458

459-
- WhatsApp_business_messaging
460-
- WhatsApp_business_management
459+
- `business_management`
460+
- `whatsapp_business_messaging`
461+
- `whatsapp_business_management`
461462

462463
When permissions are set, click :guilabel:`Generate token`. Copy the token value that populates on
463464
the screen that follows.
@@ -498,8 +499,8 @@ WhatsApp templates are saved messages that are used repeatedly to send messages
498499
They allow users to send quality communications, without having to compose the same text repeatedly.
499500

500501
Creating different templates that are tailored to specific situations lets users choose the right
501-
message for the right audience. This increases the quality of the message and the overall
502-
engagement rate with the customer.
502+
message for the right audience. This increases the quality of the message and the overall engagement
503+
rate with the customer.
503504

504505
WhatsApp templates can be created on both the Odoo and Meta consoles. The following process will
505506
overview the process for creating templates in Odoo and then afterward in Meta.
@@ -546,7 +547,7 @@ action will apply to for this template.
546547

547548
.. tip::
548549
These models can also be accessed in :ref:`developer mode <developer-mode>`. On a contact form
549-
(or similar relevant form in Odoo), navigate to the model that will be referenced, and hover over
550+
(or similar relevant form in Odoo), navigate to the model that is referenced, and hover over
550551
any field name. A box of backend information will reveal itself with the specific Odoo
551552
:guilabel:`Model` name in the backend. Search (using the front-end name) for this model in the
552553
:guilabel:`Applies to` drop-down menu in the WhatsApp template.
@@ -556,24 +557,22 @@ action will apply to for this template.
556557
produce an error The :guilabel:`Phone Field` should always be set to the `Phone` or `Mobile`
557558
model.
558559

559-
To search available fields, type in the front-end name in the :guilabel:`Search...` box. This will
560-
find a result from all of the available fields for the model (:guilabel:`Applies to`) that the
561-
template is created for.
560+
To search available fields, type in the front-end name in the search box. This finds a result from
561+
all of the available fields for the model (:guilabel:`Applies to`) that the template is created for.
562562

563563
.. note::
564564
In order to find specific fields, multiple levels may need to be navigated in the search results
565565
box. Use the :guilabel:`> (right chevron)` and :guilabel:`⬅️ (left arrow)` icons to navigate
566566
between the menu levels.
567567

568568
.. image:: whatsapp/phone-field.png
569-
:align: center
570569
:alt: Searching for the phone field in the search bar.
571570

572571
Change the :guilabel:`Category` to fit either a :guilabel:`Marketing`, :guilabel:`Utility`, or
573-
:guilabel:`Authentication` category. In most instances the first two options will be used, unless
574-
the user would like to send a password reset or something security related. Set to
575-
:guilabel:`Marketing` should there be anything promotional being sent and set to :guilabel:`Utility`
576-
should there be general transactional messages being sent (i.e., sales order, event ticket, etc).
572+
:guilabel:`Authentication` category. In most instances the first two options are used, unless the
573+
user would like to send a password reset or something security related. Set to :guilabel:`Marketing`
574+
should there be anything promotional being sent and set to :guilabel:`Utility` should there be
575+
general transactional messages being sent (i.e., sales order, event ticket, etc).
577576

578577
.. important::
579578
Specifying an incorrect category can cause a flag/rejected status from Meta during the approval
@@ -603,12 +602,12 @@ The templates will then need to be synced from the Odoo database.
603602
See this section for more information on :ref:`syncing templates <productivity/whatsapp/sync>`.
604603

605604
.. tip::
606-
There are pre-configured demo data templates available in Odoo to use or modify. These templates
607-
can be used as-is or modified to suit a specific business need.
605+
Consider the preconfigured demo data templates available in Odoo to use or modify. These
606+
templates can be used as-is or modified to suit a specific business need.
608607

609608
To use these templates, navigate to :menuselection:`WhatsApp app --> Templates` and select a
610-
pre-configured template. Click :guilabel:`Submit for Approval` to start the approval process. An
611-
email will be sent to the administrator of the Meta account when the template has been approved.
609+
preconfigured template. Click :guilabel:`Submit for Approval` to start the approval process. An
610+
email gets sent to the administrator of the Meta account when the template has been approved.
612611

613612
Buttons
614613
~~~~~~~
@@ -637,7 +636,6 @@ the database, referencing fields from within a model.
637636
email from the :guilabel:`Customer` field on the :guilabel:`Sales Order` model.
638637

639638
.. image:: whatsapp/message.png
640-
:align: center
641639
:alt: WhatsApp message with dynamic variables highlighted.
642640

643641
Dynamic variables can be added in to the :guilabel:`Body` by adding :guilabel:`placeholders` in the
@@ -745,7 +743,6 @@ will update the templates that are approved so that they can be utilized with va
745743
database.
746744

747745
.. image:: whatsapp/sync-template.png
748-
:align: center
749746
:alt: Syncing Meta WhatsApp templates to the Odoo database, with the 'Sync Templates'
750747
highlighted.
751748

@@ -765,23 +762,21 @@ First, navigate to `Meta's WhatsApp template dashboard
765762
Message templates`.
766763

767764
.. image:: whatsapp/account-tools.png
768-
:align: center
769765
:alt: Account tools highlighted in business manager with the manage templates link highlighted.
770766

771767
To create a WhatsApp template, click on the blue :guilabel:`Create template` button, and then select
772768
the :guilabel:`Category`. The options listed include: :guilabel:`Marketing`, :guilabel:`Utility`,
773-
and :guilabel:`Authentication`. In most instances the first two options will be used, unless the
774-
user would like to send a password reset or something security related.
769+
and :guilabel:`Authentication`. In most instances the first two options are used, unless the user
770+
would like to send a password reset or something security related.
775771

776772
Enter the :guilabel:`Name` of the template and then select the :guilabel:`Language` for the
777773
template.
778774

779775
.. note::
780-
Multiple languages can be selected by typing the language name(s) and selecting the other
776+
Multiple languages can be selected by typing the language names and selecting the other
781777
languages as needed.
782778

783779
.. image:: whatsapp/template-config.png
784-
:align: center
785780
:alt: Template configuration options listed, with Marketing, Utility, Name and Language
786781
highlighted.
787782

@@ -791,12 +786,11 @@ The page redirects to the :guilabel:`Edit template` page. Here the :guilabel:`He
791786
template is a preview of what the template will look like in production.
792787

793788
.. image:: whatsapp/edit-template.png
794-
:align: center
795789
:alt: Edit the template using a header, body, footer and buttons.
796790

797791
When all the necessary changes are made to the template, click on the :guilabel:`Submit` button in
798792
the upper-right corner. A confirmation window appears to confirm the language— click
799-
:guilabel:`Confirm` to approve and then another window appears stating that the template will be
793+
:guilabel:`Confirm` to approve and then another window appears stating that the template gets
800794
submitted to Meta for review and approval.
801795

802796
The :guilabel:`Status` of the template will remain in :guilabel:`In review` until a decision has
@@ -818,12 +812,12 @@ WhatsApp business account configuration in Odoo.
818812
Notification settings can be adjusted by navigating to :menuselection:`WhatsApp app -->
819813
Configuration --> WhatsApp Business Accounts`. From there, select the account and scroll down to the
820814
:menuselection:`Control` section where notifications are handled. Under the :guilabel:`Notify users`
821-
heading, type in the field which user(s) should be notified for this particular WhatsApp channel.
815+
heading, type in the field which users should be notified for this particular WhatsApp channel.
822816

823817
.. note::
824818
Once a conversation is initiated between a user and a customer, notifications to all the users
825-
specified in the WhatsApp business account configuration won't occur. Only notifications to the
826-
user(s) in the conversation will occur. Should the user not respond within 15 days, the
819+
specified in the WhatsApp business account configuration will not occur. Only notifications to
820+
the users in the conversation will occur. Should the user not respond within 15 days, the
827821
customer's reply after the 15 days will populate once again to all the users specified in the
828822
WhatsApp configuration.
829823

@@ -835,7 +829,6 @@ conversations are located in the *Discuss* app. Click on the :guilabel:`👤+ (a
835829
it, and a window appears to invite users to the conversation.
836830

837831
.. image:: whatsapp/add-users.png
838-
:align: center
839832
:alt: Adding users to a WhatsApp conversation, with the add user icon highlighted.
840833

841834
WhatsApp API FAQ
@@ -868,9 +861,10 @@ this issue, rename the duplicate template name on Odoo and sync the templates on
868861
following the steps here: :ref:`productivity/whatsapp/sync`.
869862

870863
.. image:: whatsapp/validation-error-2.png
871-
:align: center
872864
:alt: User error populated in Odoo when a duplicate template exists.
873865

866+
.. _whatsapp/token_error:
867+
874868
Token errors
875869
------------
876870

@@ -882,7 +876,6 @@ when testing the connection after sending fails. To correct this issues see
882876
:ref:`productivity/whatsapp/token`.
883877

884878
.. image:: whatsapp/user-error.png
885-
:align: center
886879
:alt: User error populated in Odoo when token expires.
887880

888881
System user error 100
@@ -895,5 +888,4 @@ To correct this error, create an :guilabel:`Admin` system user, following the pr
895888
:ref:`productivity/whatsapp/token`.
896889

897890
.. image:: whatsapp/user-error-2.png
898-
:align: center
899891
:alt: User error populated in Odoo when an employee token is generated instead of a Admin user.

0 commit comments

Comments
 (0)