Infobip WhatsApp engine for the Axion conversation framework.
Uses the Infobip WhatsApp Messaging API with App token authentication.
ObjConversationWhatsapp uses the Channel360 provider. This module uses
Infobip as the provider and follows the standard
ConversationInterface/ConversationBroker pattern with Infobip-specific
payload structures.
The _EMOJI_MAP and _EMOJI_RE are imported from ObjConversationWhatsapp
— no duplication of the emoji system.
Sends messages via the Infobip WhatsApp API using Authorization: App {key}
headers. Text messages go to the /message/text endpoint; interactive
button messages go to /message/interactive/buttons.
Inherits from ObjConversationEngine.ConversationInterface.
Config section: infobip
| Key | Description |
|---|---|
api_key |
Infobip API key (used in Authorization: App header) |
base_url |
Infobip base URL prefix (e.g. xyz123 for xyz123.api.infobip.com) |
from_number |
WhatsApp sender number registered in Infobip |
Methods:
_init_client() — loads all three config keystransmit_message(message, to_number="") — sends a plain-text WhatsApp message to the /message/text endpoint; applies emoji substitution; truncates at 4 096 charsdisplay_context(opts) — sends a plain-text conversation/contact/page summarydisplay_options(opts) — REPLY buttons when command options exist (POST to /message/interactive/buttons); plain text to /message/text when only prompt options; returns (first_key, first_prompt)Handles inbound Infobip webhook events. Infobip uses URL-based security
(shared secret embedded in the webhook URL) — no additional signature
verification is required.
Methods:
handle_webhook(body) — parses body.results[]; handles "TEXT" and "INTERACTIVE_BUTTON_REPLY" message types; sender from result.from; routes to ObjConversation.read_conversation() with engine "INFOBIP"run() — logs a deployment reminder; Infobip is always webhook-driven{
"from": "+27831234567",
"to": "+27991234567",
"content": {"text": "Hello"}
}
{
"from": "+27831234567",
"to": "+27991234567",
"content": {
"body": {"text": "Choose an option"},
"action": {
"buttons": [
{"type": "REPLY", "id": "1", "title": "Yes"},
{"type": "REPLY", "id": "2", "title": "No"}
]
}
}
}
Button IDs are the raw command values (no zero-padding). Labels are truncated
to 20 characters.
config.yaml:infobip:
api_key: ""
base_url: ""
from_number: ""
broker.handle_webhook(body)Infobip POSTs a JSON body with a results array:
{
"results": [
{
"from": "+27831234567",
"message": {
"type": "TEXT",
"text": "Hello"
}
}
]
}
For interactive button replies, message.type is "INTERACTIVE_BUTTON_REPLY"
and the button ID is in message.id.