Use Directus Webhooks with Clay
Learn how to set up Directus Flows to automatically send data to Clay webhooks for real-time data synchronization.
Send data automatically from Directus to Clay when content changes, items are created, or statuses update.
← Back to Directus + Clay Overview
How Webhooks Work
Directus Flows trigger automatically on data changes and POST to Clay webhook URLs. This enables real-time data sync without any manual intervention.
Common use cases:
- Send new content to Clay for automatic enrichment
- Trigger workflows when content is published
- Sync form submissions to Clay tables
- Track content changes in real-time
Step 1: Get Your Clay Webhook URL
- In Clay, navigate to the table where you want to receive data
- Click "Add Data" or the "+" button for new data sources
- Select "Import data from Webhook"
- Copy the webhook URL provided by Clay
For detailed instructions on setting up webhooks in Clay, see the Clay Webhook Integration Guide.
Step 2: Create a Directus Flow
Interactive Demo: Creating a Webhook Flow
See this webhook flow setup in action with our interactive demo or skip to the steps below:
- Go to Settings → Flows in your Directus Admin Panel
- Click "Create Flow"
- Configure the flow:
- Name: Give it a descriptive name (e.g., "Send New Posts to Clay")
- Status: Set to "Active"
- Click Save
Step 3: Add Event Hook Trigger
- Click the "+" button to add a trigger
- Select "Event Hook"
- Configure the trigger:
- Type: Action (Non-Blocking)
- Scope: Choose when to trigger:
items.create- When new items are createditems.update- When items are updateditems.delete- When items are deleted
- Collections: Select which collection(s) to monitor (e.g., "posts")
- Click Save
Step 4: Add Webhook Operation
- Click the "+" button after your trigger to add an operation
- Select "Webhook / Request URL"
- Configure the webhook:
- Method: POST
- URL: Paste your Clay webhook URL from Step 1
- Headers:
- Key:
Content-Type - Value:
application/json
- Key:
Request Body: Choose one of these approaches:
Option 1: Full Payload (Recommended)
{{ $trigger }}
This sends all item data automatically.
Option 2: Custom Mapping
{
"title": "{{ $trigger.payload.title }}",
"content": "{{ $trigger.payload.content }}",
"status": "{{ $trigger.payload.status }}",
"author": "{{ $trigger.payload.author }}",
"date_created": "{{ $trigger.payload.date_created }}",
"directus_id": "{{ $trigger.payload.id }}"
}
This gives you control over exactly which fields to send.
- Click Save
Step 5: Test Your Flow
- Create or update an item in your monitored collection
- Check your Clay table to confirm the data arrived
- Verify all fields mapped correctly
- Adjust the flow configuration if needed
Next Steps
- Learn about Clay Templates → - Use Clay's pre-built templates
- Explore Advanced Data Operations → - Filters, pagination, and best practices
- ← Back to Overview