npm SDK — whatsapp-data-sdk

WhatsApp 데이터 API용 공식 TypeScript/JavaScript 클라이언트입니다. 타입이 지정된 메서드, 런타임 종속성 없음, 캐시 우선 조회, 깔끔한 오류 분류 체계를 제공합니다.

제로 의존성
완전히 입력됨
ESM + CJS
npmGitHub

설치하다

npm install whatsapp-data-sdk
# or
pnpm add whatsapp-data-sdk
# or
yarn add whatsapp-data-sdk

네이티브 fetch를 사용하며 Node 18 이상, Bun, Deno 및 브라우저에서 작동합니다. axios나 폴리필이 필요하지 않습니다.

빠른 시작

import { WhatsAppDataClient } from 'whatsapp-data-sdk'

const client = new WhatsAppDataClient({
  apiKey: process.env.WA_API_KEY!, // sent as x-rapidapi-key
})

const profile = await client.getProfile('59898297150')
console.log(profile.exists, profile.about, profile.profilePic)

인증 및 운송

API 키는 항상 x-rapidapi-key 헤더에 포함되어 전송됩니다. 전송 방식을 통해 요청이 전송될 위치를 선택할 수 있습니다.

transport라이브 호스트캐시/DB 전용 호스트메모
'proxy' (기본)whatsapp-proxy.checkleaked.cc/number_cache 동일 호스트에서간단합니다. 기본 URL 하나만 있고 호스트 헤더는 없습니다.
'rapidapi'wp-data.p.rapidapi.comwp-data-db-only.p.rapidapi.comx-rapidapi-host를 자동으로 설정합니다. RapidAPI 키를 사용하세요.
// RapidAPI marketplace (live + DB-only hosts)
const client = new WhatsAppDataClient({
  apiKey: process.env.RAPIDAPI_KEY!,
  transport: 'rapidapi',
})

baseUrl, cacheBaseUrl, rapidApiHost, rapidApiCacheHost를 통해 모든 URL/호스트를 재정의할 수 있습니다.

캐시 우선 조회(비용 절감)

checkCached()는 먼저 저렴한 캐시/DB 전용 엔드포인트를 읽고, 해당 번호가 아직 캐시되지 않은 경우에만 유료 실시간 확인으로 전환합니다.

// cacheFirst (default): DB first → live only on a miss
const r1 = await client.checkCached('59898297150')
console.log(r1._source) // 'cache' | 'live'

// cacheOnly: never spend on a live check
const r2 = await client.checkCached('59898297150', { mode: 'cacheOnly' })

// live: always fresh
const r3 = await client.checkCached('59898297150', { mode: 'live' })

rapidapi 전송에서 캐시 읽기는 wp-data-db-only.p.rapidapi.com으로, 실시간 폴백은 wp-data.p.rapidapi.com으로 라우팅됩니다. 이는 두 개의 호스트를 사용하는 비용 절감 흐름입니다.

API 참조

모든 메서드는 마켓플레이스 엔드포인트와 1:1로 매핑됩니다.

프로필 및 사진

await client.getProfile(number, options?)            // Get Profile Information
await client.getProfileNoPicture(number, options?)   // Get Profile Information (No profile pic)
await client.getLastPicture(number)                  // Get Last Saved Picture (JPEG bytes)
await client.getDeviceCount(number)                  // Device count
await client.getOsintInfo(number)                    // OSINT Info

getProfile 옵션에는 telegram, google, lookup, includeCarrier, base64, geminiFaceAnalysis, reverseImageSearch, fullAiReport, includeDeviceCount, onlyCheck, useCache, forceBypassCache 등이 포함됩니다.

const pic = await client.getLastPicture('59898297150')
// pic.bytes: Uint8Array, pic.contentType: string
htmlImg.src = pic.toDataUri()

전화 침해

await client.getPhoneBreaches(number, { limit, offset }) // Get Phone Breaches (no external key)
await client.getPhoneBreachesExternal(number, apiKey)     // Get Phone Breaches (your checkleaked.cc key)

검색 및 데이터베이스

await client.search({ countryCode: 'UY', isBusiness: true, limit: 20 })   // Search
await client.searchGoogleMaps({ latitude: -34.9, longitude: -56.16, radius: 2000 }) // Search in Google Maps

// Bulk downloads return a Google Drive link to the full dataset (MEGA tier only)
const leaks = await client.getLeakedNumbersInfo()   // Leaked Numbers (500M database)
console.log(leaks.driveFolder.url)

const backup = await client.downloadEntireDatabase() // Download the Entire DB
console.log(backup.driveFolder.url)

대량 수표

await client.bulkCheck(numbers, { includeBusiness, noBanStatus }) // Bulk Check (live, max 50)
await client.bulkCheckDbBasic(numbers)                            // Basic Check (DB, max 1000)
await client.bulkCheckDbFull(numbers)                            // Full Check (DB, max 1000)

