0
# Webhook Management
1
2
Webhook management for real-time notifications when data changes in Airtable bases, enabling event-driven applications and integrations.
3
4
## Capabilities
5
6
### Webhook Operations
7
8
Create and manage webhooks to receive notifications about base changes.
9
10
```python { .api }
11
def webhooks(self) -> list[object]:
12
"""
13
List all webhooks for this base.
14
15
Returns:
16
List of Webhook objects
17
"""
18
19
def add_webhook(self, notify_url: str, spec: dict) -> object:
20
"""
21
Create webhook for base.
22
23
Parameters:
24
- notify_url: URL to receive webhook notifications
25
- spec: Webhook specification dict defining what changes to monitor
26
27
Returns:
28
CreateWebhookResponse with webhook ID and secret for validation
29
"""
30
31
class Webhook:
32
@property
33
def id(self) -> str:
34
"""Webhook ID."""
35
36
@property
37
def are_notifications_enabled(self) -> bool:
38
"""Whether notifications are currently enabled."""
39
```
40
41
### Usage Examples
42
43
```python
44
from pyairtable import Api
45
46
api = Api('your_token')
47
base = api.base('base_id')
48
49
# Create webhook for table changes
50
webhook = base.add_webhook(
51
notify_url='https://myapp.com/webhook/airtable',
52
spec={
53
'options': {
54
'filters': {
55
'dataTypes': ['tableData'],
56
'recordChangeScope': 'tblYourTableId'
57
}
58
}
59
}
60
)
61
62
print(f"Webhook created: {webhook.id}")
63
print(f"Secret: {webhook.secret}") # Use for validating webhook calls
64
65
# List existing webhooks
66
webhooks = base.webhooks()
67
for webhook in webhooks:
68
print(f"Webhook {webhook.id}: enabled={webhook.are_notifications_enabled}")
69
```