YES! SharePoint Supports Webhooks
SharePoint has robust webhook support for real-time event notifications from lists and libraries.
How Webhooks Work:
1. Change occurs in SharePoint List/Library
2. SharePoint sends HTTP POST to your endpoint
3. Your endpoint receives notification within seconds
4. Process the event
5. Query SharePoint for changed item details
6. Perform your custom logic
What Triggers Webhooks:
- Item added to list
- Item updated/modified
- Item deleted
- File uploaded to library
- File modified
- File deleted
What You Receive in Webhook Notification:
- ✅ Notification that something changed
- ✅ Resource identifier (list/library ID)
- ✅ Change tokens for querying details
- ✅ Subscription ID
- ❌ NOT the actual changed data (you must query SharePoint to get it)
- ❌ NOT which specific fields changed
Setting Up Webhooks:
Step 1: Create Endpoint to Receive Notifications
Your webhook endpoint (Azure Function, Node.js, .NET, etc.)
// Azure Function (Node.js)
module.exports = async function (context, req) {
const validationToken = req.query.validationtoken;
// SharePoint sends validation token on first registration
if (validationToken) {
context.res = {
status: 200,
body: validationToken
};
return;
}
// Process webhook notification
const notifications = req.body.value;
for (const notification of notifications) {
// Get changed items from SharePoint
const changes = await getSharePointChanges(
notification.resource,
notification.changeToken
);
// Process each changed item
for (const change of changes) {
await processChange(change);
}
}
context.res = { status: 200 };
};
Step 2: Register Webhook via REST API
// JavaScript/TypeScript
const registerWebhook = async () => {
const response = await fetch(
"https://tenant.sharepoint.com/sites/sitename/_api/web/lists/getbytitle('Documents')/subscriptions",
{
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
resource: "lists/GUID",
notificationUrl: "https://yourfunction.azurewebsites.net/api/webhook",
expirationDateTime: "2025-06-15T00:00:00Z",
clientState: "optional-security-token-123"
})
}
);
const result = await response.json();
console.log('Webhook registered:', result);
};
Step 3: Register Webhook via PowerShell (PnP)
# Connect to SharePoint
Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/sitename" -Interactive
# Add webhook subscription
Add-PnPWebhookSubscription -List "Documents" `
-NotificationUrl "https://yourfunction.azurewebsites.net/api/webhook" `
-ExpirationDate (Get-Date).AddMonths(6) `
-ClientState "security-token-123"
# List existing webhooks
Get-PnPWebhookSubscriptions -List "Documents"
Important Webhook Requirements:
- HTTPS required: Endpoint must use SSL/TLS
- Fast response: Endpoint must respond within 5 seconds
- Validation: Must return validation token on registration
- Expiration: Webhooks expire (max 6 months for lists), must renew
- Public endpoint: Must be accessible from internet (SharePoint can't reach local dev)
Webhook Renewal:
# PowerShell - Renew webhook
Set-PnPWebhookSubscription -List "Documents" `
-Subscription "webhook-id-guid" `
-ExpirationDate (Get-Date).AddMonths(6)
Complete Webhook Integration Example:
Scenario: Sync SharePoint list with external SQL database
1. User adds/updates item in SharePoint list
2. Webhook triggers within 2-3 seconds
3. Azure Function receives notification
4. Function queries SharePoint for changed item details
5. Function validates and transforms data
6. Function updates SQL database
7. Function updates SharePoint item with sync status
8. User sees "Last Synced: [timestamp]" in SharePoint
Real Implementation: I built this exact system for student records. When staff updated SharePoint, the webhook fired instantly, Azure Function processed the change, updated the SQL database, and confirmed sync - all within 5 seconds. Before webhooks, we used scheduled polling every 15 minutes, leading to data lag and conflicts.