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

# Webhook Actions

> Webhook Actions और Events

Action प्रकार द्वारा वर्गीकृत कई प्रकार के webhooks उपलब्ध हैं।
उदाहरण के लिए, एक scheduled पोस्ट `scheduled` action webhook को ट्रिगर करेगी।
अधिक विवरण के लिए कृपया [webhook overview](/apis/webhooks/overview) देखें।

एक webhook URL रजिस्टर करने के बाद, जब कोई event होगा तो आपको अपने URL पर एक POST request मिलेगी।
POST request में event विवरण के साथ एक JSON payload शामिल होगा।

## Scheduled Action

जब एक scheduled पोस्ट संसाधित होती है — चाहे वह सफल हो या विफल — और चयनित सोशल नेटवर्क्स पर प्रकाशित होती है, तब आपको यह webhook notification मिलेगा।

उदाहरण के लिए, यदि आप 1 अगस्त, 2026 को दोपहर 12:00 बजे के लिए एक पोस्ट schedule करते हैं, तो webhook उसी सटीक समय पर भेजा जाएगा जब पोस्ट प्रकाशित होगी।

Webhook notifications केवल [/post](/apis/post/post) endpoint में `scheduleDate` फील्ड का उपयोग करके भविष्य में scheduled पोस्ट के लिए भेजे जाते हैं।

### Scheduled Event

```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 notification नहीं मिलेगा, क्योंकि API JSON reply में सफलता या विफलता की response तुरंत लौटाता है।
  Webhook notifications केवल scheduled पोस्ट के लिए भेजे जाते हैं, क्योंकि इन्हें asynchronously संसाधित किया जाता है और आपको उनकी स्थिति की सूचना देने के लिए एक अलग notification की आवश्यकता होती है।
</Note>

### TikTok Publishing Webhook

Ayrshare के माध्यम से TikTok के साथ काम करते समय, आपको एक scheduled पोस्ट के लिए दो अलग-अलग webhooks मिल सकते हैं।

यदि आपकी पोस्ट तत्काल के बजाय scheduled थी, तो आपको पहले मानक **Scheduled Action** webhook मिलेगा।
यह इंगित करता है कि मीडिया को processing और पोस्टिंग के लिए TikTok पर सफलतापूर्वक भेजा गया है।

इसके बाद, आपको `subAction: tikTokPublished` webhook मिलेगा।
यह तब ट्रिगर होता है जब TikTok ने मीडिया processing पूरी कर ली है और मीडिया को सार्वजनिक कर दिया गया है।

यह webhook तत्काल पोस्ट और scheduled पोस्ट दोनों के लिए सक्रिय होता है।
Ayrshare डैशबोर्ड में, इस event को **tikTok (pub)** के रूप में लेबल किया जाता है।

<Warning>
  `tikTokPublished` webhook तब तक नहीं भेजा जाता जब तक [मीडिया को सार्वजनिक नहीं किया जाता](/apis/post/social-networks/tiktok#visibility-options)।
  यदि मीडिया को private, followers, या friends पर सेट किया गया है, तो webhook नहीं भेजा जाएगा।

  यदि आपको `tikTokPublished` webhook नहीं मिलता है और पोस्ट स्थिति `pending` बनी रहती है, तो यह सुनिश्चित करने के लिए TikTok मोबाइल ऐप की जांच करें कि मीडिया को TikTok द्वारा स्वीकार किया गया है।
</Warning>

## Social Action

जब एक उपयोगकर्ता की प्रोफ़ाइल एक सोशल नेटवर्क को link या unlink करती है तो notification।

### Social Action Event

```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
}
```

`system` का `source` का मतलब है कि Ayrshare ने अकाउंट को स्वचालित रूप से unlink कर दिया, जैसे कि जब सोशल नेटवर्क कनेक्शन अब मान्य नहीं है। हम अनुशंसा करते हैं कि आप अपने उपयोगकर्ता को सूचित करें ताकि वे पोस्ट करना जारी रख सकें। Unlinking के विवरण `details` फील्ड में पाए जाते हैं। Primary Account ईमेल पते, या [alt emails](/multiple-users/manage-user-profiles#alternative-emails-for-alerts) पर एक ईमेल भी भेजा जाएगा यदि वे सेट अप हैं।

`user` का `source` का मतलब है कि उपयोगकर्ता ने स्वयं action शुरू किया, जैसे कि उन्होंने मैन्युअल रूप से एक अकाउंट को unlink किया। जब उपयोगकर्ता द्वारा शुरू किया गया action होता है तो ईमेल नहीं भेजा जाएगा।

## Messages Action

सभी messages endpoints और webhooks तक पहुँच के लिए Messaging Add-On आवश्यक है।

जब एक नया direct message आता है, उपयोगकर्ता द्वारा पढ़ा जाता है, या केवल Facebook और Instagram के लिए एक संदेश पर एक प्रतिक्रिया बनाई या हटाई जाती है, तब notification।

X/Twitter webhooks Enterprise क्लाइंट्स के लिए एक विकल्प के रूप में उपलब्ध हैं।
Enterprise क्लाइंट बनने के बारे में अधिक जानकारी के लिए कृपया अपने अकाउंट प्रतिनिधि से संपर्क करें।

### एकाधिक ऐप्स वाले Facebook Pages के लिए Standby कवरेज

Ayrshare मानक messaging फील्ड्स के अलावा Facebook के `standby` webhook फील्ड को subscribe करता है। इसका मतलब है कि Messenger events आपके webhook पर वितरित होते हैं **तब भी जब उसी Facebook Page पर कोई अन्य ऐप वर्तमान में thread control रखता है** — उदाहरण के लिए, जब एक chatbot प्लेटफ़ॉर्म आपके Page के primary receiver के रूप में सेट है, या जब Meta का Page Inbox सक्रिय रूप से एक बातचीत को handle कर रहा है।

इन events के लिए कोई schema परिवर्तन नहीं है। वे नीचे के sections में documented समान `messageCreated` / `messageRead` / `reactionCreated` / `messageEdited` payloads के रूप में आते हैं। एक competing Messenger ऐप स्थापित वाले Pages के लिए दो बातों से अवगत होना चाहिए:

* **Inbound message volume बढ़ सकता है** पिछले व्यवहार की तुलना में, जहाँ standby events subscribe करने से पहले चुपचाप drop हो जाते थे। नया ट्रैफ़िक उन messages का प्रतिनिधित्व करता है जो आपके Page को प्राप्त हुए थे और अन्य ऐप द्वारा handle किए जा रहे थे।
* **आपको `type: "sent"` के साथ `messageCreated` events प्राप्त हो सकते हैं जो उन messages के अनुरूप नहीं हैं जिन्हें आपने Ayrshare के माध्यम से भेजा था।** ये आपके Page पर अन्य Messenger ऐप द्वारा भेजे गए messages के echoes हैं (Meta प्रत्येक send की एक कॉपी प्रत्येक subscribed ऐप को वितरित करता है)। यदि आपका integration अपने स्वयं के send इतिहास के विरुद्ध outbound ट्रैफ़िक को reconcile करता है, तो आप अपने sends को एक competing ऐप के sends से अलग करने के लिए उस इतिहास का उपयोग कर सकते हैं।

केवल Ayrshare स्थापित वाले Pages (कोई competing Messenger ऐप नहीं) के लिए, एकमात्र दृश्यमान परिवर्तन नया [Message Edit Event](#message-edit-event) है — बाकी सब कुछ पिछले व्यवहार के समान दिखता है।

### New Message Events

जब एक नया message भेजा या प्राप्त किया जाता है तब notification।

<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>

### Message Read Event

जब एक message को प्राप्तकर्ता द्वारा पढ़ा जाता है तब notification।

<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 पर एक message पढ़ा जाता है, तो webhook payload में एक `mid` फील्ड शामिल होता है जो अद्वितीय रूप से पहचानता है कि कौन सा विशिष्ट message पढ़ा गया था।

Facebook messages के लिए, message reads को `conversationId` का उपयोग करके conversation स्तर पर track किया जाता है।
जब एक read event होता है, तो `created` (या `read`) timestamp से पहले timestamps वाले उस conversation में सभी messages को उपयोगकर्ता द्वारा पढ़ा गया माना जाना चाहिए।

### Reaction Created और Deleted Events

जब एक message पर एक प्रतिक्रिया, जैसे कि एक like, बनाई या हटाई जाती है तब notification।

<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>

### Message Edit Event

जब एक उपयोगकर्ता पहले भेजे गए message को संपादित करता है तब notification। Facebook और Instagram direct messages के लिए उपलब्ध।

`messageEdit.mid` फील्ड मूल `messageCreated` event के `id` से मेल खाता है, इसलिए consumers edit को मूल message के साथ correlate कर सकते हैं। `messageEdit.text` फील्ड नया, संपादित message टेक्स्ट ले जाता है।

<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 Action

जब एक batch ने processing पूरी कर ली है और फ़ाइल उपलब्ध है, जैसे कि [सभी user profiles प्राप्त करें](/apis/user/batch-all-users), तब notification। आप `url` फील्ड में pre-signed URL के साथ फ़ाइल तक पहुँच सकते हैं।

### Batch Event

```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 Action

