This page covers middleware.py imports, the senderID source, synchronous error handling, and common return bodies.
Import style
getSenderID() reads the current runtime context ID from runtime arguments. autClaw injects runtime credentials for message triggers, route triggers, and cron / fake contexts; plugins should not build /api/plugins/runtime URLs manually.
Common return values
SendReceipt
Text, media, and recall methods usually return a send receipt.
Adapters may return extra fields. When checking failures, first check receipt.get("ok") is False. Message IDs may appear as either message_id or messageid.
FileDownloadResult
fileDownload(...) and downloadAdapterFile(...) return local file information.
sender.getMediaItems() returns media items from the current event or the latest listen(...) / input(...) result.
Pass user-uploaded file items to downloadAdapterFile(...). Do not parse platform-specific raw fields manually.
WaitPaySuccess
waitPay(...) returns a payment event object on success; it returns the string "timeout" on timeout and "busy" when another waiter is active.
Error handling
Python SDK calls return synchronously. Runtime request failures, missing required arguments, or dependency installation failures raise Exception.
Next steps
Last modified on June 3, 2026