X-On-Behalf-Of end-user ID and both write JSONL audit events keyed by the same response_id and conversation_id.
For the base request pattern, see generate a response.
If you need to create or manage a reusable conversation ID per end user, see manage conversations.
Architecture
WhatsApp end user message -> WhatsApp webhook receives the message -> your server callsmka1.llm.responses.create with store: true
-> your server logs the full stored response object and response_id
-> your server sends the reply back to WhatsApp
-> your web app requests the same response_id from your backend
-> your backend calls mka1.llm.responses.get
-> your backend logs the web retrieval against the same response_id and conversation_id
Keep your API key on the server. The browser should call your backend route, not the MKA1 API directly.
Use one end-user ID across both channels
TheX-On-Behalf-Of value is the key that ties the channels together at the end-user level.
Use the same stable end-user ID in both harnesses.
You must also use the same shared MKA1 API key in both harnesses.
Examples:
- WhatsApp webhook maps a phone number to
user_123. - Web app session for the same person also resolves to
user_123. - Both harnesses authenticate with the same MKA1 API key.
X-On-Behalf-Of value changes between channels, the logs are no longer auditable as one end-user conversation.
If the API key changes between channels, the requests belong to different MKA1 API users even when X-On-Behalf-Of matches.
WhatsApp harness: store the response and log it
Start with one shared SDK wrapper that both harnesses use. This keeps authentication, conversation creation, response retrieval, and response creation consistent across channels.- WhatsApp is the ingress channel.
- The request is stored with
store: true. - The full response object is logged in an open format.
- The log includes
response_id,conversation_id, andend_user_id.
Web harness: retrieve the same stored response
The web app should call your own backend. That backend can retrieve the same response withmka1.llm.responses.get and log the retrieval as a second channel event.
- The web app is a separate channel from WhatsApp.
- It retrieves the same stored MKA1 response by
response_id. - It logs that retrieval into the same JSONL audit stream.
- The retrieved object still carries the same end-user and conversation linkage.
Unified audit export in an open format
Example export:Authentication requirement for shared logs
For this multichannel demonstration, all of the following must match across the WhatsApp and web harnesses:- the same MKA1 API key
- the same
X-On-Behalf-Ofend-user ID - the same stored
response_id - the same
conversation_idwhen you use conversations