The increasing use of private cars in large cities is accompanied by adverse ramifications such as severe shortage of parking spaces, traffic congestion, air pollution, a high level of fuel consumption, and travel cost. Ridesharing is one of the emerging solutions that facilitate the simultaneous match of drivers and passengers with similar travel schedules. In this paper, ridesharing equals carsharing which involves a cooperative trip of at least two passengers who share an automobile and must match their itineraries. The main objective of this paper is to develop a ridesharing system based on the geosocial network to be employed in Tehran, capital of Iran. In this regard, a new hybrid approach based on GIS and ant colony is developed to provide optimal shared-routes through integrating three main procedures sequentially. First, the spatio-temporal clustering of passengers is carried out using the K-means algorithm, second spatio-temporal matching of passengers ‘clusters, and drivers’ has been carried out by combining Voronoi continuous range query (VCRQ), a region connected calculus (RCC5) and Allen’s temporal interval algebra. Third, the optimum shared-route is found by the ant colony optimization (ACO) algorithm. The proposed hybrid model integrates metric and topological GIS-based methods with a metaheuristic algorithm. It is implemented via a bot “@Hamsafar” within the platform of a robot Telegram messenger. The proposed ridesharing application is applied with 220 passengers and 70 drivers with 61 shared trips in District # 6 of Tehran, Iran. The system are evaluated based on the statistical results, usability questionnaire, time performance, and comparison to some other metaheuristic approaches which in turn demonstrate the efficiency of the proposed algorithm.