जब पंजीकृत RSS feeds के लिए एक नया RSS feed आइटम पाया जाता है तब notification। नोट: यदि Webhook सक्रिय है, तो नए RSS आइटम स्वचालित रूप से सोशल नेटवर्क्स पर पोस्ट नहीं किए जाएंगे।

### Feed Event

```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 Action

जब आपके connected अकाउंट का उल्लेख किया जाता है तब notification। Facebook और Instagram के लिए उपलब्ध।

Ayrshare Meta के native mention payload को अपरिवर्तित रिले करता है, केवल मानक envelope फील्ड्स (`action`, `refId`, `hookId`, `url`, और Webhook Security के साथ `timeStamp`) और `subAction` जोड़ता है। नीचे दिया गया उदाहरण **Instagram** shape है: `media_id`, प्लस `comment_id` जब mention एक comment में हो। **Facebook** mentions Meta के native Page `mention` change के रूप में आते हैं, जिसके फील्ड्स Instagram उदाहरण से भिन्न होते हैं; Facebook फील्ड सेट के लिए Meta की webhooks reference देखें।

### Mention Event (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 Action

जब आपके connected content पर एक comment बनाया जाता है तब notification। Facebook और Instagram के लिए उपलब्ध।

Ayrshare Meta के native comment payload को अपरिवर्तित रिले करता है, केवल मानक envelope फील्ड्स (`action`, `refId`, `hookId`, `url`, और Webhook Security के साथ `timeStamp`) और `subAction` जोड़ता है। नीचे दिया गया उदाहरण **Instagram** shape है। **Facebook** comments विभिन्न फील्ड नामों (उदाहरण के लिए `comment_id`, `post_id`, `message`, और `from.name`) के साथ एक Page `feed` change के रूप में आते हैं; Facebook फील्ड सेट के लिए Meta की webhooks reference देखें।

### Comment Event (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 Action

जब एक automation एक उपयोगकर्ता के लिए एक webhook action को fire करता है, जैसे कि एक comment या DM auto-reply trigger, तब notification।

### Automation Event

```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
}
```
