# Send WhatsApp Messages using the Android SDK

Before jumping into using the SDK, let's follow the below steps to create the project on [developers.facebook.com](https://developers.facebook.com/) to claim the phone number id.

**Step 1: Create a WhatsApp App**

![172007.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653888244779/EKFpvSwK6.png align="left")

Give your app a descriptive name (do not use any Facebook trademarks like WhatsApp or Facebook in the app name) and click the Create App button to create the app.

On the next screen, you will be required to link your WhatsApp app to your Facebook business account. You will also have the option to create a new business account if you don’t have one yet.

![172539 (1).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653888341151/HHNGtVb2e.png align="left")

**Step 2: Add Recipient’s phone number**

Your WhatsApp app will provide you with a temporary access token that will be valid for 23 hours. Make a note of this token as we’ll need it in a later step.

![173159 (1).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653888448628/Kj9Tkjwmr.png align="left")

Use below Android SDK to Send WhatsApp Messages using the WhatsApp API

#### Kindly use the following links to use this library:

In settings.gradle (Project)
```kotlin
dependencyResolutionManagement {
    repositories {
        …….
        maven { url 'https://jitpack.io' }
    }
}
```
And then in the other gradle file(maybe your app gradle or your own module library gradle, but never add in both of them to avoid conflict.)
```kotlin	
dependencies {
	implementation 'com.github.myinnos:WhatsApp-SDK:<latest-version>'
}
```
How to use
-----
**Step 2:** implement App Icon Name Changer method : [#Example - MainActivity.kt](https://github.com/myinnos/WhatsApp-Android-SDK/blob/main/app/src/main/java/in/myinnos/whatsappsdk/MainActivity.kt)
```kotlin
WhatsAppInitialization.sendMessage(
                "token", //token
                "version", //ex: v13.0
                "phone_number_id", //ex: 103075932423434
                "customer_phone_number",
                "template_name", //ex: hello_world
                "language_code", //ex: en_US
            ) { wResult ->
                Handler(Looper.getMainLooper()).post {
                    if (wResult?.getMessage() == null) {
                        // failed results
                    } else {
                        // success results
                        Log.d("RESULTS", wResult.getMessage())
                    }
                }
            }
```
##### Any Queries? or Feedback, please let me know by opening a [new issue](https://github.com/myinnos/WhatsApp-Android-SDK/issues/new)!

PS: Images in the article are taken from [labnol](https://www.labnol.org/whatsapp-api-google-sheets-220520)

> Let me know your thoughts on [Twitter](https://twitter.com/MyInnos).

