How to Create a Chat App like WhatsApp

68425
4.15/5
15
04/13/2019
24 minutes

Online chat seems as old as the internet. And equally compelling.

First, chat rooms came luring users into an excitement of undercover small talk. Next, social networking sites stepped in to offer over-the-horizon connectivity. Now mobile messengers keep us engaged by delivering immediate responses. And we increasingly fall for the comfort and convenience of instant messaging.

Let’s face it, instant messaging (IM) is a new enterprise and consumer reality, and the mobile chat app popularity is not going to subside anytime soon.

Well, that’s good news. Roll up your sleeves and get down to business – making Yet Another Awesome Chat App.

As if we hadn't enough chat apps already... What's up, really?!

Have you ever wondered what makes a good instant messaging mobile app? Let me help you up:

  • Distraction-free
  • Cost-efficient service
  • Fast and stable
  • Safe and secure connection
  • Protects users’ privacy
  • Can cope with poor internet connection
  • Sends unlimited number of files
  • Simple and uncluttered

Sounds nice? Well, that’s where WhatsApp has it covered.

In this post, you will discover:

Use the plan to jump to a question of your interest.

Why’s WhatsApp so special, anyway?

When it comes to IM mobile apps, WhatsApp is a lingua franca. Wonder why?

You may call them disruptors, trendsetters, game-changers, or whatever. Unlike their ‘chatty’ product, the owners talk little and work hard. They shun publicity, but their name is on the tip of everyone’s tongue. And just in 8 years, their brand name has become a synonym for instant messaging.

WhatsApp came about as a telephony disruptor and was hailed

We call it today an evangelist of messaging. WhatsApp pioneered the chat app as we know it. The startup’s UVP was so right on target that the Financial Times wrote, ‘WhatsApp has done to SMS what Skype did to international calling on landlines’.

WhatsApp has been the biggest internet deal to date

The startup has become the most expensive acquisition. In 2014 the company was purchased by Facebook for an iconic sum – $19 billion! And not without reason, too.

WhatsApp has changed communication culture

‘Messaging is the new social media’, said Fred Wilson from Union Square Ventures back in 2014. ‘Families use WhatsApp groups instead of Facebook… Facebook’s acquisition of WhatsApp was the transaction that defined this trend.’

WhatsApp has remained world’s number-one mobile chat app

Being the first of its kind is not easy. Like Steve Blank says, pioneers often have arrows in their backs. But unlike many other trailblazers, WhatsApp has remained the market leader. As of January 2017, it’s the world’s number-one mobile messaging app with over 1 billion monthly active users.

Clearly, WhatsApp knows a thing or two about creating a great product that people admire. Details?

8 factors that brought success to WhatsApp

how to create a chat application like whatsapp

#1 Pioneering the mobile-first approach

Unlike its competitors still relying on desktop versions, WhatsApp was the first to step onto a mobile path.

#2 Cost-efficient substitute for SMS

While other chat apps, like Skype, were disrupting the international calls market, WhatsApp’s primary target was SMS communication. Even its paid model, which the app had used until 2016, was more affordable than the conventional short-message rates of telephony providers.

#3 Next-to-nothing user acquisition cost

You might be surprised to hear that, but it’s true! Customer acquisition eats a lion’s share of the budget for consumer mobile companies. But WhatsApp literally sold like hot cakes. After onboarding via the contact list in their possession, which was smart, it was merely word-of-mouth marketing – it takes at least two to converse, and groups add value even faster. The insane popularity of the then paid app promptly created the network effect.

Notably, even the promotion of newer features (like voice & video calling) goes mostly via eWOM – or from one user who spots it on their app to another – and not as a result of costly promotional campaigns.

#4 Multi-platform availability

The initial release of the app on iOS was closely followed by the development on other platforms – Blackberry, Symbian, Android, Windows Phone, including older versions of the devices running on them, such as Nokia N95. Later, they added web and desktop versions as well. WhatsApp has done a terrific job on the market coverage. All the more so, given that various versions of WhatsApp look and feel completely different. Its UX/UI designers did a great job on the multi-platform adaptation.

#5 Advertisement-free user experience