텔레그램 및 캐리어

// Telegram (experimental)
await client.getTelegramProfile('59898297150')            // single
await client.getTelegramProfile(['num1', 'num2'])         // batch

// Carrier
await client.carrierLookup(number)              // Carrier Lookup
await client.carrierLookupAlt(number)           // Carrier Lookup Alternative (spam-report signals)
await client.carrierLookupAlt(number, { page: 2 }) // page through the reports (response has a `pagination` block)

"찾을 수 없음" 오류가 해결됩니다. 예외를 발생시키지 않습니다.

WhatsApp에 등록되지 않은 번호는 오류가 아니라 정상적인 결과이므로, 이러한 번호는 연결됩니다(절대 거절되지 않습니다).

getProfile / getProfileNoPicture / checkCached 함수는 exists:false (그리고 code:'NUMBER_NOT_FOUND')라는 항목을 반환합니다.
검색 결과가 0개일 경우 빈 페이지가 반환됩니다(success:false, data.docs:[]).
WhatsApp 번호가 아닌 번호에 대해 getDeviceCount를 호출하면 success:false가 반환됩니다(deviceCount가 없음).
const p = await client.getProfile('14155552671')
if (!p.exists) console.log('not on WhatsApp')

발생하는 오류는 다음과 같습니다: 잘못된 번호(400), 인증 실패(401/403), 속도 제한(429), 시간 초과, 네트워크 오류 및 5xx 오류.

오류

모든 거부는 WhatsAppDataError의 하위 클래스이므로 단일 catch로 모든 것을 처리할 수 있습니다.

수업언제
ValidationError잘못된 인수(요청이 발생하기 전에 동기적으로 발생하며, .status 속성이 없음).
AuthError401 / 403 — 키가 없거나, 유효하지 않거나, 구독되지 않았습니다.
RateLimitError429 — 서버에서 Retry-After를 전송했을 때 retryAfterMs를 전달합니다.
HttpError2xx 이외의 모든 주소(예: 400, 5xx)는 .status 및 .body를 포함합니다.
TimeoutError요청 시간이 초과되었습니다.
NetworkError전송 오류(DNS 오류, 연결 재설정, 전송 도중 중단).
WhatsAppDataError위 모든 것의 기본 클래스입니다.
import { AuthError, RateLimitError, TimeoutError, WhatsAppDataError } from 'whatsapp-data-sdk'

try {
  await client.getProfile('59898297150')
} catch (err) {
  if (err instanceof AuthError) {/* 401/403 — bad/unsubscribed key */}
  else if (err instanceof RateLimitError) {/* 429 — err.retryAfterMs */}
  else if (err instanceof TimeoutError) {/* request timed out */}
  else if (err instanceof WhatsAppDataError) {
    console.error(err.status, err.body)
  }
}

구성

new WhatsAppDataClient({
  apiKey: '...',           // required
  transport: 'proxy',      // 'proxy' | 'rapidapi'
  timeoutMs: 60000,        // request timeout (bounds headers AND body read)
  retries: 2,              // retry 5xx / 429 / network / timeout (GET only) with backoff
  retryDelayMs: 500,       // exponential base; 429 honors Retry-After when longer
  baseUrl: '...',          // override live base URL
  cacheBaseUrl: '...',     // override cache/DB-only base URL
  rapidApiHost: '...',     // override live x-rapidapi-host
  rapidApiCacheHost: '...',// override cache x-rapidapi-host
  userAgent: '...',        // custom User-Agent
  fetch: globalThis.fetch, // inject a custom fetch (tests / polyfills)
})

전화번호 형식

어떤 형식의 숫자든 전달하세요. SDK가 자동으로 정규화하고, 동일한 정규화 방식을 재사용할 수 있도록 헬퍼 함수를 내보냅니다.

import { toDigits, toE164 } from 'whatsapp-data-sdk'
toDigits('+598 98 297 150') // '59898297150'  (path & live endpoints)
toE164('59898297150')       // '+59898297150' (bulk-DB endpoints; their validator requires it)
// both throw ValidationError on input with no digits

요청별 옵션

모든 메서드는 호출별 취소 및 조정을 위해 신호, 타임아웃(M), 재시도 횟수를 허용하는 옵션 객체를 전달받습니다.

const controller = new AbortController()
const p = client.getProfile('59898297150', {
  telegram: true,
  signal: controller.signal, // cancel this specific request
  timeoutMs: 5000,           // override the client timeout for this call
})
controller.abort() // rejects with WhatsAppDataError

관련된

사용자 리뷰

만족한 고객들의 실제 리뷰

4.5/5 (176 리뷰)