class MessengerActions: def __init__(self): self._outbound = None def set_outbound(self, outbound) -> None: self._outbound = outbound def get_message_actions(self) -> list: return [ { "name": "send_template", "description": "Send a Messenger template message (button/generic/media/receipt)", "params": [ {"name": "target_id", "type": "string", "description": "Recipient PSID"}, {"name": "template_type", "type": "string", "description": "button|generic|media|receipt"}, {"name": "template_payload", "type": "object", "description": "Template payload dict"}, ], }, ] async def execute_message_action(self, action_name: str, params: dict) -> dict: if not self._outbound: return {"success": False, "error": "outbound not initialized"} if action_name == "send_template": target_id = params.get("target_id", "") template_type = params.get("template_type", "button") template_payload = params.get("template_payload", {}) result = await self._outbound.send_template(target_id, template_type, template_payload) return {"success": result.success, "message_id": result.message_id} return {"success": False, "error": f"unknown action: {action_name}"}