Both the co-founders knew what makes users tick. For Jan Koum, born back in Soviet Ukraine, where advertising was an oddity, ad-free user experience was the only option. And that was a win-win. This no-ads-no-games-no-gimmicks approach was the actual proof of the concept – the app’s creators could tell, users are paying for their product and not for some tweaks or 3rd-party add-ons.

#6 Consistent product upgrades

Assuming that the app’s audience grew fairly large – 250 million MAU in 2013 – the paid business model provided sufficient operational costs for the company’s stable growth. Since its start as a mere texting app, the product has added multi-format file transfer, voice and video calls, encryption and other attractive features. It may have less functionality than other chat apps, but whatever the company undertakes to implement, is seen through until top-notch.

#7 Lean development & smart DevOps

The company’s highest ratio of engineers to users is clearly indicative of the team’s incredible efficiency and talent. They managed to set up a system to sustain the fast-growing messaging traffic that exceeded the world’s SMS traffic by 50%. With only 50 people to-date (of which 25 are engineers and 20 customer support), it’s been running smoothly and providing an excellent service. Tools customization, smart efficiency metrics, and horizontal scaling also have saved the company tons of money.

#8 Narrow focus

The startup business model canvas was a total antipattern to the classic ones: non-restricted target audience, limited functionality, paid service. But that’s exactly what worked best!

Unlike many successful software products (think WeChat) that tend to follow Zawinski’s law and end up bloating with popular features, WhatsApp has carefully evaded the all-encompassing portal approach. It focused on quality messaging and has never taken the eye off the ball.

How WhatsApp monetized the app

You can download WhatsApp for free. There are no in-app purchases or adverts – doesn’t that sound great!

So what’s the trick? How does WhatsApp make money?

Well, that wasn’t always the case. WhatsApp’s creators started up with a paid model.

They felt, putting adverts into something as personal as your phone and within the communication medium was totally wrong. And so they provided an ad-free user experience, so much admired by their audience that iOS users eagerly paid the symbolic $.99 for the download, and Android users – the same sum as a yearly subscription.

The paid model actually placed the ‘user – service provider’ relationship to a higher level of mutual commitment:

  • It incentivized the provider towards an adequate service in exchange for payment.
  • It increased user stickiness with the service/app they had paid for.

Clearly, WhatsApp hit success with this model because the innovative app was merely deemed as a more affordable SMS option. Striking lucky with this model on today’s messenger-congested market may be highly challenging.

We shouldn’t take lightly the behavioral aspect, though: charging for a new service, no matter how bold it may seem, actually works as it gives a promise of quality. So if you believe you can make a difference with your app, go ahead and use the paid model.

Otherwise, you may want to try Freemium. Good news is that instant messaging apps tend to have higher user retention.

Find out more: How to Choose the Best Pricing Model for Your Mobile App – Tactics and Strategy

So let’s put it all together. WhatsApp’s business model canvas looks as concise and to-the-point as its product.

how to make app like whatsapp

So much for the company’s business success. Clearly, the app itself is an interesting case as well. Let’s dive into the technology aspects of building a chat app that people will love.

Understanding WhatsApp architecture

Disclaimer: Mobile app developers are fairly discreet about their architecture and technology stack. This information has been accrued from multiple 3rd-party sources and may contain inaccuracies.

OS

WhatsApp’s underlying architecture is LYME/LYCE, except for the Linux part, that is.

Commenting on their choice of FreeBSD over Linux Brian Acton, WhatsApp’s co-founder, responded, ‘Linux is a beast of complexity. FreeBSD has the advantage of being a single distribution with an extraordinarily good ports collection.’

WhatsApp co-founders, former Yahoo employees, know the system inside out and enjoy its security and robustness.

Backend / API

Erlang is the primary programming language of WhatsApp, much appreciated for the performance reasons. Its major advantages are speed and scalability. And it allows updating the code on the fly.

But of course, Erlang is not the only option. Other chat apps, like Telegram or Kik, use Node.js – the number-one choice for applications that have to process a high volume of short messages requiring low latency. The apps of this sort, aka real-time applications (RTAs), include collaborative tools like Slack, Trello, or Google Docs. The technology is particularly popular with the developers of live-chat and instant messaging apps as well as voice and video communication tools.

