Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
Discuss (mail)
|
Lines of code | 2927 |
Technical Name |
taqnyat_whatsapp |
License | OPL-1 |
Website | https://taqnyat.sa/ |
Versions | 16.0 17.0 18.0 |
Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
Discuss (mail)
|
Lines of code | 2927 |
Technical Name |
taqnyat_whatsapp |
License | OPL-1 |
Website | https://taqnyat.sa/ |
Versions | 16.0 17.0 18.0 |
Taqnyat WhatsApp

About Taqnyat
Taqnyat is a Saudi-based communication company specializing in digital messaging solutions. We empower businesses by providing scalable APIs to streamline SMS, WhatsApp, and push notifications.
Setup


About Taqnyat
Taqnyat is a Saudi-based communication company specializing in digital messaging solutions. We empower businesses by providing scalable APIs to streamline SMS, WhatsApp, and push notifications.
Conversations
WhatsApp Conversation Wizard Overview
The WhatsApp Conversation Wizard provides a user-friendly interface inside Odoo to send different types of WhatsApp messages directly to selected recipients.
What You Can Do:
- Send Text: Compose and send plain WhatsApp messages.
- Send Attachments: Upload or reuse images, videos, documents, or audio files.
- Send Contacts: Share structured contact data from Odoo’s partner records.
- Send Location: Share a location with coordinates and address.
- Send Buttons: Interactive messages with clickable replies.
- Send List Selection: Allow the recipient to choose from selectable options.
- Send CTA URL: Include a call-to-action button with a clickable link.
- Request Location: Ask the recipient to share their location back.
Recipient Options:
- Select one or more contacts from Odoo’s partner list.
- Enable a manual phone input if the recipient is not in Odoo.
Media Handling:
- Upload a new file or choose from existing attachments in the system.
- Automatically detects media type (image, video, document, audio) and prepares the message accordingly.
- Add optional captions and filenames to enhance media delivery.
Message Context and Tracking:
- Messages are linked to the source model (e.g., invoice, sales order) via context.
- Error messages are displayed clearly to guide troubleshooting.
Advanced Features:
- Generate formatted contact JSON automatically when using the contact message type.
- Control preview options, footers, headers, and structured buttons.
This wizard is ideal for teams managing communication, marketing, sales, or support operations via WhatsApp while keeping everything tied back to Odoo records.
Send Text


Send Attachment

Send Contact


Send Location


Send Selection



Send CTA


Send Request Location


Webhook


Templates
All Templates

Ready Templates


Taqnyat Ready Template – Overview
The taqnyat.ready.template
model is designed to build, validate, and send
pre-configured WhatsApp message templates to the Taqnyat API for approval and use.
It supports various WhatsApp message types, including general templates, marketing, utility, and
authentication messages.
Key Features:
1. Template Fields & Structure
- name: The internal name of the template. It must be lowercase and contain no
spaces, as enforced by the constraint
_check_name_no_spaces_and_lowercase
. - language: Selected from the system's active languages via
res.lang
. - category: Must be one of
UTILITY
,MARKETING
, orAUTHENTICATION
.
2. Dynamic Component Support
The WhatsApp template is composed of several optional components:
- Header: TEXT, IMAGE, VIDEO, or DOCUMENT
- Body: Text or authentication placeholder
- Footer: Text or expiration code
- Buttons: URL, PHONE_NUMBER, or OTP
Boolean flags (has_body
, has_header
, has_footer
, has_buttons
)
control whether each component is included in the payload.
Special Case: AUTHENTICATION Templates
When category == 'AUTHENTICATION'
, the structure is fixed and controlled by WhatsApp:
- BODY includes
add_security_recommendation
- FOOTER includes
code_expiration_minutes
- BUTTONS is always an OTP with type
"COPY_CODE"
and text"Copy Code"
These constraints are hardcoded in build_components_dict()
.
build_components_dict() Method
This method generates the final JSON payload that matches Taqnyat’s API schema for WhatsApp template registration.
Example for Utility/Marketing:
{
"name": "order_confirmation",
"language": "en",
"category": "UTILITY",
"components": [
{ "type": "HEADER", "format": "TEXT", "text": "Order Confirmation" },
{ "type": "BODY", "text": "Hi {{1}}, your order {{2}} has been shipped." },
{ "type": "FOOTER", "text": "Thanks for shopping with us!" },
{ "type": "BUTTONS", "buttons": [{ "type": "URL", "text": "Track Order", "url": "https://..." }] }
]
}
Example for AUTHENTICATION:
{
"name": "login_code",
"language": "en",
"category": "AUTHENTICATION",
"components": [
{ "type": "BODY", "add_security_recommendation": true },
{ "type": "FOOTER", "code_expiration_minutes": 3 },
{ "type": "BUTTONS", "buttons": [{ "type": "OTP", "otp_type": "COPY_CODE", "text": "Copy Code" }] }
]
}
Sending to Taqnyat API
Calling action_send_to_taqnyat()
performs the following:
- Validates the API token from config.
- Builds the payload using
build_components_dict()
. - Sends the payload to
https://api.taqnyat.sa/wa/v2/templates/
via POST. - If successful (HTTP 201), stores the returned
external_id
from Taqnyat. - Displays a success notification and reloads the view.
Supports a special context flag view_payload
to preview the payload as
JSON for testing/debugging.
Field Validation Highlights:
- name: Must be all lowercase and contain no spaces.
- code_expiration_minutes: Must be greater than or equal to 1.
- language: Must be selected from the system’s active languages.
- Required fields: Vary depending on the selected category.
Summary
This model acts as a template builder and dispatcher for Taqnyat WhatsApp templates. It abstracts all the complexity of formatting, validating, and delivering WhatsApp template components into a user-friendly and API-compliant process — especially helpful for multi-category templates and dynamic field injection.
Automations



