文档·Webhooks
🪝

Webhooks

以带 HMAC 签名的 HTTPS 回调接收激活、租用和钱包事件。

为什么使用 webhooks

轮询很浪费:亚秒级轮询受限流,秒级轮询增加延迟。Webhook 在事件发生的瞬间推送给你。

注册

Account → Webhooks → New endpoint:HTTPS URL、事件类型、重试策略(exponential / linear / none)。签名密钥仅显示一次。

事件

  • activation.sms_received — 入站 SMS 匹配到某个激活
  • activation.expired — 窗口无验证码关闭
  • activation.finished — 激活已确认
  • rent.sms_received — 租用号码上的入站 SMS
  • wallet.credited / wallet.debited — 资金流动
  • support.message.received — 支持线程中的客服回复

Payload

{
  "event": "activation.sms_received",
  "delivery_id": "b7e2c1a0-9f3d-4c5e-8a1b-2d3e4f5a6b7c",
  "created_at": "2026-05-26T14:30:14Z",
  "data": { "order_id": "9a1f2c3d-4e5b-6a7c-8d9e-0f1a2b3c4d5e", "phone": "+380635551822", "code": "123456", "service": "telegram" }
}

验证签名

头部:X-Eveses-Signature: sha256=<hmac> (timestamp in X-Eveses-Timestamp)。HMAC-SHA256 基于 <ts>.<raw-body> 使用你的密钥。

$ts  = $_SERVER['HTTP_X_EVESES_TIMESTAMP'] ?? '';
$sig = $_SERVER['HTTP_X_EVESES_SIGNATURE'] ?? '';
$expected = 'sha256=' . hash_hmac('sha256', $ts . '.' . file_get_contents('php://input'), $secret);
if (!hash_equals($expected, $sig) || abs(time() - (int) $ts) > 300) { http_response_code(401); exit; }

拒绝超过 5 分钟的请求(重放窗口)。

重试

失败投递(非 2xx 或 10 秒内无响应)按策略重试。Exponential:30s、2min、10min、1h、6h,之后死信。可从面板手动重放。