Compared to Erlang, the benefits of Node.js are pretty compelling:

  • The same language on the backend and frontend creates more cost-efficient development environment with cross-functional teams.
  • A thriving open source community constantly updates and tests the product and extends the knowledge base. It’s also an excellent talent pool!
  • Great package manager, npm. And a host of other tools in npm’s repository are free. And their number is growing fast.
  • Module-driven development, reusable and shareable code.
  • Pretty fast (because the V8 engine created by Google compiles it into the native machine code).

Server

WhatsApp started from Ejabberd, an open source Jabber/XMPP instant messaging server written in Erlang. It used XMPP (eXtensible Messaging and Presence Protocol). That’s a protocol that handles a message delivery system.

Ejabberd server is based on a set of pluggable modules that enable features like:

  • One-on-one messaging
  • Store and forward (offline messages)
  • Contact List and presence
  • Group chat – Multi-User Chat (MUC)
  • Message archive Management (MAM)
  • Personal event protocol (PEP) and typing indicator
  • Privacy settings, simple blocking extensions

The company has customised most of Ejabberd, including switching from XMPP to an internally developed protocol, restructuring the code base and redesigning some core components, and making lots of important modifications to Erlang virtual machine to optimize server performance. WhatsApp stores multimedia files on YAWS (Yet another web server).

Why IM mobile apps need a server

The server is an important part of IM mobile apps since you want messages to go through, even if one of the interlocutors is off-line. For that purpose, we use asynchronous connection. Horizontal scaling (which means adding more machines, not more memory) helps to cope with traffic peaks.

There are two ways of storing messages – you can keep them on servers forever or you can delete them as soon as delivered to be stored locally (which WhatsApp does by using SQLite database). In that case, the messages temporarily ‘queue’ on servers till the recipient comes online. When a message is delivered, the queue is deleted. The same way, the acknowledgements of the messages being sent, delivered, or read will be queued on servers in the form of a particular message ID. Thus, ‘queue health’ (keeping few messages in queues) is an important metric. Whenever the traffic spikes (like at the time of football matches or earthquakes), additional servers are used to tackle the load.

Now, using IM apps, you may have noticed how messages sometimes sort of ‘skip the line’. That’s the side effect of this architecture. Your message jumps in whatever free container there is. And because the queue length determines how fast they move, they can go through in the wrong order.

Of course, there’s still room for the architecture improvement like scaling in different ways, using caches, or Audit and History Sets to store the message lot.

Database

Mnesia, a distributed telecommunications DBMS built in Erlang. By using Mnesia, the app can achieve quicker request responses and thus improve overall efficiency. It can be reconfigured at a runtime.

So on the face of it, WhatsApp may look fairly simple. But its inner architecture is pretty complex and demanding. Without going into too much detail, here’s an image to walk the talk.

Understanding WhatsApp architecture

Image courtesy of Fingent

It doesn’t mean you need to stick with WhatsApp’s architecture or stack and not implement in any other way. Understanding your goals will help us find an optimal solution for your app’s architecture.

WhatsApp’s feature list and beyond

Besides texting, an average consumer IM application allows users to send pictures, documents, audio & video files, share contacts and locations. It also allows making voice and video calls. It notifies users of incoming messages and if their own messages have been delivered or read. So the following interactive functionality modules make up the core of the app:

  • Authentication & address book management
  • Message exchange
  • Notification
  • Multimedia file transmission
  • Location sharing
  • Voice/video calls

Besides, there are other elements like user profiles, contact lists, about & help pages, encryption, chats backup, and calls history. Now, all those features are far from linear, and their development takes quite a while and involves various technologies.

Let’s look at the functionality and how it can be implemented.

Authentication & address book management

There are several methods involved in registering a user.

  • Email & password
  • 3rd party websites (FB or Google)
  • Confirming your phone number (in most mobile chat apps)
  • QR code login (popular in China)
  • Via other messaging apps (like WeChat, QQ in Asia)

WhatsApp has two-factor authentication, which means onboarding takes these steps: type your phone number – get a verification code – type it in – an account is created.

WhatsApp’s authentication used to be its weakest spot as creating a username/password based on the phone IMEI number was unsafe. Now it uses a general request from the app to send a unique 6-digit PIN. WhatsApp will then send an SMS to the indicated phone number. Based on the pin number, the app requests a unique key from WhatsApp. This key is used as a ‘password’ for all future calls. This ‘permanent’ key is stored on the device. It means that registering a new device will invalidate the key on the old device.

