MENLO PARK, Calif. — Two years ago, Messenger, a photo and text messaging service, appeared to be almost an afterthought at Facebook, the social networking giant.

Messenger often took a back seat to the limelight enjoyed by WhatsApp, the messaging app that Facebook had bought for $19 billion. And Messenger’s capabilities were so limited that you could not send friends an animated GIF of a dancing Shiba Inu, as you could with many other messaging services.

But since mid-2014, Facebook has been playing a furious game of catch-up with Messenger. That June, Facebook’s chief executive, Mark Zuckerberg, hired a PayPal executive, David Marcus, to take over Messenger and build it into a world-class competitor. The company has added a string of features to the service, including letting people send money to friends through the app, pull up a voice or video call, or order a private car from inside the app.

On Friday, Facebook said it would also begin testing “secret conversations” inside Messenger, a feature that offers end-to-end encryption on some messages to be read only on the two mobile devices that users are communicating with. While it stops short of the full encryption that other messaging services like WhatsApp have adopted, it gives Messenger a heightened mode of security that Facebook hopes will attract global audiences to download the app.