
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
whatsapp-number-checker
Advanced tools
A wrapper for the RapidAPI WhatsApp Data API with bulk checking and rate limiting support
A comprehensive wrapper for the RapidAPI WhatsApp Data API featuring advanced dual rate limiting, automatic retries, and bulk number verification with intelligent queue management.
npm install whatsapp-number-checker
First, obtain an API key from RapidAPI WhatsApp Data.
⚠️ Important: The API key is required in the constructor and mandatory for accessing all methods.
import { WhatsAppChecker } from 'whatsapp-number-checker';
const checker = new WhatsAppChecker({
apiKey: 'YOUR_RAPIDAPI_KEY_HERE', // REQUIRED
throwOnLimit: false, // Don't throw error after retries
timeout: 15000, // 15 second timeout
maxRetries: 3, // Retry up to 3 times on rate limit
retryDelay: 1000 // Base delay between retries
});
// Check a single number (with automatic retries)
const result = await checker.checkNumber('+1234567890');
console.log(result);
The system automatically handles two types of rate limits extracted from API headers:
x-ratelimit-limit
, x-ratelimit-remaining
, x-ratelimit-reset
x-ratelimit-requests-limit
, x-ratelimit-requests-remaining
, x-ratelimit-requests-reset
const checker = new WhatsAppChecker({ apiKey: 'YOUR_API_KEY' });
// Monitor current status for both limits
const rateLimitInfo = checker.getRateLimitInfo();
if (rateLimitInfo) {
console.log('Window Rate Limit:');
console.log(` Used: ${rateLimitInfo.used}/${rateLimitInfo.limit}`);
console.log(` Remaining: ${rateLimitInfo.remaining}`);
console.log('Monthly Rate Limit:');
console.log(` Used: ${rateLimitInfo.monthlyUsed}/${rateLimitInfo.monthlyLimit}`);
console.log(` Remaining: ${rateLimitInfo.monthlyRemaining}`);
}
// View current interval between requests (adapts automatically)
console.log(`Current interval: ${checker.getCurrentRateInterval()}ms`);
const numbers = ['+1234567890', '+0987654321', '+1122334455'];
const bulkResult = await checker.checkBulk(numbers, {
onProgress: (completed, total, current) => {
console.log(`Progress: ${completed}/${total}`);
if (current.data && !('error' in current.data)) {
const data = current.data as any;
console.log(`✅ ${current.number}: WhatsApp Contact: ${data.isWAContact}`);
} else {
console.log(`❌ ${current.number}: Error`);
}
},
onRateLimit: (rateLimitInfo) => {
console.log('Rate limit detected:');
console.log(` Window: ${rateLimitInfo.used}/${rateLimitInfo.limit}`);
console.log(` Monthly: ${rateLimitInfo.monthlyUsed}/${rateLimitInfo.monthlyLimit}`);
},
stopOnError: false
});
console.log('Summary:', bulkResult.summary);
const checker = new WhatsAppChecker({
apiKey: 'YOUR_API_KEY', // REQUIRED
throwOnLimit: true, // Throw RateLimitError after all retries
timeout: 15000,
maxRetries: 5, // Up to 5 retries on rate limit
retryDelay: 2000, // 2 second base delay (with exponential backoff)
baseURL: 'https://whatsapp-data1.p.rapidapi.com' // Custom URL
});
try {
const result = await checker.checkNumber('+1234567890');
} catch (error) {
if (error.name === 'RateLimitError') {
console.log('Rate limit exhausted after retries:', error.rateLimitInfo);
}
}
new WhatsAppChecker(config: WhatsAppCheckerConfig)
interface WhatsAppCheckerConfig {
apiKey: string; // Your RapidAPI key (REQUIRED)
baseURL?: string; // API base URL
throwOnLimit?: boolean; // Throw error after retries (default: false)
timeout?: number; // Timeout in ms (default: 10000)
maxRetries?: number; // Max retries on rate limit (default: 3)
retryDelay?: number; // Base delay between retries in ms (default: 1000)
}
checkNumber(number: string): Promise<CheckResult>
Verifies a single WhatsApp number with automatic retries and phone validation.
checkBulk(numbers: string[], options?: BulkCheckOptions): Promise<BulkCheckResult>
Verifies multiple numbers with advanced options and progress tracking.
getRateLimitInfo(): RateLimitInfo | null
Gets current rate limit information extracted from API headers (both window and monthly).
getCurrentRateInterval(): number
Gets current interval between requests (adapts dynamically based on rate limits).
getQueueLength(): number
Gets number of pending requests in queue.
clearQueue(): void
Clears pending request queue.
getLastResponseHeaders(): any
Gets the last response headers for debugging purposes.
interface CheckResult {
number: string;
data: WhatsappPersonResponse | WhatsappBusinessResponse | { error: string; success: null } | null;
error?: string;
rateLimitInfo?: RateLimitInfo;
}
interface RateLimitInfo {
// Window rate limit (short-term)
remaining: number; // From x-ratelimit-remaining
limit: number; // From x-ratelimit-limit
reset: number; // From x-ratelimit-reset (timestamp)
used: number; // Calculated: limit - remaining
// Monthly rate limit (long-term)
monthlyRemaining: number; // From x-ratelimit-requests-remaining
monthlyLimit: number; // From x-ratelimit-requests-limit
monthlyReset: number; // From x-ratelimit-requests-reset (timestamp)
monthlyUsed: number; // Calculated: monthlyLimit - monthlyRemaining
}
interface WhatsappPersonResponse {
_id: string;
number: string;
about: string;
countryCode: string;
isBlocked: boolean;
isBusiness: boolean;
isEnterprise: boolean;
isGroup: boolean;
isMe: boolean;
isMyContact: boolean;
isUser: boolean;
isWAContact: boolean; // Main indicator: Has WhatsApp
name: string;
phone: string;
profilePic: string;
pushname: string;
shortName: string;
type: string;
// ... other fields
}
interface WhatsappBusinessResponse {
number: string;
isBusiness: boolean;
isEnterprise: boolean;
isUser: boolean;
isWAContact: boolean; // Main indicator: Has WhatsApp
name: string;
shortName: string;
verifiedLevel: number;
verifiedName: string;
countryCode: string;
phone: string;
businessProfile: BusinessProfile;
// ... other fields
}
interface BulkCheckOptions {
onProgress?: (completed: number, total: number, current: CheckResult) => void;
onRateLimit?: (info: RateLimitInfo) => void;
stopOnError?: boolean;
maxRetries?: number;
}
interface BulkCheckResult {
results: CheckResult[];
summary: {
total: number;
successful: number;
failed: number;
rateLimited: number;
};
rateLimitInfo?: RateLimitInfo;
}
const checker = new WhatsAppChecker({
apiKey: 'YOUR_API_KEY',
maxRetries: 3,
throwOnLimit: true
});
try {
const result = await checker.checkNumber('+1234567890');
} catch (error) {
if (error instanceof RateLimitError) {
console.log('Rate limit exhausted after 3 retries');
console.log('Limit info:', error.rateLimitInfo);
console.log('Window reset:', new Date(error.rateLimitInfo.reset * 1000));
console.log('Monthly reset:', new Date(error.rateLimitInfo.monthlyReset * 1000));
}
}
Window vs Monthly Handling:
If you were using the previous version with manual rateLimit
:
// BEFORE (v1.0.0)
const checker = new WhatsAppChecker({
apiKey: 'key',
rateLimit: 2 // Manual configuration
});
// NOW (v1.1.0+)
const checker = new WhatsAppChecker({
apiKey: 'key', // REQUIRED
maxRetries: 3, // New: automatic retries
retryDelay: 1000 // New: delay between retries
// rateLimit is now extracted automatically from headers
// Supports both window and monthly limits
});
The library includes test scripts to validate functionality:
# Test a single number
npm run test-api <API_KEY> <PHONE_NUMBER> [--verbose]
# Examples
npm run test-api "8ecfc15d5dmsh..." "+1234567890"
npm run test-api "8ecfc15d5dmsh..." "+59898297150" --verbose
# Test multiple numbers
npm run test-bulk <API_KEY> <PHONE_1> [PHONE_2] [...] [--verbose] [--stop-on-error]
# Examples
npm run test-bulk "8ecfc15d5dmsh..." "+1234567890" "+0987654321" "+1122334455"
npm run test-bulk "8ecfc15d5dmsh..." "+1234567890" "+0987654321" --verbose
npm run test-bulk "8ecfc15d5dmsh..." "+1234567890" "+0987654321" --stop-on-error --verbose
Available flags:
--verbose, -v
: Shows detailed information including rate limit headers--stop-on-error
: Stops processing on first errorBulk test displays:
See:
examples.ts
- Basic and advanced examplesexample-env.ts
- Usage with environment variablesContributions are welcome! Please:
MIT
FAQs
A wrapper for the RapidAPI WhatsApp Data API with bulk checking and rate limiting support
We found that whatsapp-number-checker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.