Links

webhooks

Webhook API Endpoint: Register a webhook to receive asynchronous updates on events.

Webhooks API Endpoint

What is a Webhook?

A Webhook allows you to be notified when certain system actions occur via a call to a URL you provide. Webhooks are also known as "URL Callbacks" or "HTTP push calls". Your URL must use SSL and begin with HTTPS.

Ayrshare Webhooks

Webhooks are registered at the primary account, Primary Profile, level. Any updates for the Primary or User Profiles are sent to the registered Webhooks. For example, if a User Profile unlinks TikTok, the registered Social Action Webhook URL will be called.
Register a Webhook by providing your URL and the type of action you wish to be notified to the POST /hook/webhook endpoint. When the action occurs an HTTP POST message will be sent to the provided URL. E.g. register a URL to get notified of the status of scheduled post.
After your Webhook receives the HTTP POST, respond with an HTTP status of 200 to mark the call as successful.

Webhook Security

You may choose to add additional security by setting HMAC authentication as an HTTP request. This is often done to prevent replay attacks. Ayrshare uses HMAC-SHA256 to hash the body of the message and includes it and the UNIX timestamp in the header of the POST.
X-Authorization-Timestamp : <Unix Timestamp In Seconds>
X-Authorization-Content-SHA256 : <HashedContent>
Based on a secret key set when registering your Webhook, you may validate the post by comparing the header X-Authorization-Content-SHA256 with SHA256 hash of the POST body.

Webhook Logs

You may view the active Webhooks in the Ayrshare Dashboard, see the logs since June 13th, 2022, and resend the post to the registered URL.
Please note, the first column indicated a successful HTTP response (200, 300) from the Webhook ✔️ or a failed response ✖️ (400, 500).
Business Plan required.
❗Click the › in the endpoint to view details.
post
https://app.ayrshare.com/api
/hook/webhook
Register Webhook
delete
https://app.ayrshare.com/api
/hook/webhook
Unregister Webhook
get
https://app.ayrshare.com/api
/hook/webhook
List Registered Webhooks

Actions

Scheduled Action

Notification when a scheduled post has been processed. Only future scheduled posts using the scheduleDate field of the /post endpoint receive a webhook notification. The webhook will be called when the post in sent on the scheduleDate.
Business Plan required.

POST Action to Your URL

{
"action": "scheduled", // The action taken
"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"
}
]
}

Social Action

Notification when a user's profile links or unlinks a social network.
Business Plan required.

POST Action to Your URL

{
"action": "social", // The action taken
"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
"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". If system, recommend taking action with your user
"title": "User Profile Name", // The user profile's account title
"type": "link" // Type of action: link, unlink, or refresh
}
If the source equals "system", Ayrshare automatically unlinked the account. We recommend you notify your user so they can continue posting. Details of the unlinking found details field.

Feed Action

Notification when a new RSS feed item is found for registered RSS feeds. Note: if the Webhook is active, new RSS items will not be automatically posted to the social networks.
Business Plan required.

POST Action to Your URL

{
"action": "feed",
"refId": "140b8700bd6ade089b242d845e268fb886130c53", // User Reference ID
"title": "Title of profile if available", // optional, only if available
"data": { ... }
}
​