繁體中文
繁體中文
Appearance
繁體中文
繁體中文
Appearance
WallaWhats REST API 讓您能以程式化方式管理手機號碼、X 帳號訂閱和通知歷史紀錄 —— 凡是可在控制台完成的操作,都能透過 API 達成。
https://api.wallawhats.comapplication/json每個請求都必須在 x-api-key 請求標頭中附帶 API 金鑰:
curl https://api.wallawhats.com/user/profile \
-H "x-api-key: bws_prod_00000000000000000000000000000000"金鑰可在控制台的 Settings → API Keys 中建立,或透過 POST /apikeys 建立。金鑰以 bws_ 開頭,長度為 36 個字元。金鑰僅在建立時顯示一次 —— 若遺失,請刪除舊金鑰並建立新的。
401 Unauthorized。| 方案 | 可建立金鑰數 |
|---|---|
| Free | 1 |
| Pro | 1 |
| Pro+ | 2 |
| Business | 5 |
| Enterprise | 20 |
超出方案上限時會回傳 400,錯誤訊息為 "error": "api key limit reached"。
錯誤以 JSON 形式回傳,包含 error 欄位與 HTTP 狀態碼:
{ "error": "phoneNumber is required" }| 狀態碼 | 含義 |
|---|---|
400 | 參數無效、配額超限或違反業務規則 |
401 | API 金鑰缺少或無效 |
402 | 點數不足,無法完成操作 |
404 | 找不到資源 |
500 | 伺服器錯誤 —— 請使用指數退避策略重試 |
lastKey 游標分頁。403。若遇到非預期的限流,請聯絡支援團隊。GET /user/profile回傳已驗證使用者的個人資料。
回應
{
"userId": "5a4cbd70-...",
"email": "jane@example.com",
"name": "Jane",
"plan": "pro_plus",
"createdAt": 1745000000000
}範例
curl https://api.wallawhats.com/user/profile \
-H "x-api-key: bws_prod_..."手機號碼是一個可接收提醒的已驗證 WhatsApp 號碼。訂閱任何 X 帳號前,您必須先完成手機驗證。
POST /phones產生一組 6 位數驗證碼並透過 WhatsApp 發送至該號碼。此時手機號碼處於 pending_verification 狀態。
請求
| 欄位 | 類型 | 必填 | 備註 |
|---|---|---|---|
phoneNumber | string | 是 | E.164 格式,例如 +34612345678 |
displayName | string | 否 | 控制台中顯示的友善標籤 |
回應
{ "phoneNumber": "+34612345678", "status": "pending_verification" }錯誤
400 "invalid phone number format" —— 不符合 E.164 格式400 "phone number limit reached" —— 超過方案允許(Free/Pro/Pro+ 1 組,Business 3 組,Enterprise 10 組)範例
curl -X POST https://api.wallawhats.com/phones \
-H "x-api-key: bws_prod_..." \
-H "Content-Type: application/json" \
-d '{"phoneNumber": "+34612345678", "displayName": "Work"}'POST /phones/verify提交 6 位數驗證碼以完成手機驗證。驗證碼 15 分鐘內有效。
請求
| 欄位 | 類型 | 必填 |
|---|---|---|
phoneNumber | string(E.164) | 是 |
code | string(6 位數) | 是 |
回應
{ "phoneNumber": "+34612345678", "status": "verified" }錯誤
404 "phone not found"400 "invalid code" —— 驗證碼錯誤400 "code expired" —— 已超過 15 分鐘400 "phone already verified"GET /phones回應
{
"phones": [
{
"phoneNumber": "+34612345678",
"status": "verified",
"displayName": "Work",
"createdAt": 1745000000000,
"verifiedAt": 1745000060000
}
],
"count": 1
}DELETE /phones/{phoneNumber}移除手機號碼並停用所有指向該號碼的訂閱。請將 + 進行 URL 編碼為 %2B。
回應
{ "success": true }範例
curl -X DELETE "https://api.wallawhats.com/phones/%2B34612345678" \
-H "x-api-key: bws_prod_..."訂閱會將您想監控的 X 帳號與已驗證的某個手機號碼綁定。該 X 帳號發文時,WallaWhats 會向該手機號碼傳送 WhatsApp 提醒。
POST /subscriptions請求
| 欄位 | 類型 | 必填 | 備註 |
|---|---|---|---|
xUsername | string | 是 | 1–15 個字元,字母、數字和底線組成。可帶 @ 前綴,會自動移除。 |
phoneNumber | string(E.164) | 是 | 必須是您已驗證的某個手機號碼。 |
回應
{
"xUsername": "elonmusk",
"xUserId": "44196397",
"xDisplayName": "Elon Musk",
"xProfileImage": "https://pbs.twimg.com/...",
"phoneNumber": "+34612345678",
"isActive": true,
"createdAt": 1745000000000
}錯誤
400 "invalid X username format" —— 不符合正規表示式400 "phone not found" / "phone not verified"400 "subscription limit reached" —— 見下方方案表404 "X account not found" —— 使用者名稱在 X 上無法解析方案限制
| 方案 | 訂閱數 |
|---|---|
| Free | 1 |
| Pro | 1 |
| Pro+ | 2 |
| Business | 5 |
| Enterprise | 50 |
GET /subscriptions回應
{
"subscriptions": [ /* 與 POST /subscriptions 回應結構相同 */ ],
"count": 3
}DELETE /subscriptions/{xUsername}xUsername 不區分大小寫。請在傳送前去除 @。
回應
{ "success": true }WallaWhats 傳送的每一則提醒及其 WhatsApp 送達狀態都會記錄於此。
GET /notifications查詢參數
| 參數 | 類型 | 說明 |
|---|---|---|
from | number(毫秒時間戳) | 篩選此時間或之後建立的通知 |
to | number(毫秒時間戳) | 篩選此時間或之前建立的通知 |
lastKey | string | 前次回應回傳的分頁游標 |
回應
{
"notifications": [
{
"notificationId": "a1b2c3d4-...",
"userId": "5a4cbd70-...",
"phoneNumber": "+34612345678",
"xUsername": "elonmusk",
"tweetId": "1797123456789000000",
"tweetText": "...",
"tweetUrl": "https://x.com/elonmusk/status/...",
"waMessageId": "wamid.HBgN...",
"status": "delivered",
"errorMessage": null,
"createdAt": 1745000000000,
"updatedAt": 1745000002000
}
],
"lastKey": "eyJOT1RJRklDQVRJT05fSUQi..."
}status 可能的值:queued、sent、delivered、read、failed。
每頁 50 筆。當 lastKey 不存在時,表示已到末尾。
管理您的應用程式呼叫此 API 所使用的金鑰。
POST /apikeys請求
| 欄位 | 類型 | 必填 |
|---|---|---|
name | string | 否,預設為 "Default" |
回應(201 Created)
{
"apiKey": "bws_prod_00000000000000000000000000000000",
"keyPrefix": "bws_prod_00",
"keyName": "CI server",
"createdAt": 1745000000000,
"expiresAt": 1776536000000
}僅顯示一次
apiKey 僅在建立時回傳一次。請立即將其儲存到您的密碼管理器。後續呼叫只會暴露 keyPrefix。
GET /apikeys回應
[
{
"keyPrefix": "bws_prod_00",
"keyName": "CI server",
"createdAt": 1745000000000,
"lastUsedAt": 1745086400000,
"expiresAt": 1776536000000
}
]DELETE /apikeys/{keyPrefix}請使用列表回應中的 12 字元 keyPrefix —— 切勿使用完整金鑰。
回應
{ "success": true }# 1. 在控制台建立金鑰並匯出
export WALLA_API_KEY="bws_prod_..."
# 2. 註冊並驗證您的 WhatsApp 號碼
curl -X POST https://api.wallawhats.com/phones \
-H "x-api-key: $WALLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phoneNumber":"+34612345678","displayName":"Mobile"}'
# -> 手機會收到一組 WhatsApp 驗證碼。送出它:
curl -X POST https://api.wallawhats.com/phones/verify \
-H "x-api-key: $WALLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phoneNumber":"+34612345678","code":"123456"}'
# 3. 訂閱一個 X 帳號
curl -X POST https://api.wallawhats.com/subscriptions \
-H "x-api-key: $WALLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"xUsername":"elonmusk","phoneNumber":"+34612345678"}'
# 4. 等待提醒送達
curl https://api.wallawhats.com/notifications \
-H "x-api-key: $WALLA_API_KEY"就是這麼簡單 —— 一旦 X 帳號發文,大約 10 秒內提醒就會送達手機。
API 相關問題、Bug 回報或配額提升申請:請在控制台的 Support 頁籤提交工單,或寄信至 hello@support.wallawhats.com。