How to pass and extract metadata in Rasa, sent by POST request?

Hello everyone! I’m trying to get metadata using Rasa custom actions. The POST request body looks like:

"sender": "Me",
"message":"Check channel",
"metadata": {"channel": "chat"}

I changed method get_metadata in class InputChannel of rasa\Lib\site-packages\rasa\core\channels\ file to:

def get_metadata(self, request: Request) -> Optional[Dict[Text, Any]]:
    metadata = request.json
    return metadata

And, also I wrote the next code in Rasa custom action to extract it:

def extract_metadata_from_tracker(tracker: Tracker):
    events = tracker.current_state()['events']
    user_events = []
    for e in events:
        if e['event'] == 'user':
    return user_events[-1]['metadata']

In response I just get empty metadata:

    "recipient_id": "Me",
    "text": "Check channel",
    "metadata": {}