واجهة REST
دليل المطورين وتوثيق واجهة برمجة التطبيقات (API)
اربط أنظمتك وتطبيقاتك الخارجية مع TGCPilot عبر واجهة RESTful العامة.
المصادقة والتفويض #
الرابط الأساسي: https://tgcpilot.com/api/v1
يجب مصادقة جميع الطلبات المرسلة إلى واجهة TGCPilot العامة باستخدام مفتاح API الخاص بمساحة العمل عبر ترويسة Authorization كرمز Bearer.
Authorization: Bearer tgcp_live_EXAMPLE_do-not-use
بروتوكول النقل وأمان الاتصال (TLS)
تتطلب جميع الاتصالات البرمجية استخدام بروتوكول HTTPS/TLS الآمن. تُرفض الاتصالات غير المشفرة برمز الحالة 403 tls_required في جميع البيئات غير المحلية.
قاعدة أمنية أساسية: الاستخدام من الخادم فقط
الصلاحيات والنطاقات #
يُمنح كل مفتاح API مجموعة محددة من الصلاحيات الدقيقة. يطبّق TGCPilot مبدأ الحد الأدنى من الصلاحيات: تبدأ بيانات الاعتماد الجديدة دون أي صلاحيات افتراضياً، ويجب تعيين كل صلاحية مطلوبة صراحة عند إنشاء المفتاح أو تعديله.
| الصلاحية | الوصف |
|---|---|
messages:send |
إرسال رسائل واتساب نيابةً عن مساحة العمل هذه. |
messages:read |
قراءة الرسائل المرسلة والمستلمة. |
conversations:read |
قراءة المحادثات وحالتها. |
conversations:assign |
إسناد المحادثات أو إلغاء إسنادها. |
conversations:close |
إغلاق المحادثات. |
notes:read |
قراءة الملاحظات الداخلية المرفقة بالمحادثات. |
contacts:read |
قراءة جهات الاتصال وخصائصها. |
contacts:write |
إنشاء وتحديث جهات الاتصال. |
contacts:delete |
حذف جهات الاتصال. |
contacts:import |
استيراد جهات اتصال بشكل جماعي. |
templates:read |
قراءة قوالب الرسائل المعتمدة. |
campaigns:trigger |
إطلاق الحملات. |
webhooks:manage |
إدارة نقاط اتصال الويب هوك. |
commerce:read |
قراءة المتاجر المرتبطة وطلباتها. |
حدود الاستخدام والطلبات #
تتحدد حدود الطلبات عبر ثلاثة مستويات: (1) حد مخصص لمفتاح الـ API إن وُجد؛ (2) حد خطة اشتراك مساحة العمل؛ أو (3) الحد الافتراضي للنظام وهو 600 طلب في الدقيقة.
ترويسات حدود الاستخدام
تتضمن جميع الاستجابات — بما فيها الأخطاء ورفض تجاوز الحد — الترويسات القياسية التالية:
X-RateLimit-Limit— إجمالي عدد الطلبات المسموح بها في نافذة دقيقة واحدة متحركة.X-RateLimit-Remaining— عدد الطلبات المتبقية في النافذة الزمنية الحالية.X-RateLimit-Reset— طابع زمني بصيغة Unix epoch يوضح متى تتم إعادة تعيين النافذة الحالية.
التعامل مع تجاوز الحد 429 Rate Limited
عندما يتجاوز المفتاح حد الطلبات، تستجيب الواجهة البرمجية برمز الحالة 429 rate_limited وتتضمن الترويسة Retry-After: {seconds}. يجب على العميل التوقف مؤقتاً وإعادة المحاولة بعد انقضاء المدة المحددة باستخدام التراجع الأسي مع التشتيت العشوائي (Jitter).
تقسيم النتائج والصفحات #
تعتمد نقاط النهاية الخاصة بالقوائم على تقسيم النتائج بمؤشر (Cursor-based) لضمان الأداء العالي وثبات النتائج.
معاملات الاستعلام (Query Parameters)
limit— عدد السجلات المطلوب استرجاعها (الافتراضي: 25، الحد الأقصى: 100).cursor— رمز نصي مشفر مأخوذ من قيمة meta.next_cursor في الصفحة السابقة.
البيانات الوصفية لغلاف الاستجابة
meta.has_more— قيمة منطقية توضح ما إذا كانت هناك صفحات إضافية.meta.next_cursor— مؤشر الصفحة التالية، أو null إذا كانت هذه الصفحة الأخيرة.meta.total— إجمالي عدد السجلات (متاح لجهات الاتصال والقوالب فقط).
ملاحظة
منع تكرار الطلبات #
لإعادة إرسال طلبات التعديل (POST وPATCH وDELETE) بأمان دون إنشاء سجلات مكررة بالخطأ، أرسل مفتاحاً فريداً يولده العميل في ترويسة Idempotency-Key (حتى 255 محرفاً، مثل UUID v4).
إعادة الطلب المطابق
إرسال نفس مفتاح عدم التكرار مع محتوى طلب مطابق خلال 24 ساعة يعيد الاستجابة الأصلية المخزنة مؤقتاً مع الترويسة Idempotency-Replayed: true.
تعارض بصمة الطلب
إعادة استخدام مفتاح موجود مع محتوى طلب مختلف يعيد رمز الخطأ 409 idempotency_key_reuse مع اسم المفتاح في details.idempotency_key.
التنفيذ المتزامن
إرسال طلب ثانٍ باستخدام مفتاح لا يزال قيد المعالجة يعيد 409 idempotency_request_in_progress مع الترويسة Retry-After: 1.
تغيير الصلاحيات
تسري تغييرات الصلاحيات على الطلبات الجديدة فقط؛ أما العمليات المقبولة مسبقاً فتكتمل وفق التفويض الذي بدأت به.
معالجة الأخطاء والرموز #
تتبع جميع أخطاء واجهة الـ API هيكل JSON موحداً يتضمن رمز الخطأ البرمجي code، ورسالة مقروءة ومترجمة message، وتفاصيل سياقية اختيارية details.
{
"error": {
"code": "validation_failed",
"message": "The request could not be validated.",
"details": {
"fields": {
"to": ["The destination phone number is invalid."]
}
}
}
}
| رمز الحالة | رمز الخطأ | الرسالة الافتراضية |
|---|---|---|
| 400 | malformed_request |
محتوى الطلب ليس بتنسيق JSON صالح. |
| 401 | unauthenticated |
فشلت عملية المصادقة. يرجى تقديم مفتاح API صالح عبر ترويسة التفويض. |
| 403 | tls_required |
الاتصال الآمن عبر TLS مطلوب. لا يُسمح بالاتصالات غير المشفرة. |
| 403 | scope_missing |
المفتاح المستخدم لا يملك الصلاحيات (Scope) اللازمة لتنفيذ هذه العملية. |
| 402 | subscription_gated |
باقتك الحالية لا تدعم هذه العملية. |
| 404 | not_found |
السجل المطلوب غير موجود في مساحة العمل هذه. |
| 409 | idempotency_key_reuse |
تم استخدام مفتاح التكرار هذا مسبقاً مع بيانات طلب مختلفة. |
| 409 | idempotency_request_in_progress |
هناك طلب قيد المعالجة حالياً بمفتاح التكرار هذا. يرجى المحاولة بعد قليل. |
| 409 | contact_already_exists |
جهة اتصال برقم الهاتف هذا مسجلة مسبقاً في مساحة العمل. |
| 409 | campaign_not_launchable |
لا يمكن إطلاق الحملة في حالتها الحالية. |
| 413 | payload_too_large |
حجم بيانات الطلب يتجاوز الحد الأقصى المسموح به. |
| 422 | validation_failed |
تعذر التحقق من صحة بيانات الطلب. |
| 422 | template_not_available |
القالب المطلوب غير معروف أو غير معتمد أو غير متاح باللغة المطلوبة. |
| 422 | service_window_closed |
نافذة الرد المباشر (24 ساعة) مغلقة. يرجى استخدام قالب رسالة معتمد. |
| 422 | contact_opted_out |
المستلم قام بإلغاء الاشتراك في استلام الرسائل. |
| 422 | not_connected |
مساحة العمل لا تملك اتصال واتساب نشط. |
| 422 | channel_required |
اختر قناة مراسلة. |
| 422 | channel_account_required |
اختر حساب قناة. |
| 422 | channel_account_mismatch |
حساب القناة المحدد لا يطابق المحادثة أو المستلِم. |
| 422 | channel_account_unavailable |
حساب القناة هذا غير متاح. |
| 422 | channel_account_revoked |
أُلغي الوصول إلى حساب القناة هذا. |
| 422 | channel_account_removed |
أُزيل حساب القناة هذا. |
| 422 | contact_archived |
جهة الاتصال هذه مؤرشفة. |
| 422 | template_unusable |
هذا القالب غير متاح للإرسال. |
| 422 | template_paused |
هذا القالب موقوف مؤقتًا. |
| 422 | unsupported_capability:template |
هذه القناة لا تدعم القوالب. |
| 422 | unsupported_capability:text |
هذه القناة لا تدعم الرسائل النصية. |
| 429 | rate_limited |
تم تجاوز الحد المسموح به من الطلبات. يرجى تخفيف معدل الطلبات والمحاولة لاحقاً. |
| 503 | temporarily_unavailable |
إحدى الخدمات اللازمة لمعالجة الطلب غير متوفرة مؤقتاً. يرجى المحاولة لاحقاً. |
دليل البدء السريع: إرسال رسالة #
يوضح هذا الدليل العملي الكامل دورة حياة المراسلة البرمجية: إنشاء المفتاح، الاستعلام عن القوالب المعتمدة، إرسال رسالة قالب مخصصة مع ضمان عدم التكرار، ومتابعة حالة التسليم.
الخطوة 1: توليد بيانات اعتماد مخصصة
أنشئ مفتاح API بصلاحيتي templates:read وmessages:send. احفظ الرمز السري الظاهر tgcp_live_EXAMPLE_do-not-use في مكان آمن.
الخطوة 2: استعراض القوالب المعتمدة
استعلم عن قوالب رسائل واتساب المعتمدة لمعرفة مواضع المتغيرات المطلوبة:
curl "https://tgcpilot.com/api/v1/templates" \ -H "Authorization: Bearer tgcp_live_EXAMPLE_do-not-use"
{
"data": [
{
"name": "order_shipped",
"category": "UTILITY",
"languages": [
{
"language": "ar",
"status": "approved",
"variables": [
{ "position": 1, "example": "1042" },
{ "position": 2, "example": "Tomorrow" }
]
}
]
}
],
"meta": {
"has_more": false,
"next_cursor": null,
"total": 1
}
}
الخطوة 3: إرسال رسالة القالب
أرسل بيانات الرسالة مع معاملات المتغيرات الدقيقة وترويسة Idempotency-Key:
curl -X POST "https://tgcpilot.com/api/v1/messages" \
-H "Authorization: Bearer tgcp_live_EXAMPLE_do-not-use" \
-H "Idempotency-Key: e8c44ad0-2e47-4971-9c60-e8320490b6a2" \
-H "Content-Type: application/json" \
-d '{
"to": "+96551234567",
"template": {
"name": "order_shipped",
"language": "ar",
"variables": { "1": "1042", "2": "Tomorrow" }
}
}'
{
"data": {
"id": "msg_18412",
"conversation_id": "cnv_902",
"direction": "outbound",
"status": "queued",
"failure_reason": null,
"sent_via": { "type": "api_key", "id": "key_31", "name": "Integration key" },
"created_at": "2026-08-17T09:14:22Z"
}
}
الخطوة 4: الاستعلام عن حالة التسليم
استعلم عن معرّف الرسالة للتحقق من حالة التسليم المحدثة:
curl "https://tgcpilot.com/api/v1/messages/msg_18412" \ -H "Authorization: Bearer tgcp_live_EXAMPLE_do-not-use"
{
"data": {
"id": "msg_18412",
"conversation_id": "cnv_902",
"direction": "outbound",
"status": "delivered",
"failure_reason": null,
"sent_via": { "type": "api_key", "id": "key_31", "name": "Integration key" },
"created_at": "2026-08-17T09:14:22Z"
}
}
مرجع نقاط النهاية البرمجية #
إرسال رسالة واتساب باستخدام قالب أو نص حر. #
POST /api/v1/messages
أضف نصًا أو قالبًا معتمدًا إلى قائمة الانتظار لمحادثة قائمة أو لحساب قناة محدد أو افتراضي. يتطلب النص في واتساب نافذة خدمة مفتوحة.
الصلاحية: messages:send غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"conversation_id": {
"type": "integer",
"minimum": 1
},
"channel": {
"type": "string"
},
"channel_account_id": {
"type": "string",
"description": "Public channel account ULID."
},
"to": {
"type": "string",
"description": "Recipient address on the selected channel."
},
"type": {
"type": "string",
"enum": [
"text",
"template"
]
},
"template": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"language": {
"type": "string"
},
"variables": {
"type": "object",
"description": "Values keyed by variable position. A number is accepted and sent as its string form.",
"additionalProperties": {
"type": [
"string",
"number"
]
}
}
},
"required": [
"name",
"language"
]
},
"text": {
"type": "string"
}
},
"oneOf": [
{
"required": [
"conversation_id"
],
"not": {
"required": [
"to"
]
}
},
{
"required": [
"channel",
"to"
],
"not": {
"required": [
"conversation_id"
]
}
}
],
"required": [
"type"
]
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"direction": {
"type": "string",
"enum": [
"inbound",
"outbound"
]
},
"channel": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"account_id": {
"type": "string"
},
"account_label": {
"type": "string"
},
"account_removed": {
"type": "boolean"
}
},
"required": [
"type",
"account_id",
"account_label",
"account_removed"
]
},
"provider_message_id": {
"type": [
"string",
"null"
]
},
"quoted_message_id": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
},
"content": {
"type": "object"
},
"source": {
"type": "string"
},
"ingestion_mode": {
"type": "string",
"enum": [
"live",
"history",
"echo"
]
},
"status": {
"type": "string",
"enum": [
"received",
"queued",
"sending",
"sent",
"delivered",
"read",
"failed",
"delivery_unconfirmed"
]
},
"status_reason": {
"type": [
"string",
"null"
]
},
"provider_error_class": {
"type": [
"string",
"null"
]
},
"failure_reason": {
"type": [
"string",
"null"
]
},
"sent_via": {
"type": [
"object",
"null"
],
"properties": {
"type": {
"type": "string",
"enum": [
"api_key",
"user",
"system"
]
},
"id": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
}
}
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"id",
"conversation_id",
"direction",
"status",
"created_at"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
not_found (404)
channel_required (422)
channel_account_required (422)
channel_account_mismatch (422)
channel_account_unavailable (422)
channel_account_revoked (422)
channel_account_removed (422)
contact_archived (422)
template_unusable (422)
template_paused (422)
unsupported_capability:template (422)
unsupported_capability:text (422)
service_window_closed (422)
contact_opted_out (422)
subscription_gated (402)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
استرجاع رسالة باستخدام المعرّف. #
GET /api/v1/messages/{id}
جلب حالة التسليم وتفاصيل رسالة صادرة أو واردة في مساحة العمل هذه.
الصلاحية: messages:read
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"direction": {
"type": "string",
"enum": [
"inbound",
"outbound"
]
},
"channel": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"account_id": {
"type": "string"
},
"account_label": {
"type": "string"
},
"account_removed": {
"type": "boolean"
}
},
"required": [
"type",
"account_id",
"account_label",
"account_removed"
]
},
"provider_message_id": {
"type": [
"string",
"null"
]
},
"quoted_message_id": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
},
"content": {
"type": "object"
},
"source": {
"type": "string"
},
"ingestion_mode": {
"type": "string",
"enum": [
"live",
"history",
"echo"
]
},
"status": {
"type": "string",
"enum": [
"received",
"queued",
"sending",
"sent",
"delivered",
"read",
"failed",
"delivery_unconfirmed"
]
},
"status_reason": {
"type": [
"string",
"null"
]
},
"provider_error_class": {
"type": [
"string",
"null"
]
},
"failure_reason": {
"type": [
"string",
"null"
]
},
"sent_via": {
"type": [
"object",
"null"
],
"properties": {
"type": {
"type": "string",
"enum": [
"api_key",
"user",
"system"
]
},
"id": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
}
}
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"id",
"conversation_id",
"direction",
"status",
"created_at"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
عرض قائمة جهات الاتصال مع التصفية وتقسيم الصفحات. #
GET /api/v1/contacts
استرجاع قائمة جهات الاتصال بحسب البحث والوسوم والقطاعات ورمز الدولة country_code وتواريخ الإنشاء. يعيد phone جهة الاتصال الوحيدة التي تملك هذا الرقم كرقم أساسي أو إضافي (بصيغة E.164 أو محلية مع دولة مساحة العمل الافتراضية) ولا يمكن دمجه مع عوامل تصفية أخرى. يعيد updated_after (بصيغة ISO-8601، وبتوقيت UTC عند غياب الإزاحة، شاملًا للحد) جهات الاتصال التي تغيّرت منذ ذلك الوقت، بما فيها ما غيّرته عمليات الاستيراد ورفع الجمهور والوسم الجماعي؛ ويبقى الترتيب من الأحدث إنشاءً.
الصلاحية: contacts:read مقسم بصفحات العدد الإجمالي
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"phone": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"email": {
"type": [
"string",
"null"
]
},
"company": {
"type": [
"string",
"null"
]
},
"locale": {
"type": [
"string",
"null"
]
},
"country_code": {
"type": [
"string",
"null"
],
"description": "ISO 3166-1 alpha-2 contact country."
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"attributes": {
"type": "object"
},
"consent_status": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id"
]
}
},
"meta": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": [
"string",
"null"
]
},
"total": {
"type": "integer"
}
},
"required": [
"has_more"
]
}
},
"required": [
"data",
"meta"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
إنشاء جهة اتصال جديدة. #
POST /api/v1/contacts
إنشاء جهة اتصال برقم الهاتف ورمز الدولة الاختياري country_code والاسم والبريد والشركة واللغة والوسوم والخصائص. تُستخدم الدولة لتفسير الأرقام المحلية.
الصلاحية: contacts:write غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"phone": {
"type": "string"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"company": {
"type": "string"
},
"locale": {
"type": "string",
"enum": [
"ar",
"en"
]
},
"country_code": {
"type": [
"string",
"null"
],
"description": "ISO 3166-1 alpha-2 country; used to parse local phone numbers."
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"attributes": {
"type": "object"
}
},
"required": [
"phone"
]
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"phone": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"email": {
"type": [
"string",
"null"
]
},
"company": {
"type": [
"string",
"null"
]
},
"locale": {
"type": [
"string",
"null"
]
},
"country_code": {
"type": [
"string",
"null"
],
"description": "ISO 3166-1 alpha-2 contact country."
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"attributes": {
"type": "object"
},
"consent_status": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
contact_already_exists (409)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
استرجاع جهة اتصال باستخدام المعرّف. #
GET /api/v1/contacts/{id}
جلب تفاصيل ووسوم وخصائص وحالة موافقة جهة اتصال معينة.
الصلاحية: contacts:read
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"phone": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"email": {
"type": [
"string",
"null"
]
},
"company": {
"type": [
"string",
"null"
]
},
"locale": {
"type": [
"string",
"null"
]
},
"country_code": {
"type": [
"string",
"null"
],
"description": "ISO 3166-1 alpha-2 contact country."
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"attributes": {
"type": "object"
},
"consent_status": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
تحديث جهة اتصال موجودة. #
PATCH /api/v1/contacts/{id}
تطبيق تعديلات جزئية على جهة اتصال بما في ذلك رمز الدولة country_code أو مسحه بالقيمة null، والاسم والبريد والشركة واللغة والوسوم والخصائص.
الصلاحية: contacts:write غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"company": {
"type": "string"
},
"locale": {
"type": "string",
"enum": [
"ar",
"en"
]
},
"country_code": {
"type": [
"string",
"null"
],
"description": "ISO 3166-1 alpha-2 country; null clears the value."
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"attributes": {
"type": "object"
}
}
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"phone": {
"type": [
"string",
"null"
]
},
"name": {
"type": [
"string",
"null"
]
},
"email": {
"type": [
"string",
"null"
]
},
"company": {
"type": [
"string",
"null"
]
},
"locale": {
"type": [
"string",
"null"
]
},
"country_code": {
"type": [
"string",
"null"
],
"description": "ISO 3166-1 alpha-2 contact country."
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"attributes": {
"type": "object"
},
"consent_status": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
حذف (أرشفة) جهة اتصال. #
DELETE /api/v1/contacts/{id}
أرشفة جهة اتصال في مساحة العمل مع الحفاظ على سجل المحادثات وحالة الموافقة.
الصلاحية: contacts:delete غير قابل للتكرار
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
عرض الخصائص المخصصة لجهات الاتصال. #
GET /api/v1/contact-attributes
يعيد المفتاح والتسمية والنوع، وخيارات الخصائص ذات الاختيار الواحد، لكل خاصية مخصصة معرّفة في مساحة العمل.
الصلاحية: contacts:read
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"label": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"text",
"number",
"date",
"boolean",
"single_choice"
]
},
"options": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
},
"required": [
"key",
"label",
"type",
"options"
]
}
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
scope_missing (403)
unauthenticated (401)
rate_limited (429)
بدء استيراد جهات اتصال جماعي. #
POST /api/v1/contact-imports
رفع ملف CSV مع خريطة الأعمدة لاستيراد جهات الاتصال بشكل غير متزامن.
الصلاحية: contacts:import غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"file": {
"type": "string",
"format": "binary"
},
"mapping": {
"type": "object"
},
"duplicate_strategy": {
"type": "string",
"enum": [
"skip",
"update"
]
}
},
"required": [
"file",
"mapping",
"duplicate_strategy"
]
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"status": {
"type": "string"
},
"total_rows": {
"type": "integer"
},
"processed_rows": {
"type": "integer"
},
"created_count": {
"type": "integer"
},
"updated_count": {
"type": "integer"
},
"rejected_count": {
"type": "integer"
},
"started_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"completed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"status"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
جلب حالة وتقدم عملية الاستيراد. #
GET /api/v1/contact-imports/{id}
استرجاع التقدم الحالي وعدد الصفوف وحالة اكتمال عملية استيراد جهات الاتصال.
الصلاحية: contacts:import
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"status": {
"type": "string"
},
"total_rows": {
"type": "integer"
},
"processed_rows": {
"type": "integer"
},
"created_count": {
"type": "integer"
},
"updated_count": {
"type": "integer"
},
"rejected_count": {
"type": "integer"
},
"started_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"completed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"status"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
عرض الصفوف المرفوضة لعملية استيراد. #
GET /api/v1/contact-imports/{id}/rejections
استرجاع قائمة مقسمة للصفوف المرفوضة والمتخطاة لعملية استيراد مع أسباب الرفض ورموز الأخطاء.
الصلاحية: contacts:import مقسم بصفحات
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"row_number": {
"type": "integer"
},
"reason": {
"type": "string"
},
"reason_code": {
"type": [
"string",
"null"
]
}
},
"required": [
"row_number",
"reason"
]
}
},
"meta": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": [
"string",
"null"
]
}
},
"required": [
"has_more"
]
}
},
"required": [
"data",
"meta"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
عرض قائمة المحادثات مع التصفية وتقسيم الصفحات. #
GET /api/v1/conversations
استرجاع قائمة مقسمة بصفحات للمحادثات في مساحة العمل مرتبة حسب أحدث نشاط مع خيارات تصفية الحالة والمسؤول وجهة الاتصال والتاريخ. صفِّ النتائج حسب نوع القناة بالمعامل channel، أو حسب المعرّف العام للحساب بالمعامل channel_account_id.
الصلاحية: conversations:read مقسم بصفحات
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"contact_id": {
"type": [
"string",
"null"
]
},
"channel": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"account_id": {
"type": "string"
},
"account_label": {
"type": "string"
},
"account_removed": {
"type": "boolean"
}
},
"required": [
"type",
"account_id",
"account_label",
"account_removed"
]
},
"participant": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"display_name": {
"type": [
"string",
"null"
]
},
"external_id": {
"type": "string"
},
"external_id_label": {
"type": "string"
}
},
"required": [
"id",
"display_name",
"external_id",
"external_id_label"
]
},
"needs_contact_link": {
"type": "boolean"
},
"state": {
"type": "string"
},
"assignee_id": {
"type": [
"string",
"null"
]
},
"department_id": {
"type": [
"string",
"null"
]
},
"last_message_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"last_inbound_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"snoozed_until": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"closed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"internal_notes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"body": {
"type": "string"
},
"author_id": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"body",
"author_id"
]
}
}
},
"required": [
"id",
"state"
]
}
},
"meta": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": [
"string",
"null"
]
}
},
"required": [
"has_more"
]
}
},
"required": [
"data",
"meta"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
استرجاع محادثة باستخدام المعرّف. #
GET /api/v1/conversations/{id}
جلب تفاصيل وحالة محادثة معينة، بما في ذلك الملاحظات الداخلية عند امتلاك المفتاح لصلاحية notes:read. تحدد الاستجابة حساب القناة والمشارك وتوضح ما إذا كانت المحادثة بحاجة إلى ربط بجهة اتصال.
الصلاحية: conversations:read
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"contact_id": {
"type": [
"string",
"null"
]
},
"channel": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"account_id": {
"type": "string"
},
"account_label": {
"type": "string"
},
"account_removed": {
"type": "boolean"
}
},
"required": [
"type",
"account_id",
"account_label",
"account_removed"
]
},
"participant": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"display_name": {
"type": [
"string",
"null"
]
},
"external_id": {
"type": "string"
},
"external_id_label": {
"type": "string"
}
},
"required": [
"id",
"display_name",
"external_id",
"external_id_label"
]
},
"needs_contact_link": {
"type": "boolean"
},
"state": {
"type": "string"
},
"assignee_id": {
"type": [
"string",
"null"
]
},
"department_id": {
"type": [
"string",
"null"
]
},
"last_message_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"last_inbound_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"snoozed_until": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"closed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"internal_notes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"body": {
"type": "string"
},
"author_id": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"body",
"author_id"
]
}
}
},
"required": [
"id",
"state"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
عرض رسائل محادثة معينة. #
GET /api/v1/conversations/{id}/messages
استرجاع قائمة رسائل المحادثة مرتبة زمنياً ومقسمة بصفحات مع حالات التسليم ومراجع الوسائط. تتضمن كل رسالة محتواها الموحّد وحساب القناة ومعرّف الرسالة لدى المزود.
الصلاحية: conversations:read مقسم بصفحات
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"direction": {
"type": "string"
},
"channel": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"account_id": {
"type": "string"
},
"account_label": {
"type": "string"
},
"account_removed": {
"type": "boolean"
}
},
"required": [
"type",
"account_id",
"account_label",
"account_removed"
]
},
"provider_message_id": {
"type": [
"string",
"null"
]
},
"quoted_message_id": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
},
"content": {
"type": "object"
},
"source": {
"type": "string"
},
"ingestion_mode": {
"type": "string",
"enum": [
"live",
"history",
"echo"
]
},
"status": {
"type": "string",
"enum": [
"received",
"queued",
"sending",
"sent",
"delivered",
"read",
"failed",
"delivery_unconfirmed"
]
},
"status_reason": {
"type": [
"string",
"null"
]
},
"provider_error_class": {
"type": [
"string",
"null"
]
},
"body_text": {
"type": [
"string",
"null"
]
},
"sent_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"delivered_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"read_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"failed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"media": {
"type": [
"object",
"null"
],
"properties": {
"id": {
"type": "string"
},
"media_kind": {
"type": "string"
},
"mime_type": {
"type": [
"string",
"null"
]
},
"caption": {
"type": [
"string",
"null"
]
}
},
"required": [
"id",
"media_kind"
]
}
},
"required": [
"id",
"direction",
"status"
]
}
},
"meta": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": [
"string",
"null"
]
}
},
"required": [
"has_more"
]
}
},
"required": [
"data",
"meta"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
إسناد محادثة إلى عضو. #
POST /api/v1/conversations/{id}/assign
يسند المحادثة إلى عضو نشط في مساحة العمل هذه باستخدام member_id من GET /members. إسنادها إلى العضو المالك لها أصلًا لا يغيّر شيئًا. لا يمكن إسناد محادثة مغلقة. يُسجَّل التغيير باسم مفتاح API.
الصلاحية: conversations:assign غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"member_id": {
"type": "string",
"description": "A member id from GET /members."
}
},
"required": [
"member_id"
]
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"contact_id": {
"type": [
"string",
"null"
]
},
"channel": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"account_id": {
"type": "string"
},
"account_label": {
"type": "string"
},
"account_removed": {
"type": "boolean"
}
},
"required": [
"type",
"account_id",
"account_label",
"account_removed"
]
},
"participant": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"display_name": {
"type": [
"string",
"null"
]
},
"external_id": {
"type": "string"
},
"external_id_label": {
"type": "string"
}
},
"required": [
"id",
"display_name",
"external_id",
"external_id_label"
]
},
"needs_contact_link": {
"type": "boolean"
},
"state": {
"type": "string"
},
"assignee_id": {
"type": [
"string",
"null"
]
},
"department_id": {
"type": [
"string",
"null"
]
},
"last_message_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"last_inbound_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"snoozed_until": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"closed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"internal_notes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"body": {
"type": "string"
},
"author_id": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"body",
"author_id"
]
}
}
},
"required": [
"id",
"state"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
إغلاق محادثة. #
POST /api/v1/conversations/{id}/close
يغلق المحادثة. إغلاق محادثة مغلقة أصلًا لا يغيّر شيئًا. يُسجَّل التغيير باسم مفتاح API.
الصلاحية: conversations:close غير قابل للتكرار
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"contact_id": {
"type": [
"string",
"null"
]
},
"channel": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"account_id": {
"type": "string"
},
"account_label": {
"type": "string"
},
"account_removed": {
"type": "boolean"
}
},
"required": [
"type",
"account_id",
"account_label",
"account_removed"
]
},
"participant": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"display_name": {
"type": [
"string",
"null"
]
},
"external_id": {
"type": "string"
},
"external_id_label": {
"type": "string"
}
},
"required": [
"id",
"display_name",
"external_id",
"external_id_label"
]
},
"needs_contact_link": {
"type": "boolean"
},
"state": {
"type": "string"
},
"assignee_id": {
"type": [
"string",
"null"
]
},
"department_id": {
"type": [
"string",
"null"
]
},
"last_message_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"last_inbound_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"snoozed_until": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"closed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"updated_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"internal_notes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"body": {
"type": "string"
},
"author_id": {
"type": "string"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"body",
"author_id"
]
}
}
},
"required": [
"id",
"state"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
عرض الأعضاء الذين يمكن إسناد المحادثات إليهم. #
GET /api/v1/members
يعيد المعرّف والاسم لكل عضو نشط في مساحة العمل هذه يمكن إسناد محادثة إليه. لا يُعرض أي بريد إلكتروني أو رقم هاتف أو دور.
الصلاحية: conversations:assign مقسم بصفحات
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
]
}
},
"meta": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": [
"string",
"null"
]
}
}
}
},
"required": [
"data",
"meta"
]
}
رموز الأخطاء المحتملة:
scope_missing (403)
unauthenticated (401)
rate_limited (429)
عرض قوالب الرسائل المتاحة. #
GET /api/v1/templates
استرجاع قائمة مقسمة بصفحات لقوالب واتساب مع حالة اعتماد كل لغة والفئات ومتغيرات القالب. يطابق name اسم القالب تمامًا؛ ويُبقي language (ar أو en أو رمزًا مثل en_US) وstatus (approved وpending وrejected وpaused وdisabled وfailed) القوالب التي لها نسخة لغوية تطابق الاثنين معًا.
الصلاحية: templates:read مقسم بصفحات العدد الإجمالي
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"category": {
"type": "string"
},
"languages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"language": {
"type": "string"
},
"status": {
"type": "string"
},
"variables": {
"type": "array",
"items": {
"type": "object",
"properties": {
"position": {
"type": "integer"
},
"example": {
"type": "string"
}
},
"required": [
"position",
"example"
]
}
}
},
"required": [
"language",
"status",
"variables"
]
}
}
},
"required": [
"name",
"category",
"languages"
]
}
},
"meta": {
"type": "object",
"properties": {
"has_more": {
"type": "boolean"
},
"next_cursor": {
"type": [
"string",
"null"
]
},
"total": {
"type": "integer"
}
},
"required": [
"has_more",
"total"
]
}
},
"required": [
"data",
"meta"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
بدء إطلاق حملة جاهزة. #
POST /api/v1/campaigns/{id}/trigger
إطلاق حملة جماعية مجهزة مسبقاً بشكل غير متزامن واستلام معرف تتبع التنفيذ.
الصلاحية: campaigns:trigger غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"audience": {
"type": "string"
}
},
"required": [
"audience"
]
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"state": {
"type": "string"
},
"counts": {
"type": "object",
"properties": {
"queued": {
"type": "integer"
},
"sent": {
"type": "integer"
},
"delivered": {
"type": "integer"
},
"read": {
"type": "integer"
},
"failed": {
"type": "integer"
}
},
"required": [
"queued",
"sent",
"delivered",
"read",
"failed"
]
}
},
"required": [
"id",
"state",
"counts"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
campaign_not_launchable (409)
subscription_gated (402)
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
استرجاع حالة الحملة ومقاييس التسليم. #
GET /api/v1/campaigns/{id}
جلب الحالة الحالية وإحصائيات التسليم الفورية (في الانتظار، مرسلة، مستلمة، مقروءة، فاشلة) للحملة.
الصلاحية: campaigns:trigger
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"state": {
"type": "string"
},
"counts": {
"type": "object",
"properties": {
"queued": {
"type": "integer"
},
"sent": {
"type": "integer"
},
"delivered": {
"type": "integer"
},
"read": {
"type": "integer"
},
"failed": {
"type": "integer"
}
},
"required": [
"queued",
"sent",
"delivered",
"read",
"failed"
]
}
},
"required": [
"id",
"state",
"counts"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
عرض قائمة نقاط اتصال الويب هوك. #
GET /api/v1/webhook-endpoints
استرجاع جميع وجهات الويب هوك المسجلة لمساحة العمل هذه.
الصلاحية: webhooks:manage
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"event_types": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string"
},
"is_paused": {
"type": "boolean"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"name",
"url",
"event_types",
"status",
"is_paused"
]
}
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
scope_missing (403)
unauthenticated (401)
rate_limited (429)
إنشاء نقطة اتصال ويب هوك جديدة. #
POST /api/v1/webhook-endpoints
تسجيل رابط وجهة HTTP وأنواع الأحداث المشترك بها. يتم إرجاع سر التوقيع مرة واحدة فقط في هذه الاستجابة.
الصلاحية: webhooks:manage غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"event_types": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"url",
"event_types"
]
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"event_types": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string"
},
"is_paused": {
"type": "boolean"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"signing_secret": {
"type": "string"
}
},
"required": [
"id",
"name",
"url",
"event_types",
"status",
"is_paused",
"signing_secret"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
تحديث نقطة اتصال ويب هوك. #
PATCH /api/v1/webhook-endpoints/{id}
تعديل رابط الوجهة، الاسم، الأحداث المشترك بها، أو حالة تفعيل نقطة اتصال الويب هوك.
الصلاحية: webhooks:manage غير قابل للتكرار
مخطط الطلب (Request Schema)
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"event_types": {
"type": "array",
"items": {
"type": "string"
}
},
"is_paused": {
"type": "boolean"
}
}
}
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"event_types": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string"
},
"is_paused": {
"type": "boolean"
},
"created_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"name",
"url",
"event_types",
"status",
"is_paused"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
payload_too_large (413)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
حذف نقطة اتصال ويب هوك. #
DELETE /api/v1/webhook-endpoints/{id}
إزالة نقطة اتصال الويب هوك نهائياً من مساحة العمل هذه.
الصلاحية: webhooks:manage غير قابل للتكرار
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
idempotency_key_reuse (409)
idempotency_request_in_progress (409)
عرض المفتاح المستخدم في الطلب. #
GET /api/v1/me
يعيد مساحة العمل ومفتاح الواجهة البرمجية، وإن كان المفتاح تابعًا لاتصال تكامل فيعيد هذا الاتصال أيضًا. يمكن لأي مفتاح موثّق استدعاؤه ولا يتطلب نطاقًا.
عام
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"workspace": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"locale": {
"type": "string"
},
"timezone": {
"type": "string"
}
},
"required": [
"id",
"name",
"locale",
"timezone"
]
},
"api_key": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"last_four": {
"type": [
"string",
"null"
]
},
"scopes": {
"type": "array",
"items": {
"type": "string"
}
},
"expires_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"name",
"scopes"
]
},
"connection": {
"type": [
"object",
"null"
],
"properties": {
"id": {
"type": "string"
},
"provider": {
"type": "string"
},
"display_name": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"connected"
]
}
}
},
"api_version": {
"type": "string"
}
},
"required": [
"workspace",
"api_key",
"connection",
"api_version"
]
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
unauthenticated (401)
rate_limited (429)
temporarily_unavailable (503)
عرض المتاجر المرتبطة. #
GET /api/v1/commerce/stores
يعيد كل متجر مرتبط بمساحة العمل هذه، بما في ذلك المتجر المفصول الذي تُحفظ بياناته حتى تاريخ إزالتها. يبيّن كل متجر حالة الاستيراد وآخر مزامنة وما إذا كانت بياناته قديمة.
الصلاحية: commerce:read
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": [
"string",
"null"
]
},
"provider": {
"type": "string"
},
"url": {
"type": [
"string",
"null"
]
},
"default_currency": {
"type": [
"string",
"null"
]
},
"timezone": {
"type": [
"string",
"null"
]
},
"country": {
"type": [
"string",
"null"
]
},
"state": {
"type": "string",
"description": "The connection lifecycle state."
},
"import_state": {
"type": "string",
"enum": [
"pending",
"importing",
"complete",
"failed"
]
},
"data_since": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"last_synced_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"stale": {
"type": "boolean"
},
"disconnected_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"data_removal_at": {
"type": [
"string",
"null"
],
"format": "date-time"
}
},
"required": [
"id",
"provider",
"state",
"import_state",
"stale"
]
}
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
scope_missing (403)
unauthenticated (401)
rate_limited (429)
عرض طلبات المتجر مع التصفية وتقسيم الصفحات. #
GET /api/v1/commerce/orders
يعيد الطلبات المستوردة من المتاجر المرتبطة، الأحدث تغيّرًا أولًا. يمكن التصفية حسب المتجر أو حالة الطلب أو الدفع أو التوصيل أو آخر تغيير (updated_since بصيغة ISO-8601 شاملة) أو رقم هاتف المشتري بأي صيغة. رقم الهاتف غير المقروء يعيد صفحة فارغة. عناصر القائمة لا تتضمن بنود الطلب ولا الشحنات؛ اجلب طلبًا واحدًا للحصول عليها. المبالغ دقيقة: وحدات صغرى صحيحة مع العملة والأس. لا تُعاد معرّفات المزوّد أبدًا. الصفحات مرتبة بوقت التغيير، لذا قد يفوتك طلب يتغير أثناء التصفح: استخدم updated_since لمتابعة التغييرات بدل إعادة تصفح الصفحات.
الصلاحية: commerce:read مقسم بصفحات
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"store": {
"type": [
"string",
"null"
],
"description": "Id of the store the order belongs to."
},
"number": {
"type": "string"
},
"currency": {
"type": "string"
},
"totals": {
"type": "object",
"properties": {
"subtotal": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"discount": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"shipping": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"tax": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"total": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"original_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"refunded_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
}
}
},
"presentment_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"presentment_original_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"presentment_refunded_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"status": {
"type": "object",
"description": "Normalized statuses with the store's own wording beside each.",
"properties": {
"order": {
"type": "string",
"enum": [
"open",
"completed",
"cancelled",
"unknown"
]
},
"order_raw": {
"type": [
"string",
"null"
]
},
"payment": {
"type": "string",
"enum": [
"pending",
"authorized",
"paid",
"partially_paid",
"partially_refunded",
"refunded",
"voided",
"failed",
"unknown"
]
},
"payment_raw": {
"type": [
"string",
"null"
]
},
"fulfillment": {
"type": "string",
"enum": [
"unfulfilled",
"partially_fulfilled",
"fulfilled",
"in_transit",
"delivered",
"returned",
"not_provided",
"unknown"
]
},
"fulfillment_raw": {
"type": [
"string",
"null"
]
}
}
},
"payment_method": {
"type": "object",
"properties": {
"category": {
"type": "string"
},
"raw": {
"type": [
"string",
"null"
]
}
}
},
"customer": {
"type": [
"object",
"null"
],
"description": "An erased customer is only its id and erased=true.",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": [
"string",
"null"
]
},
"phone": {
"type": [
"string",
"null"
],
"description": "E.164."
},
"erased": {
"type": "boolean"
},
"contact_id": {
"type": [
"integer",
"null"
],
"description": "Id of the linked contact, usable with GET /contacts/{id}."
},
"link_state": {
"type": "string",
"enum": [
"linked",
"no_match",
"no_phone",
"invalid_phone",
"ambiguous"
]
}
}
},
"order_url": {
"type": [
"string",
"null"
]
},
"test": {
"type": "boolean",
"description": "True for a test order placed in the store (never a real sale)."
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"cancelled_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"closed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"flags": {
"type": "object",
"properties": {
"incomplete": {
"type": "boolean"
},
"items_truncated": {
"type": "boolean"
},
"source_items_incomplete": {
"type": [
"boolean",
"null"
]
},
"needs_reconciliation": {
"type": "boolean"
}
}
}
}
}
},
"meta": {
"$ref": "#/components/schemas/PaginationMeta"
}
},
"required": [
"data",
"meta"
]
}
رموز الأخطاء المحتملة:
validation_failed (422)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
جلب طلب متجر بمعرّفه. #
GET /api/v1/commerce/orders/{id}
يعيد طلبًا واحدًا مع بنوده وشحناته. الطلب غير الموجود أو المحذوف في المتجر أو التابع لمساحة عمل أخرى يعيد 404.
الصلاحية: commerce:read
مخطط الاستجابة (Response Schema)
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"store": {
"type": [
"string",
"null"
],
"description": "Id of the store the order belongs to."
},
"number": {
"type": "string"
},
"currency": {
"type": "string"
},
"totals": {
"type": "object",
"properties": {
"subtotal": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"discount": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"shipping": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"tax": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"total": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"original_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"refunded_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
}
}
},
"presentment_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"presentment_original_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"presentment_refunded_total": {
"oneOf": [
{
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
{
"type": "null"
}
]
},
"status": {
"type": "object",
"description": "Normalized statuses with the store's own wording beside each.",
"properties": {
"order": {
"type": "string",
"enum": [
"open",
"completed",
"cancelled",
"unknown"
]
},
"order_raw": {
"type": [
"string",
"null"
]
},
"payment": {
"type": "string",
"enum": [
"pending",
"authorized",
"paid",
"partially_paid",
"partially_refunded",
"refunded",
"voided",
"failed",
"unknown"
]
},
"payment_raw": {
"type": [
"string",
"null"
]
},
"fulfillment": {
"type": "string",
"enum": [
"unfulfilled",
"partially_fulfilled",
"fulfilled",
"in_transit",
"delivered",
"returned",
"not_provided",
"unknown"
]
},
"fulfillment_raw": {
"type": [
"string",
"null"
]
}
}
},
"payment_method": {
"type": "object",
"properties": {
"category": {
"type": "string"
},
"raw": {
"type": [
"string",
"null"
]
}
}
},
"customer": {
"type": [
"object",
"null"
],
"description": "An erased customer is only its id and erased=true.",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": [
"string",
"null"
]
},
"phone": {
"type": [
"string",
"null"
],
"description": "E.164."
},
"erased": {
"type": "boolean"
},
"contact_id": {
"type": [
"integer",
"null"
],
"description": "Id of the linked contact, usable with GET /contacts/{id}."
},
"link_state": {
"type": "string",
"enum": [
"linked",
"no_match",
"no_phone",
"invalid_phone",
"ambiguous"
]
}
}
},
"order_url": {
"type": [
"string",
"null"
]
},
"test": {
"type": "boolean",
"description": "True for a test order placed in the store (never a real sale)."
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
},
"cancelled_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"closed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"flags": {
"type": "object",
"properties": {
"incomplete": {
"type": "boolean"
},
"items_truncated": {
"type": "boolean"
},
"source_items_incomplete": {
"type": [
"boolean",
"null"
]
},
"needs_reconciliation": {
"type": "boolean"
}
}
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"variant_title": {
"type": [
"string",
"null"
]
},
"sku": {
"type": [
"string",
"null"
]
},
"quantity": {
"type": "integer"
},
"current_quantity": {
"type": [
"integer",
"null"
]
},
"unit_price": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
},
"line_total": {
"type": "object",
"properties": {
"amount_minor": {
"type": "integer",
"description": "Exact amount in minor units (for KWD, 12345 is 12.345)."
},
"currency": {
"type": "string",
"description": "ISO 4217 code."
},
"exponent": {
"type": "integer",
"description": "Number of minor-unit digits of the currency."
}
},
"required": [
"amount_minor",
"currency",
"exponent"
]
}
}
}
},
"fulfillments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"status_raw": {
"type": [
"string",
"null"
]
},
"carrier": {
"type": [
"string",
"null"
]
},
"tracking_numbers": {
"type": "array",
"items": {
"type": "string"
}
},
"tracking_urls": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"required": [
"data"
]
}
رموز الأخطاء المحتملة:
not_found (404)
scope_missing (403)
unauthenticated (401)
rate_limited (429)
تحميل مواصفات OpenAPI 3.1 المقروءة آلياً. #
GET /api/v1/openapi.json
جلب ملف مواصفات OpenAPI 3.1 بتنسيق JSON الكامل الذي يصف كافة نقاط الاتصال والمخططات ورموز الأخطاء.
عام
مخطط الاستجابة (Response Schema)
{
"type": "object",
"description": "OpenAPI 3.1 specification document."
}
الأحداث والأتمتة #
تستقبل نقاط اتصال الويب هوك إشعارات الأحداث اللحظية. يحمل كل غلاف id وtype وoccurred_at وapi_version وworkspace وكتلة origin (تتضمن surface وconnection_id وapi_key_id وcorrelation_id) وبيانات data مع مؤشر data.resource. للتحقق من التوقيع وقواعد إعادة المحاولة ونماذج البيانات، راجع مرجع الويب هوك.
| الحدث | صلاحية القراءة للأتمتة | يصدر عند |
|---|---|---|
contact.created |
contacts:read
|
إنشاء جهة اتصال من التطبيق أو الـ API أو عند استلام أول رسالة واردة. |
contact.updated |
contacts:read
|
تغيير بيانات جهة اتصال واحدة؛ وتوضح data.changed_fields الحقول المعدلة. |
message.read |
— | قراءة العميل لرسالة صادرة (إشعار القراءة). |
message.delivered |
— | تسليم رسالة صادرة إلى جهاز المستلم بنجاح. |
message.inbound |
messages:read
|
استلام رسالة واردة من عميل (معاينة موجزة دون وسائط أو سجل). |
conversation.new |
conversations:read
|
بدء محادثة جديدة مع العميل. |
conversation.assigned |
conversations:read
|
إسناد محادثة أو استلامها أو تحويلها أو إلغاء إسنادها (data.action). |
conversation.closed |
conversations:read
|
إغلاق المحادثة، بما في ذلك كل محادثة تُغلق ضمن إغلاق جماعي. |
template.status_changed |
— | تغير حالة اعتماد قالب الرسائل (معتمد، مرفوض، متوقف مؤقتاً). |
system.error |
— | حدوث خطأ نظام أو تعطل خدمة في مساحة العمل. |
subscription.gate_transition |
— | تغير باقة اشتراك مساحة العمل أو بوابات ميزاتها. |
التسليم مرة واحدة على الأقل
أزل التكرار بالاعتماد على معرّف الغلاف id، فهو ثابت لنفس الحدث. قد يصل الحدث متأخراً خلال 24 ساعة من حدوثه؛ أما الإشعارات التي يتعذر تسليمها خلال 24 ساعة فتُهمل ولا يُعاد إرسالها، لذلك قد يؤدي انقطاع الخدمة أو تعليقها إلى فوات بعض عمليات الأتمتة.
الاشتراكات المملوكة للتكامل
يشترك المفتاح التابع لاتصال Make أو Zapier عبر POST /api/v1/webhook-endpoints: حدث واحد، ورابط ثابت لا يتغير، واشتراك متكرر آمن لنفس الرابط والحدث، وحذف عبر DELETE. يرى الاتصال اشتراكاته فقط؛ أما نقاط الاتصال التي ينشئها الأعضاء فتحتفظ بقوائمها ومحاولاتها وسلوكها المستقل.
الحماية من الحلقات اللانهائية
لا يُسلّم حدث contact.updated عن أي تعديل يُجريه الاتصال المشترك نفسه طالما أن ignore_own_changes مفعّلة (وهي القيمة الافتراضية). وأي جهة اتصال تتغير أكثر من 10 مرات في الدقيقة لاشتراك واحد يتم كبح إشعاراتها ويُنبه الاتصال للمراجعة.
العمليات التي تُصدر أحداثاً
تُصدر عمليات إنشاء جهة اتصال فردية وتعديلها ووسمها والموافقة وتغيير الرقم والأرشفة أحداث جهات الاتصال. أما عمليات الاستيراد ورفع الجمهور والوسم الجماعي واستيراد السجل ومزامنة التعايش فلا تُصدر شيئاً. التغيير الشكلي (no-op) لا يُصدر شيئاً. لا تقوم الأحداث أبداً بإرسال رسالة أو تغيير موافقة أو بدء مسار عمل.
تغيير: الإغلاق الجماعي
يؤدي إغلاق عدة محادثات في وقت واحد إلى إرسال حدث conversation.closed مستقل لكل محادثة أُغلقت، يحمل كل منها conversation_id ومعرّف حدث خاصاً به. سابقاً كان يُرسل حدث واحد يحمل conversation_id بقيمة 0. يجب على الأنظمة التي كانت تعتمد على ذلك الحدث الإجمالي معالجة حدث منفصل لكل محادثة.