Direct to Chat is a minimal Android application that helps you send WhatsApp messages to unsaved contacts without needing to save their number to the phone book first. The app leverages official WhatsApp API to open the chat window of a particular number directly.
Note that I was unable to find a way to include direct calling or video calling support using any official means. Any help in that regard would be much appreciated.
If you want the official experience and do not want to use .apk files, you can download this app from the Google Play Store. 1
Using the android.intent.action.VIEW
action and WhatsApp's official api.whatsapp.com website, it is quite easy to open the chat window to a particular phone number, regardless of whether it is in the contact book or not. To ensure that the browser does not catch this intent, the setPackage(String packageName)
method is used to explicitly specify the target package.
The data provided to the intent is of the form https://api.whatsapp.com/send?phone=CCxxxxxxxxxx&text=yyyyyy
where CC is the country code, xxxxxxxxx is the WhatsApp number, and yyyyy is an optional parameter to pre-fill the text box with some text after the chat window is opened.
The country code is necessary while providing the phone number. To help in this regard, the app contains a list of 255 countries with their ISD and ISO codes, along with the icons in png format for almost all of the countries.
This step is quite simple. Clone this repository and open the build.gradle file directly in Android Studio or the IDE of your choice. Once you build the project, you can install it onto any Android device running Android 9.0 Pie or above.
This application makes uses of the following sources:
- Flags of all countries obtained via Flagpedia.net
- Fluent UI System Icons by Microsoft
- Fast Scroller by L4Digital
Footnotes
-
Google Play and the Google Play logo are trademarks of Google LLC. ↩