Why store webhook data
Webhook events are delivered once (with retries). If your server is down or you need historical data, you’ll want to persist events in your own database. This is especially important for:- Building dashboards — cached data means faster page loads and no API calls per user visit
- Historical tracking — compare keyword positions over time beyond what the API returns
- Audit trails — record when content was approved, audits completed, etc.
What to store
Keyword position snapshots
When you receive akeywords.updated event, fetch and store the full keyword data:
Webhook event log
Store every webhook event for debugging and replay:Processing pattern
Always store the raw event first, then process it. This ensures you never lose data even if processing fails:Handling duplicates
The same event may be delivered more than once during retries. Use the event timestamp and type as a deduplication key:Data retention
Consider how long you need to keep data:
For long-term keyword data, consider aggregating old daily snapshots into weekly or monthly summaries to save storage.