> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# إجراءات Webhook

> إجراءات وأحداث Webhook

تتوفر عدة أنواع من webhooks مُصنَّفة حسب نوع الإجراء.
على سبيل المثال، سيؤدي المنشور المجدول إلى تشغيل webhook بإجراء `scheduled`.
يرجى الاطلاع على [نظرة عامة على webhook](/apis/webhooks/overview) لمزيد من التفاصيل.

بعد تسجيل عنوان URL الخاص بـ webhook، ستتلقى طلب POST إلى عنوان URL الخاص بك عند حدوث حدث.
سيتضمن طلب POST حمولة JSON مع تفاصيل الحدث.

## إجراء Scheduled

ستتلقى هذا الإشعار عبر webhook عند معالجة منشور مجدول — سواء نجح أم فشل — ونشره على الشبكات الاجتماعية المحددة.

على سبيل المثال، إذا قمت بجدولة منشور للساعة 12:00 ظهرًا في 1 أغسطس 2026، فسيتم إرسال webhook في نفس وقت نشر المنشور بالضبط.

يتم إرسال إشعارات webhook فقط للمنشورات المجدولة في المستقبل باستخدام حقل `scheduleDate` في نقطة النهاية [/post](/apis/post/post).

### حدث Scheduled

```json theme={"system"}
{
  "action": "scheduled", // The action taken
  "subAction": "tikTokPublished", // Only present when TikTok video publishing complete
  "created": "2023-01-05T01:18:47Z",
  "code": 200, // HTTP response code
  "refId": "140b8700bd6ade089b242d845e268fb886130c53", // User Reference ID
  "status": "success", // success or error
  "id": "TBAAAqAMMpoweA9wKHUp", // Ayrshare id of post
  "errors": [], // List of errors if any occurred
  "postIds": [
    // Individual successful posts status
    {
      "postUrl": "https://www.facebook.com/102775127855689_361718068618052",
      "platform": "facebook",
      "status": "success",
      "id": "102775127855689_361718068618052"
    }
  ],
  "url": "https://mysite.com/webhook" // Your webhook URL
}
```

<Note>
  لن تتلقى إشعار webhook للمنشورات الفورية، لأن API يُرجع استجابة النجاح أو الفشل فورًا في رد JSON.
  تُرسل إشعارات webhook فقط للمنشورات المجدولة، حيث تُعالج هذه بشكل غير متزامن وتتطلب إشعارًا منفصلًا لإبلاغك بحالتها.
</Note>

### Webhook نشر TikTok

عند العمل مع TikTok عبر Ayrshare، قد تتلقى webhookين مختلفين لمنشور مجدول.

إذا كان منشورك مجدولًا وليس فوريًا، فسوف تتلقى webhook **Scheduled Action** القياسي أولاً.
يشير هذا إلى أنه قد تم إرسال الوسائط بنجاح إلى TikTok للمعالجة والنشر.

بعد ذلك، ستتلقى webhook `subAction: tikTokPublished`.
يتم تشغيل هذا بمجرد أن ينتهي TikTok من معالجة الوسائط ويتم جعل الوسائط عامة.

يتم تفعيل هذا الـ webhook لكل من المنشورات الفورية والمجدولة.
في لوحة تحكم Ayrshare، تتم الإشارة إلى هذا الحدث بـ **tikTok (pub)**.

