360dialog WhatsApp engine for the Axion conversation framework.
Uses the 360dialog v1 REST API with the Meta Cloud API payload format.
ObjConversationWhatsapp uses Channel360 directly and has its own
WhatsAppConversationHandler class structure. This module follows the standard
ConversationInterface/ConversationBroker pattern and targets the same
underlying 360dialog endpoint (https://waba.360dialog.io/v1/messages).
The _EMOJI_MAP and _EMOJI_RE are imported from ObjConversationWhatsapp
— no duplication of the emoji system.
Sends messages via the 360dialog REST API using the D360-API-KEY header.
Inherits from ObjConversationEngine.ConversationInterface.
Config section: dialog360
| Key | Description |
|---|---|
api_key |
360dialog API key (D360-API-KEY header value) |
phone_number_id |
WhatsApp phone number ID registered in 360dialog |
verify_token |
Token used during webhook hub verification |
app_secret |
App secret used for HMAC-SHA256 signature verification |
Methods:
_init_client() — loads api_key and phone_number_id from configtransmit_message(message, to_number="") — sends a plain-text WhatsApp message; applies emoji substitution; truncates at 4 096 charsdisplay_context(opts) — sends a plain-text conversation/contact/page summarydisplay_options(opts) — interactive buttons (max 3) when command options exist; plain-text fallback when there are only prompt options; button IDs are zero-padded to 3 digits; labels truncated to 20 chars; returns (first_key, first_prompt)Handles the 360dialog/Meta webhook lifecycle.
Methods:
verify_webhook(mode, token, challenge) — validates the Meta hub GET verification; returns challenge on success; raises ValueError on mismatchverify_signature(payload_bytes, signature_header) — validates X-Hub-Signature-256 using HMAC-SHA256 keyed on app_secrethandle_webhook(body) — parses Meta Cloud API format entry[].changes[].value.messages[]; handles "text" and "interactive" (button_reply) types; routes to ObjConversation.read_conversation() with engine "DIALOG360"run() — logs a deployment reminder; 360dialog is always webhook-driven{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "+27831234567",
"type": "interactive",
"interactive": {
"type": "button",
"body": {"text": "Choose an option"},
"action": {
"buttons": [
{"type": "reply", "reply": {"id": "001", "title": "Yes"}}
]
}
}
}
Maximum 3 buttons per message. Button ID is the command value zero-padded to
3 digits when numeric (e.g. command "1" → ID "001").
config.yaml:dialog360:
api_key: ""
phone_number_id: ""
verify_token: ""
app_secret: ""
broker.verify_webhook(mode, token, challenge) for hub setupbroker.verify_signature(body_bytes, sig_header), then route with broker.handle_webhook(body)360dialog uses the same HMAC-SHA256 scheme as the Meta Cloud API:
HMAC-SHA256(app_secret, raw_request_body)sha256=X-Hub-Signature-256 headerCall broker.verify_signature() before handle_webhook() in production.