The advent of artificial intelligence (AI) is causing a change in the marketing landscape, and AI may replace human expertise with technology to improve service delivery in service organisations. This study investigates the relationship between artificial intelligence (AI) and customer loyalty in the context of advanced digital marketing, focusing on the mediating function of chatbots. To collect data, a survey was distributed to 104 customers in different hotels and eateries in Pakistan. The hypotheses were tested using confirmatory factor analysis, reliability and validity analysis, and mediation analysis. The findings indicate that AI has a positive effect on customer loyalty. In addition, the results demonstrate that chatbots serve as a mediator between AI and consumer loyalty. This suggests that chatbots, as AIpowered conventional agents, increase customer loyalty by providing personalised and timely support, resolving customer concerns and queries, and delivering a seamless user experience. These findings have significant repercussions for the hospitality industry, particularly regarding how companies can use chatbots and other AI technologies to develop customer loyalty. By incorporating AI-powered chatbots into their digital marketing strategies, businesses can increase consumer engagement, satisfaction, and loyalty. This study contributes to the existing corpus of knowledge by empirically examining the meditation function of chatbots in the AI-customer loyalty relationship within the context of advanced digital marketing. It is a valuable resource for researchers and practitioners who use AI-driven technologies to foster customer loyalty.