Source code of the WhatsApp Number Checker
Tags: whatsapp, api, typescript, beginners
Published: 2023-11-23 06:49:07

## Check if a number is on WhatsApp

Determine which phone numbers are active and which cannot receive Whatsapp messages. The phone user will not know about it!

This tool was created using our public API that you can access too with your [Whapi.Cloud](https://whapi.cloud/features) account.

- Clear your database of unnecessary numbers.
- Optimize your resources and save time and money.
- Integrate into your application or program.

[GitHub](https://github.com/Whapi-Cloud/whatsapp-checker)

**How to use**

1. Make sure you have [Node.js](https://nodejs.org/en) installed.
2. Clone the repository or download the source files of the script: https://github.com/Whapi-Cloud/whatsapp-checker

**Customization**
1. open the <u>phones.json</u> file.
2. In the <u>check_phones</u> array, add the phone numbers you want to check. For example:
{
  "`check_phones`: [ "number1", "number2".]
}


**Requirements**
This tool was created using our public API that you can access too with your Whapi.Cloud account. It takes 3 steps to get started to use WhatsApp API with Whapi.Cloud. You will need a phone with WhatsApp Business or regular WhatsApp. Access is granted for 5 days free of charge. Pair your number via QR code in your account.

> In the file <u>checker_data.json</u> you need to insert the token from your personal account Whapi.Cloud, as well as the number you want to check. It also shows the limits we recommend to use. <u>daily_limit</u> is how many checks are left, and <u>refreshed_limit</u> is how much of the limit is set on refresh.

**Running the script**
Open a terminal or command prompt in the folder with the script. Run the following commands to install the necessary dependencies and compile the script: <u>npm i</u> <u>npx tsc</u>

Run the script with the command: <u>node checker.js</u>

**Getting Started**
[Help to get started with API](https://support.whapi.cloud/help-desk/getting-started/getting-started)

{% embed https://youtu.be/qlJW6rUycw8  %}

**How to Connect to Whapi.Cloud**
[Registration](https://panel.whapi.cloud/register). The first step is to register on the Whapi.Cloud website and create an account. **It's free and doesn't require you to enter a credit card.** After registration you will immediately have access to a test channel with a small limitation. Wait for it to start (it usually takes about a minute). You will need to connect any phone for Whatsapp automation.

To connect your phone, use the QR code available when you click on your trial channel in your personal account. Then open WhatsApp on your mobile device, go to _Settings -> Connected devices -> Connect device -> Scan QR code_.

In the second and third steps, the service will ask you to customize the channel: write its name for your convenience, set webhooks, change settings. All these steps can be skipped, and we will come back to webhooks a little later. After launching, you will find in the center block under the information about limits, your API KEY, that is Token. 
This token will be used to authenticate your API requests. Generally, it's added to the request headers as a Bearer Token or simply as a request parameter, depending on the API method you're using.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5rcdgzs9xpjc1uo078b.jpg)

Happy coding! If you have any questions, feel free to write :)