Google is building a new mobile-messaging service that taps its artificial intelligence know-how and so-called chatbot technology to try to catch up with rivals including Facebook Inc. in the fast-growing arena, according to people familiar with the matter.

Messaging services are among the world’s most popular mobile apps, with more than two billion users, according to Portio Research Ltd. But Google’s two messaging services—Hangouts and Messenger—trail far behind Facebook’s WhatsApp and Messenger and Tencent Holdings Ltd.’s WeChat, the most popular messaging app in China. Some services are adding other capabilities—WeChat, for instance, lets users shop, pay bills and book appointments.

For its new service, Google, a unit of Alphabet Inc., plans to integrate chatbots, software programs that answer questions inside a messaging app, the people familiar with the matter said. Users will be able to text friends or a chatbot, which will scour the Web and other sources for information to answer a question, those people said. It is unclear when Google will launch the service, or what it will be called. Also in doubt is whether the new approach will be more successful than the company’s prior efforts. Users typically join messaging services because they know other users; Google has struggled to create such network effects with both Hangouts and Messenger.

A Google spokeswoman declined to comment.

Google veteran Nick Fox has been leading a team working on the new service for at least a year, according to people familiar with the matter. Tech news website The Information reported his new role as vice president of communications products earlier this year.