API peringatan
API Senarai Peringatan
Dapatkan peringatan dalam ruang kerja anda, 50 pada satu masa, yang terbaharu dahulu. Gunakannya untuk mencari ID peringatan, mengaudit automasi anda atau membuat sandarannya.
https://wbiztool.com/api/v1/reminder/list/Body: JSON atau medan borang
Endpoint ini hanya menerima POST. Permintaan GET, walaupun dengan rentetan pertanyaan, memulangkan HTTP 400 dengan Invalid JSON format: Expecting value….
Senarai ini termasuk peringatan aktif dan yang dijeda dari seluruh ruang kerja, sama ada dicipta melalui API atau di halaman Reminders (Peringatan). Peringatan yang dibatalkan tidak disertakan.
Contoh ringkas#
curl -X POST https://wbiztool.com/api/v1/reminder/list/ \
-H "Content-Type: application/json" \
-d '{
"client_id": 12345,
"api_key": "YOUR_API_KEY",
"page": 1
}'import requests
response = requests.post(
"https://wbiztool.com/api/v1/reminder/list/",
json={"client_id": 12345, "api_key": "YOUR_API_KEY", "page": 1},
timeout=60,
)
try:
result = response.json() # read the body even when the HTTP code is 400
except ValueError:
raise SystemExit(f"HTTP {response.status_code}: not JSON. Check that your api_key exists.")
if result["status"] == 1:
print(f"{result['total']} reminders in total")
for reminder in result["reminders"]:
print(reminder["id"], reminder["name"], reminder["cron_expression"], reminder["is_active"])
else:
print("Failed:", result["message"])// Node.js 18+ (built-in fetch). Save as .mjs to use top-level await.
const response = await fetch("https://wbiztool.com/api/v1/reminder/list/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ client_id: 12345, api_key: "YOUR_API_KEY", page: 1 }),
});
// Read the body even when the HTTP code is 400. A non-JSON reply means the api_key wasn't found.
const text = await response.text();
let result;
try {
result = JSON.parse(text);
} catch {
throw new Error(`HTTP ${response.status}: not JSON. Check that your api_key exists.`);
}
if (result.status === 1) {
console.log(`${result.total} reminders in total`);
for (const reminder of result.reminders) {
console.log(reminder.id, reminder.name, reminder.cron_expression, reminder.is_active);
}
} else {
console.error("Failed:", result.message);
}<?php
$ch = curl_init('https://wbiztool.com/api/v1/reminder/list/');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'client_id' => 12345,
'api_key' => 'YOUR_API_KEY',
'page' => 1,
]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
]);
$result = json_decode(curl_exec($ch), true);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($result === null) {
echo "HTTP $httpCode: not JSON. Check that your api_key exists.";
} elseif ($result['status'] === 1) {
foreach ($result['reminders'] as $reminder) {
echo $reminder['id'] . ' ' . $reminder['name'] . ' ' . $reminder['cron_expression'] . "\n";
}
} else {
echo 'Failed: ' . $result['message'];
}Gantikan 12345 dan YOUR_API_KEY dengan nilai anda sendiri. Lihat Pengesahan identiti untuk mengetahui di mana nilai ini boleh didapati.
Parameter permintaan#
client_idintegerwajibAPI Client ID anda dari Settings → API keys (Tetapan → Kunci API).
api_keystringwajibKunci API anda dari halaman yang sama.
pageintegerpilihanNombor halaman, bermula dari
1(lalai). Setiap halaman memuatkan 50 peringatan, dan saiz halaman tidak boleh diubah. Nilai yang bukan nombor bulat 1 atau lebih dianggap sebagai1.
Respons#
Permintaan yang berjaya memulangkan HTTP 200:
{
"reminders": [
{
"id": 3187,
"name": "Monthly rent reminder",
"to_number": "919876543210",
"message_template": "Hi Aman, a reminder that your rent is due on {current_date_formatted}.",
"msg_type": 0,
"msg_type_display": "Text",
"img_url": "",
"file_name": "",
"cron_expression": "0 10 1 * *",
"next_run": "2026-10-01 10:00:00 UTC",
"is_active": true,
"whatsapp_client_id": 678,
"created_at": "2026-09-16 04:45:12"
}
],
"total": 1,
"page": 1,
"page_size": 50,
"message": "Success",
"status": 1
}
| Medan | Jenis | Penerangan |
|---|---|---|
status | integer | 1 jika berjaya, 0 jika permintaan gagal. |
message | string | Success, jika tidak, mesej ralat. |
reminders | tatasusunan | Peringatan pada halaman ini, yang terbaharu dahulu. Kosong jika halaman melepasi penghujung. |
total | integer | Bilangan peringatan dalam ruang kerja, merentasi semua halaman. |
page | integer | Halaman yang dipulangkan. |
page_size | integer | Sentiasa 50. |
Medan peringatan#
| Medan | Jenis | Penerangan |
|---|---|---|
id | integer | ID peringatan. Gunakannya dengan Batal peringatan. |
name | string | Nama peringatan, atau Unnamed Reminder jika tiada nama. |
to_number | string | Nombor telefon atau nama kumpulan yang menerima peringatan. |
message_template | string | Mesej, dengan pemboleh ubah templat yang belum diisi. |
msg_type | integer | 0 teks, 1 imej, 2 fail. |
msg_type_display | string | Text, Image atau File. |
img_url | string atau null | URL imej untuk peringatan imej, atau URL fail untuk peringatan fail yang dicipta melalui API. Boleh kosong atau null dalam kes lain. |
file_name | string atau null | Untuk peringatan fail: URL fail (peringatan yang dicipta dalam papan pemuka) atau nama fail (peringatan yang dicipta melalui API, yang URL-nya dalam img_url). Boleh kosong atau null dalam kes lain. |
cron_expression | string | Jadual. Lihat Ungkapan cron. |
next_run | string | Masa seterusnya jadual sepadan, sebagai YYYY-MM-DD HH:MM:SS UTC, atau Invalid cron jika ungkapan tidak dapat dibaca. Lihat amaran di bawah. |
is_active | boolean | true jika peringatan sedang berjalan, false jika ia dijeda. |
whatsapp_client_id | integer atau null | Nombor WhatsApp yang digunakan untuk menghantar, atau null jika ia menggunakan nombor pertama yang disambungkan. |
created_at | string | Masa peringatan dicipta, dalam UTC, sebagai YYYY-MM-DD HH:MM:SS. |
Ralat#
Ralat memulangkan HTTP 400 dengan status ditetapkan kepada 0, kecuali dinyatakan sebaliknya:
{ "status": 0, "message": "Upgrade your plan to use reminders feature" }
| Mesej | Cara membetulkannya |
|---|---|
Invalid JSON format: … | Badan JSON tidak sah. Anda juga menerima ralat ini untuk permintaan GET atau permintaan borang tanpa client_id. |
Auth Error - Please send correct API key and Client id | Hantar kedua-dua client_id dan api_key. |
Invalid client id | Hantar client_id sebagai nombor. |
Auth Error: invalid api key | Kunci itu milik client_id yang lain. |
Auth Error: please check client id | Kunci tidak dipautkan ke mana-mana ruang kerja. Cipta kunci baharu dalam ruang kerja yang anda mahu gunakan. |
Demo Account cannot access APIs | Gunakan akaun biasa. |
Upgrade your plan to use reminders feature | Pelan anda tidak termasuk peringatan. Naik taraf pelan anda. Peringatan sedia ada terus dijalankan dan menggunakan kredit selepas pelan diturunkan, dan tidak boleh disenaraikan, dibatalkan atau dijeda sehingga anda menaik taraf. |
Error fetching reminders: … (HTTP 500) | Berlaku masalah di pihak kami. Cuba lagi. |
Jika api_key tidak wujud atau telah dipadam, respons ialah halaman ralat HTML dengan HTTP 500 dan bukannya JSON. Uji kunci anda dengan Semak kelayakan.
Membaca setiap halaman#
Teruskan meminta halaman seterusnya sehingga sesuatu halaman mempunyai kurang daripada 50 peringatan.
import requests
reminders, page = [], 1
while True:
response = requests.post(
"https://wbiztool.com/api/v1/reminder/list/",
json={"client_id": 12345, "api_key": "YOUR_API_KEY", "page": page},
timeout=60,
)
try:
result = response.json()
except ValueError:
raise SystemExit(f"HTTP {response.status_code}: not JSON. Check that your api_key exists.")
if result["status"] != 1:
raise RuntimeError(result["message"])
reminders += result["reminders"]
if len(result["reminders"]) < result["page_size"]:
break
page += 1
print(len(reminders), "reminders")// Node.js 18+ (built-in fetch). Save as .mjs to use top-level await.
const reminders = [];
let page = 1;
while (true) {
const response = await fetch("https://wbiztool.com/api/v1/reminder/list/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ client_id: 12345, api_key: "YOUR_API_KEY", page }),
});
const text = await response.text();
let result;
try {
result = JSON.parse(text);
} catch {
throw new Error(`HTTP ${response.status}: not JSON. Check that your api_key exists.`);
}
if (result.status !== 1) throw new Error(result.message);
reminders.push(...result.reminders);
if (result.reminders.length < result.page_size) break;
page += 1;
}
console.log(reminders.length, "reminders");Petua#
- Simpan salinan anda sendiri bagi
timezonesetiap peringatan semasa anda menciptanya, kerana endpoint ini tidak memulangkannya. - Cari peringatan yang dijeda dengan menapis
is_activeyang bernilaifalse. Sambung semula di halaman Reminders. - Kemas automasi lama: mula-mula kumpulkan ID yang anda mahu batalkan merentasi setiap halaman, kemudian panggil Batal peringatan untuk setiap satu. Membatalkan semasa anda membaca halaman menganjakkan peringatan kemudian ke halaman yang lebih awal, jadi sesetengahnya akan terlangkau.
