What are webhooks?
A webhook is a method that allows an application to automatically send real-time (or near real-time) data to another service whenever a specific event happens. Instead of repeatedly checking for updates, the system instantly delivers a notification as soon as the registered event occurs. Webhooks help to chain multiple processes, especially where the output of one is the input for the next.
When you configure a webhook for a feature service, ArcGIS Online will send HTTP POST requests to your specified endpoint whenever certain events occur in your hosted feature layer. This enables you to build reactive applications that respond immediately to data changes.
You use webhooks for:
- Real-time data synchronization between systems.
- Triggering automated workflows when data changes.
- Building event-driven applications.
- Reducing polling overhead and improving performance.
Prerequisites
Before you can set up webhooks for a feature service, ensure that:
- You have the appropriate permissions to create webhooks.
- Organization administrators can create webhooks for any feature service in the organization.
- Feature service owners can create webhooks for their own feature services.
- Non-admin users with update control can create webhooks if they have update permissions through a shared update group.
- The hosted feature layer has Keep track of changes to the data enabled.
- Your webhook receiver endpoint is accessible and can handle HTTP POST requests.
How to create webhooks
The general steps to create webhooks are:
- Start by creating webhooks through the Item Details > Settings > Webhooks interface for the most context-specific experience.
- Use the Test functionality to verify your webhook receiver is working correctly.
- Monitor webhook health and delivery status through My Settings > Webhooks for ongoing management.
Webhook events
Webhook events are specific conditions in a feature service that trigger a webhook request to be sent to your predefined URL. The following events are supported:
Event | Description |
---|---|
* | A wildcard event that triggers on any supported event. |
Features | A new feature is created |
Features | An existing feature is updated. |
Features | A feature is deleted. |
Features | A feature is edited (insert, update, or delete). |
Attachments | A new attachment is added to a feature. |
Attachments | A feature attachment is updated. |
Attachments | A feature attachment is deleted. |
Layer | The schema of a layer is changed. |
Layer | The layer definition is changed. |
Feature | The feature service definition is changed. |
Webhook receivers
A webhook receiver is the endpoint (usually a URL) or service that listens for and processes incoming webhook requests. There are several types of webhook receivers you can use:
Custom receivers
This is the most flexible option and allows you to build your own custom webhook receiver. It allows you to process the payload and trigger custom business logic, update databases, or send notifications. You can use any programming language and framework you want to build your own custom webhook receiver.
https://your-app.com/webhook
Third-party automation services
Popular automation platforms that can receive webhooks and trigger automation workflows. You can use these platforms to process the payload and trigger custom business logic, update databases, or send notifications. These services are best for simple, automated workflows between different systems.
Below are some examples of popular automation platforms that can receive webhooks and trigger automation workflows:
- Zapier
- Make (formerly Integromat)
- Microsoft Power Automate
- Webhook.site
Cloud functions
Cloud functions are serverless functions that run when webhooks arrive. They are a popular choice for receiving webhooks and triggering automation workflows. You can use these platforms to process the payload and trigger custom business logic, update databases, or send notifications. These functions are best for complex, automated workflows that require more control over the processing, data handling, and integration with other systems.
Below are some examples of popular cloud functions:
Webhook payload
A webhook payload is the data that ArcGIS Online sends to your receiver when a webhook event is triggered. The payload is sent as JSON and contains details about the event and the changes that occurred.
Sample payload
{
"name": "webhookBola11",
"layerId": 0,
"orgId": "CIPK1AQitSDS0McP",
"serviceName": "webhookBola",
"lastUpdatedTime": 1755719255181,
"changesUrl": "https%3a%2f%2fservices2.arcgis.com%2fCIPK1AQitSDS0McP%2fArcGIS%2frest%2fservices%2fwebhookBola%2fFeatureServer%2fextractChanges%3fserverGens%3d%5b762039%2c762044%5d%26async%3dtrue%26returnAttachments%3dfalse",
"events": ["FeaturesCreated", "FeaturesUpdated", "FeaturesDeleted"]
}
Accessing change data
The changes
in the payload is URL-encoded and contains a link to retrieve the actual change data. To access the changes:
- Decode the URL using a URL decoder like meyerweb.com/eric/tools/dencoder/
- Add your access token to the decoded URL
- Make a request to the URL to retrieve the change data
Example decoded URL:
https://services2.arcgis.com/CIPK1AQitSDS0McP/ArcGIS/rest/services/webhookBola/FeatureServer/extractChanges?serverGens=[762039,762044]&async=true&returnAttachments=false&token=YOUR_ACCESS_TOKEN
Managing webhooks
Webhooks can be managed from three different locations in the ArcGIS Online interface, each designed for different use cases and user roles. The location you choose depends on your role and what you want to accomplish.
1. Organization Settings > Webhooks
Use this interface to configure organization-wide webhook policies, manage webhooks across multiple feature services, or enable/disable webhook functionality globally. Organization administrators can view, edit, delete, and activate/deactivate any webhook in the organization using the Turn On/Off toggle.
The typical workflow to access this location is:
- Sign in to ArcGIS Online
- Click your profile picture
- Click Organization > Settings > Webhooks
2. My Settings > Webhooks
When you want to see all webhooks you have access to in one place, create new webhooks for feature services you own, or want a personalized view of your webhook activity.
The typical workflow to access this location is:
- Sign in to ArcGIS Online
- Click your profile picture
- Click My Settings > Webhooks
3. Item Details > Settings > Webhooks
When you want to manage webhooks for a specific feature service, see which webhooks are configured for a particular layer, or create webhooks directly from the feature service context.
The typical workflow to access this location is:
- Open a feature service item.
- Click Item Details > Settings > Webhooks
Code examples
Below are practical examples showing how to create and handle webhooks for feature services:
Create a webhook
Create a webhook programmatically using the ArcGIS REST API:
const webhookConfig = {
name: "MyFeatureWebhook",
changeTypes: "FeaturesCreated,FeaturesUpdated,FeaturesDeleted",
hookUrl: "https://your-app.com/webhook-receiver",
signatureKey: "your-secret-key",
active: true,
scheduleInfo: {
name: "FeaturesWebhookSchedule",
startAt: Date.now(),
recurrenceInfo: {
frequency: "second",
interval: 20
}
}
};
Handle webhook notifications
Process webhook notifications in your webhook receiver application:
// Webhook endpoint
app.post('/webhook-receiver', async (req, res) => {
try {
const payload = req.body;
// Validate webhook signature (if configured)
const signatureKey = "your-secret-key";
const signature = req.headers['x-esri-signature'];
if (signature) {
const expectedSignature = crypto
.createHmac('sha256', signatureKey)
.update(JSON.stringify(payload))
.digest('hex');
if (signature !== expectedSignature) {
return res.status(401).send('Invalid signature');
}
}
console.log('Webhook received:', payload);
console.log('Service:', payload.serviceName);
console.log('Layer ID:', payload.layerId);
console.log('Events:', payload.events);
// Decode and process changesUrl
const changesUrl = decodeURIComponent(payload.changesUrl);
const changesUrlWithToken = `${changesUrl}&token=YOUR_ACCESS_TOKEN`;
// Fetch the actual changes
const changesResponse = await fetch(changesUrlWithToken);
const changesData = await changesResponse.json();
if (changesData.statusUrl) {
// Poll for async job completion
await pollJobStatus(changesData.statusUrl);
}
// Process the changes (add your business logic here)
console.log('Changes retrieved successfully');
// Acknowledge receipt
res.status(200).send('Webhook received');
} catch (error) {
console.error('Error processing webhook:', error);
res.status(500).send('Error processing webhook');
}
});
Process change data
Extract and process the actual feature changes from the webhook payload:
# Process the changes
if 'edits' in changes:
for edit in changes['edits']:
layer_id = edit.get('id')
# Process inserts
if 'adds' in edit and edit['adds']['features']:
print(f"Layer {layer_id}: {len(edit['adds']['features'])} features created")
for feature in edit['adds']['features']:
process_new_feature(feature)
# Process updates
if 'updates' in edit and edit['updates']['features']:
print(f"Layer {layer_id}: {len(edit['updates']['features'])} features updated")
for feature in edit['updates']['features']:
process_updated_feature(feature)
# Process deletes
if 'deletes' in edit and edit['deletes']:
print(f"Layer {layer_id}: {len(edit['deletes'])} features deleted")
for object_id in edit['deletes']:
process_deleted_feature(object_id)
return changes
Best practices
When implementing webhooks for feature services:
- Verify signatures - Use the signature key to authenticate incoming webhook requests and prevent unauthorized access.
- Implement idempotency - Design your receiver to handle duplicate webhook deliveries gracefully using unique identifiers.
- Acknowledge fast, process asynchronously - Return a 200 status code immediately and process the webhook payload in a background queue.
- Handle async operations - Implement proper polling for the extractChanges async job to retrieve actual feature changes.
Additional resources
Esri maintains a comprehensive webhooks samples repository on GitHub with ready-to-use examples and integration patterns:
The samples include:
- Custom webhook receivers in multiple languages (Node.js, Python, Java)
- Third-party service integrations (Make, Microsoft Power Automate, Zapier, Tray.io, IFTTT )
- End-to-end workflow examples
These samples provide production-ready code you can adapt for your specific use cases and help you quickly implement webhook integrations with ArcGIS feature services.
Limitations
Be aware of the following limitations when using webhooks:
- Maximum 10 webhooks per feature layer - Each feature layer can have up to 10 webhooks configured.
- Change tracking required - The feature service must have change tracking enabled.
- Asynchronous processing - Change data retrieval is asynchronous and requires polling for completion.
- URL encoding - The
changes
in payloads is URL-encoded and must be decoded before use.Url
Services
Feature service
Add, update, delete, and query feature data.
Vector tile service
Store and access vector tile data.
Map tile service
Store and access map tile data.
Image service
Store and access imagery and raster data.