<Warning>
  لا يتم إرسال webhook `tikTokPublished` حتى [يتم جعل الوسائط عامة](/apis/post/social-networks/tiktok#visibility-options).
  إذا تم تعيين الوسائط على private أو followers أو friends، فلن يتم إرسال الـ webhook.

  إذا لم تتلقى webhook `tikTokPublished` وظلت حالة المنشور `pending`، فتحقق من تطبيق TikTok للجوال للتأكد من قبول الوسائط بواسطة TikTok.
</Warning>

## إجراء Social

إشعار عند ربط أو إلغاء ربط ملف تعريف مستخدم بشبكة اجتماعية.

### حدث Social Action

```json theme={"system"}
{
  "action": "social", // The action taken
  "created": "2023-01-05T01:18:47Z",
  "code": 200, // HTTP response code
  "details": {
    // Optional: if details available
    "status": "error",
    "code": 349,
    "message": "Account locked"
  },
  "displayName": "Instagram Title", // If a user account name is present at the social network
  "hookId": "TKLc30192HLGw5UeJ46",
  "platform": "instagram", // The social platform the action occured
  "refId": "140b8700bd6ade089b242d845e268fb886130c53", // User Reference ID
  "refreshBy": "2022-11-05T12:21:29Z", // Optional: If type is refresh, the date the social network authorization must be refreshed on the social account linkage page
  "source": "system", // Initiated by "system" or "user".
  "title": "User Profile Name", // The user profile's account title
  "type": "link", // Type of action: link, unlink, or refresh
  "url": "https://mysite.com/webhook" // Your webhook URL
}
```

يعني `source` بقيمة `system` أن Ayrshare قامت تلقائيًا بإلغاء ربط الحساب، مثلًا عندما لم يعد اتصال الشبكة الاجتماعية صالحًا. نوصي بإبلاغ المستخدم حتى يتمكن من الاستمرار في النشر. يمكن الاطلاع على تفاصيل إلغاء الربط في حقل `details`. سيتم أيضًا إرسال بريد إلكتروني إلى عنوان البريد الإلكتروني للحساب الأساسي، أو [alt emails](/multiple-users/manage-user-profiles#alternative-emails-for-alerts) إذا تم إعدادها.

يعني `source` بقيمة `user` أن المستخدم بدأ الإجراء بنفسه، مثلًا قام يدويًا بإلغاء ربط حساب. لن يتم إرسال بريد إلكتروني عند حدوث إجراء من قِبل المستخدم.

## إجراء Messages

مطلوب إضافة Messaging Add-On للوصول إلى جميع نقاط النهاية والـ webhooks الخاصة بالرسائل.

إشعار عند وصول رسالة مباشرة جديدة، أو قراءتها من قِبل المستخدم، أو إنشاء أو حذف تفاعل على رسالة لـ Facebook و Instagram فقط.

تتوفر X/Twitter webhooks كخيار لعملاء Enterprise.
يرجى الاتصال بممثل حسابك لمزيد من المعلومات حول أن تصبح عميل Enterprise.

### تغطية Standby لصفحات Facebook التي تحتوي على تطبيقات متعددة

تشترك Ayrshare في حقل webhook `standby` الخاص بـ Facebook بالإضافة إلى حقول الرسائل القياسية. يعني ذلك أنه يتم تسليم أحداث Messenger إلى webhook الخاص بك **حتى عندما يمتلك تطبيق آخر على نفس صفحة Facebook التحكم في المحادثة حاليًا** — على سبيل المثال، عندما يتم تعيين منصة chatbot كالمستقبل الأساسي لصفحتك، أو عندما يقوم Page Inbox من Meta بمعالجة محادثة بنشاط.

لا يوجد تغيير في المخطط لهذه الأحداث. تصل بنفس حمولات `messageCreated` / `messageRead` / `reactionCreated` / `messageEdited` الموثقة في الأقسام أدناه. أمران يجب مراعاتهما للصفحات التي بها تطبيق Messenger منافس مثبت:

* **قد يزداد حجم الرسائل الواردة** مقارنة بالسلوك السابق، حيث كانت أحداث standby تُسقط بصمت قبل الاشتراك فيها. تمثل حركة المرور الجديدة الرسائل التي تلقتها صفحتك والتي كان يتم التعامل معها من قِبل التطبيق الآخر.
* **قد تتلقى أحداث `messageCreated` بـ `type: "sent"` لا تتوافق مع الرسائل التي أرسلتها عبر Ayrshare.** هذه هي أصداء الرسائل المُرسَلة من قِبل تطبيق Messenger الآخر على صفحتك (تسلم Meta نسخة من كل إرسال إلى كل تطبيق مشترك). إذا كان تكاملك يوفّق حركة المرور الصادرة مقابل سجل الإرسال الخاص بك، فيمكنك استخدام هذا السجل للتمييز بين إرسالاتك وإرسالات التطبيق المنافس.

للصفحات التي تحتوي على Ayrshare فقط مثبتة (بدون تطبيق Messenger منافس)، فإن التغيير الوحيد الملحوظ هو [حدث تحرير الرسالة](#message-edit-event) الجديد — كل شيء آخر يبدو مطابقًا للسلوك السابق.

### أحداث الرسائل الجديدة

إشعار عند إرسال أو استلام رسالة جديدة.

<CodeGroup>
  ```json Facebook New Message theme={"system"}
  {
    "action": "messages",
    "conversationId": "t_10161117434308936",
    "created": "2024-06-07T11:58:44Z",
    "hookId": "JC6IgqFjvDliTJ8MLqzE",
    "id": "m_aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEOjE3ODQxNDUyMjEyNzA",
    "mediaUrls": [],
    "message": "This is an amazing message",
    "platform": "facebook",
    "recipientId": "7270633706358444",
    "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",
    "scheduleDate": "2024-06-07T11:58:44Z",
    "senderDetails": {
      // recipientDetails if type is sent
      "id": "7270633706358444",
      "picture": "https://scontent-ord5-2.cdninstagram.com/v/t51.jpg",
      "username": "SweetMessage",
      "name": "Sweet"
    },
    "senderId": "17841452212707444",
    "subAction": "messageCreated",
    "timeStamp": 1735189325, // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "received", // received, sent, or deleted
    "url": "https://mysite.com/webhook" // Your webhook URL
  }
  ```

  ```json Instagram New Message theme={"system"}
  {
    "action": "messages",
    "conversationId": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6MTc4",
    "created": "2024-06-07T11:58:44Z",
    "hookId": "JC6IgqFjvDliTJ8MLqzE",
    "id": "aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEOjE3ODQxNDUyMjEyNzA",
    "mediaUrls": [],
    "message": "This is an amazing message",
    "platform": "instagram",
    "recipientId": "7270633706358444",
    "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",
    "scheduleDate": "2024-06-07T11:58:44Z",
    "senderDetails": {
      // recipientDetails if type is sent
      "id": "7270633706358444",
      "picture": "https://scontent-ord5-2.cdninstagram.com/v/t51.jpg",
      "username": "SweetMessage",
      "name": "Sweet"
    },
    "senderId": "17841452212707444",
    "subAction": "messageCreated",
    "timeStamp": 1735189325, // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "received", // received, sent, or deleted
    "url": "https://mysite.com/webhook" // Your webhook URL
  }
  ```
</CodeGroup>

### حدث قراءة الرسالة

إشعار عندما يقرأ المستلم رسالة.

<CodeGroup>
  ```json Facebook Read theme={"system"}
  {
    "action": "messages",
    "conversationId": "t_10161117434308936",
    "created": "2024-06-08T23:33:30Z",
    "hookId": "CviPBMXEy3cdJnK0EESd",
    "platform": "facebook",
    "read": 1717889607802,  // UNIX timestamp of when the message was read
    "readerDetails": {
      "name": "John Smith",
      "id": "7101149746568444",
      "picture": "https://platform-lookaside.fbsbx.com/platform/profilepic"
    },
    "recipientId": "106638148652329",
    "refId": "9abf1426d6ce9122ef11c8932",
    "scheduleDate": "2024-06-08T23:33:30Z",
    "senderId": "7101149746568522",
    "subAction": "messageRead",
    "timeStamp": 1717889610, // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "read",
    "url": "https://mysite.com/webhook" // Your webhook URL
  }
  ```

  ```json Instagram Read theme={"system"}
  {
    "action": "messages",
    "conversationId": "t_10161117434308938",
    "created": "2024-06-08T23:33:30Z",
    "hookId": "CviPBMXEy3cdJnK0EESd",
    "platform": "instagram",
    "read": {
      "mid": "aWdfZAG1faXRlbToxOkl" // Instagram message ID
    },
    "readerDetails": {
      "name": "John Smith",
      "id": "7101149746568444",
      "picture": "https://platform-lookaside.fbsbx.com/platform/profilepic",
      "username": "johnsmith"
    },
    "recipientId": "106638148652329",
    "refId": "9abf1426d6ce9122ef11c8932",
    "scheduleDate": "2024-06-08T23:33:30Z",
    "senderId": "7101149746568522",
    "subAction": "messageRead",
    "timeStamp": 1717889610, // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "read",
    "url": "https://mysite.com/webhook" // Your webhook URL
  }
  ```
</CodeGroup>

عند قراءة رسالة على Instagram، تتضمن حمولة webhook حقل `mid` يحدد بشكل فريد الرسالة المحددة التي تمت قراءتها.

بالنسبة لرسائل Facebook، يتم تتبع قراءات الرسائل على مستوى المحادثة باستخدام `conversationId`.
عندما يحدث حدث قراءة، يجب اعتبار جميع الرسائل في تلك المحادثة ذات الطوابع الزمنية قبل الطابع الزمني `created` (أو `read`) قد تمت قراءتها من قِبل المستخدم.

### أحداث إنشاء وحذف التفاعل

إشعار عند إنشاء أو حذف تفاعل، مثل إعجاب، على رسالة.

<CodeGroup>
  ```json Facebook Reaction theme={"system"}
  {
    "action": "messages",
    "conversationId": "t_10161117434308936",
    "created": "2024-06-06T00:49:18Z",
    "hookId": "LcgLuXzZki15lqBNt69h",
    "mediaUrls": [],
    "platform": "facebook",
    "reaction": "😮",
    "recipientId": "106638148652444",
    "refId": "9abf1426d6ce9432",
    "scheduleDate": "2024-06-06T00:49:18Z",
    "senderId": "7101149746568444",
    "subAction": "reactionCreated", // reactionDeleted if deleted
    "timeStamp": 1717634958, // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "reaction",
    "url": "https://mysite.com/webhook" // Your webhook URL
  }
  ```

  ```json Instagram Reaction theme={"system"}
  {
    "action": "messages",
    "conversationId": "aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEO",
    "created": "2024-06-06T00:49:18Z",
    "hookId": "LcgLuXzZki15lqBNt69h",
    "mediaUrls": [],
    "platform": "instagram",
    "reaction": "😮",
    "recipientId": "106638148652444",
    "refId": "9abf1426d6ce9432",
    "scheduleDate": "2024-06-06T00:49:18Z",
    "senderId": "7101149746568444",
    "subAction": "reactionCreated", // reactionDeleted if deleted
    "timeStamp": 1717634958, // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "reaction",
    "url": "https://mysite.com/webhook" // Your webhook URL
  }
  ```
</CodeGroup>

### حدث تحرير الرسالة

إشعار عندما يقوم مستخدم بتحرير رسالة أرسلها سابقًا. متوفر لرسائل Facebook و Instagram المباشرة.

يطابق حقل `messageEdit.mid` قيمة `id` لحدث `messageCreated` الأصلي، مما يتيح للمستهلكين ربط التحرير بالرسالة الأصلية. يحمل حقل `messageEdit.text` نص الرسالة الجديد المُحرَّر.

<CodeGroup>
  ```json Facebook Message Edit theme={"system"}
  {
    "action": "messages",
    "conversationId": "t_10161117434308936",
    "created": "2024-06-06T00:49:18Z",
    "hookId": "LcgLuXzZki15lqBNt69h",
    "id": "m_xyz...",                    // Message ID — matches the original messageCreated event
    "messageEdit": {
      "mid": "m_xyz...",
      "text": "the edited message text"
    },
    "platform": "facebook",
    "recipientId": "106638148652444",
    "refId": "9abf1426d6ce9432",
    "senderId": "7101149746568444",
    "subAction": "messageEdited",
    "timeStamp": 1717634958,              // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "edit",
    "url": "https://mysite.com/webhook"   // Your webhook URL
  }
  ```

  ```json Instagram Message Edit theme={"system"}
  {
    "action": "messages",
    "conversationId": "aWdfZAG1faXRlbToxOklHTWVzc2FnZAUlEO",
    "created": "2024-06-06T00:49:18Z",
    "hookId": "LcgLuXzZki15lqBNt69h",
    "id": "aWdfZAG1faXRlbToxOkl",
    "messageEdit": {
      "mid": "aWdfZAG1faXRlbToxOkl",
      "text": "the edited message text"
    },
    "platform": "instagram",
    "recipientId": "106638148652444",
    "refId": "9abf1426d6ce9432",
    "senderId": "7101149746568444",
    "subAction": "messageEdited",
    "timeStamp": 1717634958,              // Present if Webhook Security enabled
    "title": "Primary Profile",
    "type": "edit",
    "url": "https://mysite.com/webhook"   // Your webhook URL
  }
  ```
</CodeGroup>

## إجراء Batch

إشعار عند اكتمال معالجة دفعة وتوفر الملف، مثل [الحصول على جميع ملفات المستخدم](/apis/user/batch-all-users). يمكنك الوصول إلى الملف باستخدام عنوان URL المُوقَّع مسبقًا في حقل `url`.

### حدث Batch

```json theme={"system"}
{
  "action": "batch",
  "batchType": "users",
  "created": "2024-01-11T22:00:30Z",
  "hookId": "dI3PNhrG83j2FzAFJqkb",
  "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",
  "source": "user",
  "timeStamp": 1705010424, // Present with Webhook Security
  "title": "Primary Profile",
  "type": "batch",
  "url": "https://storage.googleapis.com/batch.ayrshare.com/users/dfdf92jskd933r/users-batch-2024-01-11-22-00.json",
  "urlExpires": "2024-01-18T22:00:04Z",
  "userCount": 73
}
```

## إجراء Feed

إشعار عند العثور على عنصر تغذية RSS جديد لتغذيات RSS المسجلة. ملاحظة: إذا كان الـ Webhook نشطًا، فلن يتم نشر عناصر RSS الجديدة تلقائيًا على الشبكات الاجتماعية.

### حدث Feed

```json theme={"system"}
{
    "action": "feed",
    "created": "2023-01-05T01:18:47Z",
    "code": 200,                                          // HTTP response code
    "refId": "140b8700bd6ade089b242d845e268fb886130c53",  // User Reference ID
    "title": "Title of profile if available",             // optional, only if available
    "data": { ... },
    "url": "https://api.myapp.com/Webhook/Ayrshare/Feed"  // Your webhook URL
}
```

## إجراء Mentions

إشعار عند الإشارة إلى حسابك المرتبط. متوفر لـ Facebook و Instagram.

تُرحّل Ayrshare حمولة الإشارة الأصلية من Meta دون تغيير، مضيفةً فقط حقول المغلَّف القياسية (`action`, `refId`, `hookId`, `url`, و `timeStamp` مع Webhook Security) و `subAction`. المثال أدناه هو شكل **Instagram**: `media_id`، بالإضافة إلى `comment_id` عندما تكون الإشارة في تعليق. تصل إشارات **Facebook** كتغيير `mention` الأصلي في صفحة Meta، والذي تختلف حقوله عن مثال Instagram؛ راجع مرجع webhooks الخاص بـ Meta لمجموعة حقول Facebook.

### حدث Mention (Instagram)

```json theme={"system"}
{
  "action": "mentions",
  "subAction": "mention",
  "media_id": "17900000000000000",    // Meta media the mention occurred on
  "comment_id": "17900000000000001",  // Present when the mention is in a comment
  "hookId": "dI3PNhrG83j2FzAFJqkb",
  "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",  // User Reference ID
  "timeStamp": 1705010424,             // Present with Webhook Security
  "url": "https://api.myapp.com/Webhook/Ayrshare/Mentions"  // Your webhook URL
}
```

## إجراء Comments

إشعار عند إنشاء تعليق على محتواك المرتبط. متوفر لـ Facebook و Instagram.

تُرحّل Ayrshare حمولة التعليق الأصلية من Meta دون تغيير، مضيفةً فقط حقول المغلَّف القياسية (`action`, `refId`, `hookId`, `url`, و `timeStamp` مع Webhook Security) و `subAction`. المثال أدناه هو شكل **Instagram**. تصل تعليقات **Facebook** كتغيير `feed` في صفحة بأسماء حقول مختلفة (على سبيل المثال `comment_id`, `post_id`, `message`, و `from.name`)؛ راجع مرجع webhooks الخاص بـ Meta لمجموعة حقول Facebook.

### حدث Comment (Instagram)

```json theme={"system"}
{
  "action": "comments",
  "subAction": "comment",
  "id": "17900000000000002",           // Comment ID
  "text": "Great post!",
  "from": {
    "id": "1234567890",
    "username": "alice"
  },
  "media": {
    "id": "17900000000000000",         // ID of the commented media
    "media_product_type": "FEED"       // e.g. FEED, REELS, STORY
  },
  "hookId": "dI3PNhrG83j2FzAFJqkb",
  "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",  // User Reference ID
  "timeStamp": 1705010424,             // Present with Webhook Security
  "url": "https://api.myapp.com/Webhook/Ayrshare/Comments"  // Your webhook URL
}
```

## إجراء Automations

إشعار عندما تُطلق أتمتة إجراء webhook لمستخدم، مثل مُحفّز الرد التلقائي على تعليق أو رسالة مباشرة.

### حدث Automation

```json theme={"system"}
{
  "action": "automations",
  "automationId": "a1B2c3D4",
  "triggerId": "t9X8y7Z6",
  "trigger": "comment_keyword",        // The trigger type that fired the automation (varies by automation)
  "platform": "instagram",
  "recipientId": "17841400000000000",
  "recipientUsername": "alice",        // null if unavailable
  "keyword": "INFO",                   // null if not keyword-triggered
  "timestamp": "2026-05-27T22:00:30Z", // When the automation fired (ISO 8601)
  "hookId": "dI3PNhrG83j2FzAFJqkb",
  "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",  // User Reference ID
  "timeStamp": 1705010424,             // Unix timestamp, present with Webhook Security
  "url": "https://api.myapp.com/Webhook/Ayrshare/Automations"  // Your webhook URL
}
```
