API 与集成
三种方式:无需代码——分店 Telegram 群与日历;面向开发者与 CRM——REST API 与 Webhook。
Telegram 群
带「确认」按钮的预约进入前台群。后台 → 「预约通知」。
日历(ICS)
所有预约通过订阅进入 Google 或 Apple 日历。后台 → 「日历」。
REST API 与 Webhook
每个预约的事件、状态、来自 CRM 的占用时间。见下文。
API 密钥
后台 → 「集成」→ 「创建密钥」。密钥只显示一次——请保存在服务器上。每个请求带上 Authorization: Bearer dk_live_… 限制:每个密钥每分钟 120 次请求。
https://dentum.uz/api/cabinet/v1
接口
/clinic分店、营业时间、是否开启在线预约/bookings?since=2026-10-01T00:00:00Z&limit=100since 之后变更的预约(游标:next_since)/bookings/D-261001-K3F7按编号获取预约/bookings/D-261001-K3F7/status状态:confirmed、declined、arrived、paid、noshow/busyCRM 占用时间:整个窗口替换(幂等)/busy?from=2026-10-01&to=2026-10-14已保存的占用时间curl https://dentum.uz/api/cabinet/v1/bookings?since=2026-10-01T00:00:00Z \
-H "Authorization: Bearer dk_live_…"
curl -X POST https://dentum.uz/api/cabinet/v1/bookings/D-261001-K3F7/status \
-H "Authorization: Bearer dk_live_…" -H "Content-Type: application/json" \
-d '{"status":"confirmed"}'
curl -X PUT https://dentum.uz/api/cabinet/v1/busy \
-H "Authorization: Bearer dk_live_…" -H "Content-Type: application/json" \
-d '{"from":"2026-10-03T00:00:00+05:00","to":"2026-10-17T00:00:00+05:00","source":"my-crm",
"blocks":[{"start":"2026-10-03T15:00:00+05:00","end":"2026-10-03T16:30:00+05:00","id":"visit-881"}]}' 预约对象
时间为塔什干时间(+05:00)。患者数据仅用于处理您诊所的预约。
{
"ref": "D-261001-K3F7",
"status": "requested",
"service": "Имплантация",
"source": "web",
"created_at": "2026-10-01T09:12:44.120Z",
"updated_at": "2026-10-01T09:12:44.120Z",
"slot": { "start": "2026-10-03T10:00:00+05:00", "preference": null, "timezone": "Asia/Tashkent" },
"patient": { "name": "Азиз", "phone": "+998901234567", "telegram_linked": true }
} 避免重复预约
当您的 CRM 通过 PUT /v1/busy 发送占用时间时,Dentum 不会向患者和 AI 代理提供这些时间。每 5–15 分钟发送一个时间窗口(例如未来 14 天)。
Webhook
在后台填写 https 地址——密钥(whsec_…)只显示一次。事件:booking.created、booking.updated(含 previous_status)、ping。请在 8 秒内返回 2xx;否则将在 1 分钟、5 分钟、30 分钟、2 小时、6 小时、12 小时后重试(共 7 次)。务必校验签名:
Dentum-Signature: t=<unix>,v1=<hex> — HMAC-SHA256(密钥, t + "." + 原始请求体)。拒绝超过 5 分钟的 t。
import { createHmac, timingSafeEqual } from 'node:crypto';
// raw — тело запроса строкой, как пришло (до JSON.parse)
export function verifyDentum(raw, header, secret) {
const m = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(header || '');
if (!m || Math.abs(Date.now() / 1000 - Number(m[1])) > 300) return false;
const want = createHmac('sha256', secret).update(m[1] + '.' + raw).digest();
const got = Buffer.from(m[2], 'hex');
return got.length === want.length && timingSafeEqual(got, want);
} function verify_dentum(string $raw, string $header, string $secret): bool {
if (!preg_match('/^t=(\d+),v1=([0-9a-f]{64})$/', $header, $m)) return false;
if (abs(time() - (int)$m[1]) > 300) return false;
return hash_equals(hash_hmac('sha256', $m[1] . '.' . $raw, $secret), $m[2]);
} 日历(ICS)
链接在后台「日历」中。Google 日历:「其他日历」→「+」→「通过网址」。Apple:「文件」→「新建日历订阅」。Google 每隔几小时刷新订阅——即时通知请使用 Telegram 群。日历中电话已遮盖(完整号码在后台)。
规范
OpenAPI 3.1: /openapi-clinic.json
问题请联系:info@dentum.uz 或 @dentumcrmbot。面向 AI 代理的独立 API — AI 代理.