code: def get_room_messages(self, room_id, token, direction, limit=10, to=None):
          
          query = {
              "roomId": room_id,
              "from": token,
              "dir": direction,
              "limit": limit,
          }
  
          if to:
              query["to"] = to
  
          return self._send("GET", "/rooms/{}/messages".format(quote(room_id)),
                            query_params=query, api_path="/_matrix/client/r0")
docs: Perform GET /rooms/{roomId}/messages.
  
          Args:
              room_id (str): The room's id.
              token (str): The token to start returning events from.
              direction (str):  The direction to return events from. One of: ["b", "f"].
              limit (int): The maximum number of events to return.
              to (str): The token to stop returning events at.