Get Intent of message when Rest webhook is called

I am trying to get the intent of the message when a user uses the REST webhook to get the response of the message.

For example if the user sends a request to the following link with the body http://<ip_address>/webhooks/rest/webhook

{
  "sender": "test_user",
  "message": "Test Message"
}

I want the intent of the message and the confidence to be returned along with the response to the message.

How can this be done? Thanks for the help

You can check all the Rasa Endpoints here:

You can use the following to get confidence:

try using the tracker in the request:

@custom_webhook.route("/webhook", methods=["POST"])
        async def receive(request: Request) -> HTTPResponse:
            current_state = request.app.agent.tracker_store.get_or_create_tracker(sender_id).latest_message.intent