Đến nội dung
X-Buddy

Tra cứu API

Tạo / sửa điểm nhận webhook

webhook_save — Create (no endpoint_id) or change an endpoint.

webhook_save · Đổi thiết lập trong X-Buddy

Mô tả kỹ thuật bằng tiếng Anh — đúng chữ AI agent đọc qua MCP.

Create (no endpoint_id) or change an endpoint. Creating returns the signing secret ONCE (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature = v1,base64 HMAC-SHA256 of id.timestamp.body). Changing needs expected_revision. Retries: 30 s, 2 min, 10 min, 1 h, 6 h… for 72 h; 20 failures in a row in 24 h pause it.

REST POST /api/public/v1/webhooks
Công cụ MCP webhook_save
Quyền cần có integrations.manage — Chủ, Quản lý
Nhóm quyền webhooks:manage
Nhóm Sự kiện và webhook
Hiện sẵn trong hồ sơ Hạ tầng

Đầu vào

Trường Kiểu Bắt buộc Mô tả
endpoint_id string (uuid) Không
name string (1–60 chars) Có A name people recognise, e.g. "n8n inbox flow".
url string (uri, 0–500 chars) Có HTTPS address that receives the events (no internal / private addresses).
event_types array of job.succeeded · job.failed · job.unknown · job.held · job.cancelled · batch.completed · dm.received · dm.request_received · reply.received · mention.received · follower.gained · follower.lost · post.published · post.failed · post.partial · campaign.person_entered · campaign.person_replied · campaign.person_completed · campaign.paused_auto · account.session_lost · account.session_restored · account.safety_changed · account.x_rate_limited · account.chat_locked · vps.offline · vps.online · proxy.failed · alert.opened · integration.paused · scan.completed · limit.reached (1–31 items) Có Which event types to send.
account_ids array of string (uuid) (0–200 items) Không Only events of these accounts (account-less events always arrive). null = every account.
group_ids array of string (uuid) (0–50 items) Không Only events of accounts in these groups. null = no group filter.
message_content boolean Không Include message / reply text (needs the connection's read-message-text right).
expected_revision integer (1–∞) Không The revision you read (optimistic locking); a newer revision fails with revision_conflict.

Kết quả

Trả về kết quả của thao tác trong phong bì { data, meta }.

Cần khoá idempotency (Idempotency-Key, 8–128 ký tự). Gửi lại cùng khoá không bao giờ làm lại việc.

Ví dụ

Gọi qua REST

curl -X POST "https://reach-link-craft.lovable.app/api/public/v1/webhooks" \
  -H "Authorization: Bearer $XBUDDY_API_KEY" \
  -H "Idempotency-Key: 6f1c2a90-example-key" \
  -H "Content-Type: application/json" \
  -d '{"name":"Example","url":"https://example.com/","event_types":["job.succeeded"]}'

Gọi qua MCP

{
  "method": "tools/call",
  "params": {
    "name": "webhook_save",
    "arguments": {
      "name": "Example",
      "url": "https://example.com/",
      "event_types": [
        "job.succeeded"
      ],
      "idempotency_key": "6f1c2a90-example-key"
    }
  }
}

Lỗi có thể gặp

Mã HTTP Thử lại được
unauthorized 401 Không
key_expired 401 Không
integration_revoked 401 Không
connection_not_linked 403 Không
integration_paused 403 Không
workspace_integrations_paused 403 Không
integration_authorization_lost 403 Không
workspace_suspended 403 Không
forbidden 403 Không
invalid_input 422 Không
rate_limited 429 Có
internal 500 Có
read_only 403 Không
idempotency_key_required 428 Không
idempotency_conflict 409 Không
idempotency_processing 409 Có
conflict 409 Không
precondition_failed 422 Không
revision_required 428 Không
revision_conflict 412 Không
not_found 404 Không

Về danh sách thao tác