Send parsed data to custom channel

Hello, I’m trying to use the RestInput to send rasa responses to a Custom Output channel. But my problem is that I want to send parsed_data to that custom channel not the actual rasa response.

When I start a new rasa server, there’s an agent loading that does all the parsing. How can I use that existing agent inside my custom RestInput? I’ve been looking all over the code and couldn’t find any examples of how to do that.

@custom_webhook.route("/webhook", methods=["POST"])
async def receive(request: Request) -> HTTPResponse:
    sender_id = await self._extract_sender(request)
    text = self._extract_message(request)
    should_use_stream = rasa.utils.endpoints.bool_arg(
        request, "stream", default=False
    )
    input_channel = self._extract_input_channel(request)
    metadata = self.get_metadata(request)

    # create a UserMessage instance with the extracted text
    message = UserMessage(
        text,
        output_channel,
        sender_id=sender_id,
        input_channel=input_channel,
        metadata=metadata,
    )

    if should_use_stream:
        return response.stream(
            self.stream_response(
                on_new_message, message, sender_id, input_channel, metadata
            ),
            content_type="text/event-stream",
        )
    else:
        # pass the UserMessage instance to the on_new_message method
        await on_new_message(message)

        # get the parsed response from the message object
        parsed_response = message.parse_data

        return response.json(parsed_response)

This is my receive method. But the parsed data is None