def _get_action_ref_for_body(self, body):
        """
        Retrieve action_ref for the provided message body.
        """
        if not body:
            return None

        action_ref = None

        if isinstance(body, ActionExecutionAPI):
            action_ref = body.action.get("ref", None) if body.action else None
        elif isinstance(body, LiveActionAPI):
            action_ref = body.action
        elif isinstance(body, (ActionExecutionOutputAPI)):
            action_ref = body.action_ref

        return action_ref

        Retrieve action_ref for the provided message body.
        
st2common/st2common/stream/listener.py