The sync feature detects whether the contacts in your address book have WhatsApp or not and, if positive, adds them to your list. Before sending a message, you need to have your new address-book contacts synced. Otherwise, WhatsApp can ban/block your number.

Message exchange

When launching a chat app, the least your MVP should do is provide this keystone feature that enables users to send and receive one-on-one instant messages or create group chats.

XMPP to fuel messaging

The technology that enables message exchange is XMPP (eXtensible Messaging and Presence Protocol). WhatsApp, true to its principles of simplicity, stripped down their version of XMPP to the minimum – they called it FunXMPP. Reasons? They thought, because mobile devices lack a proper internet connection, we need as few overheads as possible. How did they do it?

  1. By assigning a byte to all keywords commonly used in XMPP (such as message, from, type) and using a HashTable for almost all of those.

    So if the original XMPP message looks like this:
    <message to="34123456789@s.whatsapp.net" type="text" id="message-1417651059-2" t="1417651059"> <body>Text</body> </message>,
    it can be reduced to this:
    <* *="01234567890@*" *="*" *="message-1417651059-2" *="1417651059"> <*>Text</*> </*>,
    where * denotes various 1-byte values. So you can already see a significant size reduction. But there’s more.

  2. By encoding the XML structure as a few bytes, just because XML format is human-oriented and not meant to be read by a machine.

Nice-haves in message exchange

Besides a must-have functionality that enables one-on-one and group communication, there are other attractive features to consider. On WhatsApp, you can create a list of recipients to send an identical message – Message Broadcasting – a handy feature for marketing & sales folk.

There’s now support for Siri, so iOS users can ask Siri to text someone or read a message to them. Chatbots are trending – and it’s tempting to delegate handling some FAQ to them. But there’s more. Having bots to track and report workflow milestones is successfully implemented in Slack – a business messenger so much loved by software developers. Unlike Slack, FB messenger, or WeChat, WhatsApp doesn’t allow chatbot integration or provide any API for developers – but your chat app could.

Human communication, albeit messenger-mediated, is still central and can be further honed by adding emoji and media effects, enabling transmission of various file formats and notifying participants of important events.

Notification

Clearly, you want a user notified of a new message – that’s push notification.

Push notifications are huge for user engagement. They are virtually CTAs. Who hasn’t heard of the power of push? They are also informative. Nowadays a user can read and respond to a message without opening an app, which is, among other things, a great time and battery-life saver.

Your user will also benefit from the Sent, Delivered, Read receipt. In WhatsApp, those are the checkmarks you see under your message, and the change of their color confirms the ‘read’ status. The app uses Google’s cloud messaging platform to deliver notifications. These are not so critical as the messages themselves as regards concurrency.

There are other nice-to-have indicators of user interaction like ‘is typing’ indicator we’re all familiar with from Skype, FB Messenger or other apps. Also, the app has introduced the presence indicators – the online/offline status and ‘last seen’ information. However, you may want to know, their implementation entails certain privacy risks.

File transmission

The app allows you to send/forward/upload/download up to 100MB of data in various formats – text documents, images, voice & video messages, as well as share location and contact details. The simple procedure for sending is as follows:

  1. Open a chat
  2. Tap ‘attach’
  3. Choose one of the formats below
  4. how to build an app like whatsapp

  5. Add captions to photos and videos, if you like
  6. Tap ‘send’

File-sharing extensions include sending multiple videos at once, cropping & rotating videos.

You can also play audio messages in the background – without having to open the app.

Voice & video calls

WhatsApp enables users to make one-on-one voice and video calls. Just like text messages, the calls are encrypted by Signal Protocol.

Video calling feature is simple and user-friendly. Once a video call connects on WhatsApp, a user can choose between the front and back camera views. You can set up the main image or the incoming video as a preview of your video. Move the smaller window anyplace on the screen, minimize the video and multitask while on call.

Now, summon up the patience and get ready for a hail of terminology, because voice & video call implementation is no joke.

VoIP to fuel the calls

Voice over IP (VoIP) methodology makes voice and video calls possible within the app. WhatsApp is using the PJSIP library to implement VoIP functionality. The quality of voice transmission is fairly high thanks to the modified WebRTC and the voice codec Opus.

How good is the quality of a video call? Well, that’s relative and depends directly on the network strengths – the app adjusts the quality for a particular instance.

Despite the common practice to develop for iPhone users first, for VoIP implementation, Android may well be a better platform to start with – thanks to WebRTC support. On more details of WhatsApp’s VoIP implementation see the post.

WhatsApp has a long way to go in voice/video call functionality. There’s no web or desktop support for video calls. It’s still lacking cross-platform and outside-the-service calls or conference video calling, which can be deal-breakers for enterprise use.

Encryption

Up until version 2.8, messages were sent in plaintext. Now WhatsApp provides end-to-end encryption, which ensures that a message is turned into a secret message by its original sender, and decoded only by its final recipient. It uses the best-in-breed for encrypted messaging Signal Protocol – a modern, open source, forward secure, strong encryption protocol for asynchronous messaging systems. In systems that deploy Signal Protocol, each client is cryptographically identified by a key pair composed of a public key and a private key. The public key is advertised publicly, through the server, while the private key remains private on the user’s device. That means security of chats, group chats, attachments, voice notes, and voice calls across all the supported mobile platforms.

According to the scorecard by Electronic Frontier Foundation (EFF), a non-profit organization to defend civil liberties in the internet space, WhatsApp is one of the most secure messaging apps, while Skype, Viber, or Snapchat rank much lower.

Still, no encryption provides 100% security. And there are risks related to the app’s unencrypted backups, absence of key change notifications, web version, and Facebook data sharing.

Want an app like WhatsApp? Check out this case study: A Messaging System to Connect Temporary Worker Companies and the Workforce

How to prioritize a chat app feature list

By now, you must have realized that going into an IM app development on a tight budget is pretty risky. And you should be aware of other costs beyond the design and development:

  • market placement – placing your app in an app/play store;
  • multiple platform support – different platforms require different programming languages (unless you opt for a hybrid solution);
  • post-deployment and maintenance costs – after deployment, comes a period of bug fixing and stabilization, when the features are updated and sometimes new ones added;
  • marketing costs – developing a smart strategy well in advance will help to save costs and boost the app’s sales.

Given all that, strict prioritizing is an absolute must. How to make sure that your first version of the product is viable? What features to implement next? Well, your own business objectives and metrics must help you decide. On our part, the prioritized feature list below may serve as a discussion-opener.

Chat app feature list (prioritized)

WhatsApp for Business – a change of concept?

Up until recently, WhatsApp provided B2C services. But as of September 2017, (the company has confirmed it), they are building and testing new tools for businesses to use WhatsApp:

  • a free WhatsApp Business app for small companies;
  • an Enterprise Solution for bigger companies operating at a large scale with a global base of customers, like airlines, e-commerce sites, and banks.

So far, WhatsApp was getting it right with simple & focused, distraction-free consumer solution. Does it mean, the company is changing its usual ways? What does the company have in store for businesses big and small? Let’s speculate on the winning qualities of an enterprise instant messaging mobile solution.

Qualities of an enterprise mobile messenger

Top-of-the-line security

Data protection is the number-one concern for businesses. You can build relationships with colleagues, partners, and clients on trust. But it’s only fair to protect the data by technology.

A cloud-based messenger is not the best alternative for regulated industries or anyone concerned about high data security. The confidential information any corporation shares needs a more reliable solution. Not every app offers end-to-end encryption as well as other data protection on multiple levels. Even E2EE has its backdoors and vulnerabilities.

Mobile device management (MDM) has to be part of the enterprise security policy. Corporate data leak as a result of devices being lost or stolen can be prevented by remotely erasing all the sensitive information, such as wi-fi passwords, codes, and documents stored on the device. This is especially important as the BYOD (Bring-Your-Own-Device) strategy becomes commonplace.

Persistence

In persistent chats, messages are saved over time, so new and old participants can see all the chat history at any time. Persistence also implies the original document or message shared is protected from altering and deletion under any circumstances – be it line disconnection, equipment failure, or other adverse situation. In case of sharing a knowledge base to generate critical ideas and take fast decisions, the data should be accessible whenever needed. That’s something few run-of-the-mill chat apps on the market can provide.

Adaptability & scalability

Being adaptable to various devices and multiple mobile/PC platforms is the necessary evil in a business environment. It’s just a reflection of today’s way of conducting business. We use our smartphones on-the-go, but in the office space or working remotely, we switch between laptops, PCs, tablets, and phones. Any-device all-time syncing can be particularly challenging with geographically dispersed and distributed teams.

As we have shown above, scalability is critical once the app takes off. You never know how fast the user base will grow, but you must be prepared for the best outcome.

Business tool integration

The weakest link of consumer chat apps is that they are not interested in add-ins to allow line-of-business system integrations. Take developers, for one. They widely use Slack – an enterprise messaging app – since it allows for seamless integration with other critical software, like Jira, Github, Confluence, Trello, Google Drive, Dropbox. All these are part and parcel of day-to-day communication within organizations, between partners, or with clients. Managing all the business processes from the same tab equals to having everyone on the same page.

Support & updates

Though the internet is brimming with answers to any specific instance, nothing compares to having a round-the-clock dedicated expert available. Enterprise is a fast-paced environment that hugely depends on timely solutions. So having 24/7 enterprise support at hand is crucial to any advanced enterprise chat app. Regular app updates and server maintenance have to be smooth and seamless in the context of business communication.

Advanced administration

Just like an organization has different levels of subordination, an enterprise messenger mimics this pattern in interactive design. An admin panel is essential. Having a fixed level of control on who can see a message, create a chat room, share, view, or modify documents, adds discipline and structure to communication. This way, everyone complies with regulatory specifics of ways communication and file sharing are conducted.

Business-specific features

Bonus features are always welcome. Chat app providers know that and lavishly extend functionality far beyond peer-to-peer texting. Sending photos, emoji, or stickers may be part of a particular corporate culture as long as it helps to achieve productivity. Still, the features like advanced alerts, live streaming, #hashtags or @mentions will be more pertinent in business messaging. But all is good in moderation. And WhatsApp is a proof how ruthlessly rooting out all distractions contributes to meaningful communication.

Perfection is achieved not when there's nothing more to add, but when there's nothing left to take away. Antoine de Saint-Exupery

Last-minute observations

WhatsApp has brought back the focus on genuine communication in consumer IM mobile apps. Now it’s exploring new terrains of enterprise communication and has great chances to succeed. Distraction-free environment for collaboration translates into efficiency. Great products are not built overnight, but informed decisions and determination accelerate their way to excellence.

Let us all stay focused and build great products.

How much does it cost to build an app like WhatsApp with CodeTiburon?

Estimate my project

Did you enjoy the read? Was it useful? Your sentiment helps us to create better content. Use the reactions to assess the article. Or leave us a note in the comments. We are out here to boost your tech savvy.
4.2/ 5.0 rating (316 votes)
15
Leave a Reply
newest oldest most voted
johnes mitchell
Member

Hi Olga Yatskevich, whatsapp is most popular chat app now, i have learned many things after reading your article, thanks for sharing this info. I have seen many mod app’s are available on INTERNET those are look a like whatsapp. For example Gbwhatsapp, yowhatsapp and Og whatsapp. But whatsapp is best one ever.

Umut Yerebakmaz
Member
Umut Yerebakmaz

It’s a very detailed and beautiful article. The information you provide is very valuable. I’m developing a small social sharing app. can you share a sample document for the message model digram ?

Lesya Toporova
Member

Messengers are very popular apps

Назар Исаченко
Member

Very interesting topic about the social network Whatsapp, and how it works, thank you, found it interesting and useful in some ways.

Tauqeer Ahmad
Member

Wow! It was an amazing read. Such incredibly well written and detailed article. Thank you, Olga Yatskevich.
I planned to inform myself about how chatting apps work, and came across this. I will reread and hope to understand the in-depth workings of not only the end product but what goes into the product, and its architectural significance.

Imam Uddin
Member

Thank you

Eliza expert
Member

Very nicely explained i like the content

Nextbrain Technologies
Member

Thank you so much for sharing this wonderful article with us. I appreciate your work. Keep publishing such amazing articles.Thanks.