In modern onboarding flows, verifying that a user has an active account on a specific platform is a common requirement. Whether you are building a communication-heavy application or a verification service, checking for account presence helps ensure that your downstream messaging efforts are directed toward reachable users.
This guide explores how to integrate the WhatsApp Checker API to perform synchronous registration checks using phone identifiers.
Understanding the Integration Boundary
The WhatsApp Checker API follows a request-response pattern. You submit a phone number in E.164 format, and the service returns a registration signal. This is a "phone-first" workflow, meaning each request handles a single identifier.
Step 1: Setting Up Your Environment
Before implementing the API call, ensure you have your X-API-Key ready. Since this is an external integration, it is best practice to store your credentials in environment variables rather than hardcoding them into your application logic.
Step 2: Implementing the API Call
To check if a number is registered on WhatsApp, send a POST request to the /v1/check endpoint. The payload requires the service_type set to ws and the identifier string.
curl -X POST 'https://api.ekycpro.com/v1/check' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"service_type": "ws", "identifier": "+1234567890"}'
Step 3: Handling the Response
A successful request returns a JSON object containing the data.registered boolean. This serves as your primary signal for account presence.
-
success: A boolean indicating if the request completed. -
data.registered: The core signal confirming if the identifier is associated with a WhatsApp account. -
data.id: A unique identifier for the check request, useful for logging and auditing.
Step 4: Testing and Sandboxing
When building integrations, you should avoid hitting production endpoints with live user data during early development. Instead, implement a mock adapter layer in your testing suite. By creating a fixture file that mirrors the expected JSON structure, you can simulate various scenarios—such as successful registration, unregistered numbers, or API errors—without triggering actual billing events.
Mocking Example (Conceptual)
// Example of a test fixture for your integration layer
const mockWhatsAppResponse = {
"success": true,
"data": {
"id": "chk_a1b2c3d4e5f6",
"identifier": "+1234567890",
"registered": true,
"billed": true
}
};
By decoupling your application logic from the API response, you can write unit tests that validate how your system handles the data.registered boolean without needing a constant network connection.
Conclusion
Integrating the WhatsApp Checker API provides a straightforward way to verify account presence. By focusing on a clean integration boundary and robust testing with fixture files, you can build reliable onboarding workflows that effectively utilize platform registration signals. For more details on the API contract, refer to the official documentation.
This article was drafted with AI assistance and reviewed before publishing.
Top comments (0)