Taqnyat Template Automation – User Guide
This module enables automated WhatsApp template messages to be triggered from Odoo model actions (like Paid Invoice, Confirmed Sale Order, etc.). It dynamically fills placeholders with real data and sends messages through the Taqnyat API.
1. Core Concept
The system connects:
- A target model (e.g.,
account.move
,sale.order
) - A message subtype (like "Paid")
- A WhatsApp template (from
all.templates
)
2. Key Fields Explained
- template_active: Boolean switch to enable/disable the automation
- model_id: The model (e.g.,
sale.order
) this automation applies to - phone_field_id: The field that holds the phone number (can be direct or Many2one)
- phone_subfield_id: If the phone field is Many2one (e.g.
partner_id
), this allows selecting the phone field inside that relation - mail_message_subtype_id: Defines which message action triggers the automation (e.g., "Paid")
- template_id: The WhatsApp template to send
- otp_code_text: Text/code to use in OTP authentication templates
- auto_generate_otp_on_send: Automatically generates a random OTP code when sending
3. Parameters (Dynamic Placeholder Mapping)
For templates with dynamic values (like customer name, invoice number), you define mappings in the “Parameters” tab.
- field_id: The field on the model to use as dynamic value
- subfield_id: (optional) If the field is a relation, select the nested field
- sequence: Order in which fields are inserted into the template
- rec_name: Auto-computed technical name like
partner_id.name
4. How It Works Behind the Scenes
When a matching subtype is triggered:
- The system extracts the phone number using
phone_field_id
andphone_subfield_id
- It builds the WhatsApp payload using
build_components_dict()
- If template is AUTHENTICATION, OTP and expiration logic is applied
- If the template uses dynamic fields, their values are substituted from the record
- The message is sent to Taqnyat using the appropriate endpoint
5. Example Use Case
Imagine you want to send a WhatsApp message to customers whenever an invoice is marked Paid:
- Select
account.move
as the target model - Select
partner_id
as the phone field - Select subtype
Paid
- Choose a pre-approved WhatsApp template
- Map placeholders like
partner_id.name
andamount_total
The system will listen for message creation of type "Paid" on `account.move`, extract the phone number and field values, and send the WhatsApp message automatically.
6. OTP Support
If the template category is AUTHENTICATION:
- A secure OTP code is generated or pre-set in
otp_code_text
- The OTP is inserted into the body and a copy button is attached
- Expiration time can be controlled via the template definition
7. Debugging
The system computes a preview JSON payload in Template Components. You can review how the message will look before sending.
8. Summary
This automation module bridges your Odoo workflows with WhatsApp messaging via Taqnyat — perfect for reminders, notifications, invoices, and OTPs. With field-level mapping and dynamic rendering, it ensures flexible and personalized communication to your customers.
Discuss




Failover

Taqnyat Failover Messaging – Overview
Sometimes, WhatsApp message delivery may fail due to network issues, API downtime, or user device problems. To ensure reliable communication, the Failover Messaging mechanism is used as a backup solution.
Purpose
The Failover system automatically sends a backup message via SMS or Email if the original WhatsApp template message cannot be delivered.
How It Works
- When a WhatsApp message fails to send, the system retries using:
- A predefined SMS message.
- A backup Email message with subject and body.
- Each failover message is associated with a campaign name for tracking.
- The system uses configuration values to define:
- Fallback template name.
- SMS sender and message.
- Email sender, subject, message, and CC.
Channels Used
1. SMS
- Sent using the configured SMS sender name and message body.
- Targets the user's phone number.
- If SMS also fails, it attempts to send via Email.
2. Email
- Sent from a configured email address to the user’s email.
- Includes subject, message content, and optional CC address.
- Acts as a final backup method if WhatsApp and SMS fail.
Reliability Benefit
This system ensures that critical messages such as authentication codes or order confirmations are always delivered — even when WhatsApp is unavailable.
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module