Skip to content

Custom Fields

Manaa-Soft edited this page Oct 22, 2026 · 4 revisions

Custom Fields Reference

All custom fields are defined in fixtures/custom_field.json and auto-created on bench migrate.


WhatsApp Account (16 fields)

# Field Name Type Description Default
1 openwa_gateway_section Section Break "OpenWA Gateway" header —
2 openwa_enabled Check Enable OpenWA routing Off
3 openwa_base_url Data Gateway URL (e.g., http://localhost:2785) —
4 openwa_session_id Data (read-only) Auto-populated by Setup button —
5 openwa_column_break Column Break Visual separator —
6 openwa_api_key Password API key for authentication —
7 openwa_webhook_secret Password Secret for HMAC verification —
8 openwa_hmac_strict Check Reject webhooks without valid HMAC Off
9 openwa_api_timeout Int HTTP timeout for REST API calls 30
10 openwa_session_start_timeout Int HTTP timeout for session start 60
11 openwa_rate_limit Int Max inbound requests/min/IP 60
12 openwa_cb_threshold Int Failures before circuit breaker trips 5
13 openwa_cb_cooldown Int Seconds before retry after trip 300
14 openwa_max_outbox_attempts Int Max delivery retries per entry 5
15 openwa_qr_html HTML QR code display area —
16 openwa_meta_separator Section Break "Meta Cloud API" separator —

Meta Fields (via Property Setters)

7 Property Setters set depends_on: "eval:!doc.openwa_enabled" on these Meta-only fields:

token, url, version, webhook_verify_token, phone_id, app_id, business_id


WhatsApp Templates (8 fields)

# Field Name Type Description
1 openwa_sync_section Section Break "OpenWA Sync" header
2 openwa_synced Check Auto-checked when synced
3 openwa_template_id Data (read-only) UUID assigned by OpenWA
4 openwa_dynamic_header Check Enable dynamic image header
5 openwa_print_format Link (Print Format) Print Format for image rendering
6 openwa_include_letterhead Check Include letterhead in image (default: on)
7 openwa_letterhead Link (Letter Head) Which Letter Head to use
8 — Column Break Visual separator

WhatsApp Notification (1 field)

# Field Name Type Options Description
1 openwa_send_type Select Jinja, Template Controls notification send path

Send Type Behavior

Value Behavior
Template Sends via OpenWA send-template with live doc values
Jinja Renders code field as Jinja, sends as plain text
(empty) Falls back to template if set, otherwise Meta API

OpenWA Bridge Settings (3 fields — global)

Field Type Default Description
Idempotency TTL Int 3600 Duplicate webhook event memory (seconds)
Outbox Batch Size Int 25 Max entries re-enqueued per scheduler cycle
Max Inbound Media Size Int 10 Max inbound media size (MB)

OpenWA Outbox DocType

Field Type Description
whatsapp_message Link The message being sent
whatsapp_account Link Target account
content_type Data Message content type
status Select Pending / Sending / Sent / Failed
attempts Int Current attempt count
max_attempts Int Maximum retries
next_retry_at Datetime When to retry
last_error Long Text Last failure reason
scheduled_at Datetime Hold in Pending until this time (empty = send immediately)

Status Flow

Pending → Sending → Sent
    ↑         │
    └─────────┘  (retry on failure)

Pending → Failed  (after max_attempts)

Backoff Schedule

Attempt Delay Cumulative
1 30s 30s
2 60s 1m30s
3 120s 3m30s
4 300s 8m30s
5 Failed —

WhatsApp Message Custom Fields

Added to the WhatsApp Message DocType via fixtures/custom_field.json.

Field Name Fieldtype Label Description
openwa_reactions JSON OpenWA Reactions Reactions received on this message — JSON array of {emoji, sender, timestamp}. Advance-only dedupe per (emoji, sender).
openwa_scheduled_at Datetime OpenWA Scheduled At Send this message at the given time. OpenWA has no delayed send, so the bridge holds the outbox entry in Pending until this time.
openwa_send_pdf Check Send as PDF Render the linked reference document as a PDF and send it via OpenWA send-document. PDF is regenerated at send time in the outbox worker.
openwa_print_format Link (Print Format) Print Format Print Format used to render the PDF. Default: Standard.
openwa_pdf_filename Data PDF Filename Delivered filename. Default: <reference_name>.pdf.

OpenWA Event Log DocType

Created by openwa_bridge/openwa_bridge/doctype/openwa_event_log/. Persists non-message webhook events (group.join, group.leave, group.update, call.received, status.received, message.reaction, message.receipt, webhook.delivery_failure).

Field Type Description
event_type Select The webhook event type
whatsapp_account Link (WhatsApp Account) Resolved account
session_id Data OpenWA session UUID
timestamp Datetime When the event occurred
summary Data Human-readable summary
payload Code Raw event payload (JSON)
related_group Data Group JID (for group events)
related_contact Data Contact JID (for call/status events)

Permissions: System Manager full access, all roles read. Inserts are best-effort and never break webhook processing.


UI Toggle Behavior

The WhatsApp Account form uses depends_on to show/hide fields:

Mode Visible Hidden
OpenWA enabled OpenWA fields + Settings Meta fields
OpenWA disabled Meta fields OpenWA fields
Both modes Account Name, Status, Default Incoming/Outgoing, Auto Read Receipt, OpenWA Enabled —

Clone this wiki locally