Metadata-Version: 2.5
Name: unpaismejor_notification_whatsapp
Version: 8.0.18
Summary: Reusable WhatsApp notifications for Tryton using Evolution API
Project-URL: repository, https://code.unpaismejor.org.do/tryton-do/notification_whatsapp
Author: SOLUTEMA SRL, Fundación Un País Mejor
Maintainer: Fundación Un País Mejor
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Requires-Python: >=3.10
Requires-Dist: trytond-account-invoice<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Requires-Dist: proteus<8.1,>=8.0; extra == 'test'
Requires-Dist: trytond-company<8.1,>=8.0; extra == 'test'
Requires-Dist: trytond-party<8.1,>=8.0; extra == 'test'
Description-Content-Type: text/x-rst

Notification WhatsApp
=====================

Tryton 8.0 module for reusable WhatsApp templates and Evolution API.

Features
--------

* Genshi templates bound to any Tryton model.
* Recipient fields or PYSON expressions with phone normalization.
* Any number of ``ir.action.report`` documents attached to a template.
* Trigger and Tryton worker queue integration.
* Auditable text/document outbox and Evolution message identifiers.
* Manual sending from its menu and from the invoice form action.
* Independent attachment retries and idempotency keys.
* Authenticated delivery/read status webhook.
* Direct Evolution API v2 integration; n8n is optional.

Core compatibility
------------------

The module does not inherit the ``ir.email.template`` SQL model because doing
so would mix email-specific recipients, subject and SMTP fields with WhatsApp
records. Instead it follows the same composition used by
``notification_email``:

* template context, PYSON evaluation, recipient models and languages are
  delegated dynamically to ``ir.email.template``;
* documents are standard ``ir.action.report`` records and are executed using
  the same result contract as notification email attachments;
* ``ir.trigger`` actions and delayed jobs use Tryton's native queue proxy;
* the outbox uses ``ResourceAccessMixin`` like the core ``ir.email`` log;
* ``whatsapp_models``, ``_get_number``, ``get_provider`` and report ``get``
  are stable extension hooks for optional modules.

Installation
------------

Install the package, update the Tryton module list and activate
``Notification WhatsApp``. Configure the endpoint, instance and API key under
``Administration > Models > WhatsApp``. Keep the API key restricted to the
WhatsApp Administration group.

Configure Evolution API to send message-update events to::

    https://TRYTON_HOST/DATABASE/notification-whatsapp/webhook

The request must contain the configuration's secret in the
``X-Webhook-Secret`` header. The endpoint accepts Evolution's sent, delivered,
read and error states. Enable Evolution's ``MESSAGES_UPDATE`` event and add
``X-Webhook-Secret`` as a custom webhook header with the same value stored in
Tryton. ``DELIVERY_ACK`` fills *Delivered At* and ``READ``/``PLAYED`` fills
*Read At* (and *Delivered At* when the delivery event arrived late or was
omitted). Administrators are automatically assigned to both the
WhatsApp Administration and WhatsApp Sender groups. Regular operators must be
assigned to WhatsApp Sender explicitly.
