After the overwhelming number of views I received on the previous story I decided I would pursue the topic of exploring WhatsApp’s source-code and see if I could find something else of interest, I mean who doesn’t enjoy going through 109000 lines of code with a cup of coffee?.

As with my previous stories about WhatsApp, this is focused on WhatsApp web, I will not cover in detail how to do this, mainly exploring and sharing the results

Some months ago I wanted to reply to a friend in a group chat with a GIF of someone simulating shooting himself, I wanted a particular one from How I met your Mother where Barney Stinson. I couldn’t find it, and couldn’t find anything a bit NSFW or violent, and I get it, kids use this app (they shouldn’t, but they do) and we have to protect our kids but… Can I do something to my own WhatsApp so that, without leaving the tab I can improve my GIF search experience?

Let’s find out!

What is this Tenor you mention?

You might have heard of the Tenor gif keyboard that allows you to search a vast collection of GIFs and insert them easily into the application you are using to chat, I certainly had never heard of them. While casually looking at the source code for WhatsApp’s web I noticed that there was a suspicious looking switch statement that considered the possibility of a user not using the Giphy search engine.

function n() {

switch (c["default"].gifSearch) {

case "giphy":

return u;

case "tenor":

default:

return f

}

}

My default search engine for GIFs

By default, f would be "tenor" but I had always seen the above image when searching for a funny GIF to use in a conversation. Reading online you might think that they have integrated both in the same search, maybe that’s the case for iPhone users, have no way of testing that. However, looking at the code it’s clear (however obtuse the flow becomes after going through the obfuscator) that it pulls from two separate APIs.

Giphy using https://api.giphy.com/v1/

Tenor using https://wa.tenor.co/v1

Changing the value of c["default"].gifSearch to “tenor” or anything other than “giphy” will get your queries through the tenor API and provide different results. I’m certain there’s no option to change the GIF provider yet in neither the web app nor the Android application, but if there is let me know because then this whole section becomes silly.

We are onto something, we can search Tenor!

How do the two search engines compare

I’ve read that the most common gifs searched are those of cats¹, so in order to compare the results, before I attempt to go NSFW, I will use the term “cats”. Let me warn you the results are anti-climatic to say the least.

Why does WhatsApp have this ability to choose between the two but decides for us? I’m going to guess that it has something to do with the country you are from perhaps, maybe they have a deal with each company and divert the traffic to one or the other depending on the location of the user, but this is pure and fun speculative talk.