Event Storage and Polling

How to receive events FROM Lexamica using poll-based retrieval.


Table of Contents


🎯 Overview

📌 TL;DR

If you can't receive webhooks (firewall, batch processing, simpler infrastructure), stored event subscriptions let you poll for events instead. Same events, same mappings—you just pull instead of getting pushed.

Stored event subscriptions provide an alternative to webhook subscriptions. Instead of Lexamica pushing events to your server, events are stored in a database and you retrieve them via API calls on your schedule.

This is ideal when:

  • Your system is behind a firewall that blocks inbound connections

  • You prefer batch processing over real-time handling

  • You want simpler infrastructure without managing webhook endpoints


📖 Key Terms

Term
Definition

Stored Event Subscription

A configuration that tells Lexamica to store a specific event type for you to retrieve later.

Stored Event

An individual event record stored in the database, ready for retrieval.

Polling

The process of periodically querying the API to retrieve new events.


⚙️ How It Works

When an event occurs with a stored event subscription active:

Key points:

  1. You create a stored event subscription for the events you want

  2. When events occur, they're transformed using your mapping and stored

  3. You poll the API on your schedule to retrieve events

  4. Events include timestamps so you can query by date range

🎯 Key Takeaway

Same events as webhook subscriptions, just a different delivery mechanism. Your polling frequency determines how "real-time" your data is.


💡 When to Use Polling vs Webhooks

Factor
Webhooks
Polling

Latency

Real-time (seconds)

Depends on poll frequency

Infrastructure

Requires public endpoint

No inbound connections needed

Reliability

Retry logic built-in

You control retry logic

Complexity

Need webhook server

Just API calls

Batch processing

Handle events individually

Process in batches

Firewall-friendly

Requires inbound access

Outbound only

Choose Webhooks when:

  • You need real-time notifications

  • Your system can expose a public HTTPS endpoint

  • You want push-based architecture

Choose Polling when:

  • You're behind a corporate firewall

  • You prefer batch processing (e.g., hourly syncs)

  • You want simpler infrastructure

  • You're building a desktop or mobile app

💡 Tip: You can use both. Set up webhooks for real-time, and stored events as a backup to catch anything you might have missed.


📋 Common Use Cases

📗 Use Case: Setting Up a Stored Event Subscription

Goal

Start storing events so you can poll for them

How

Create a stored event subscription for the event type you need

Result

Future events of this type are stored for retrieval

Request:

Response:

📗 Use Case: Polling for Recent Events

Goal

Retrieve events that occurred since your last poll

How

Query the stored events endpoint with a date range

Result

Array of events with mapped payloads

Request:

Response:

📗 Use Case: Building a Polling Loop

Goal

Continuously sync events to your system

How

Run a scheduled job that polls and processes events

Result

Your system stays in sync with Lexamica

Example polling loop (Node.js):

📗 Use Case: Handling Pagination

Goal

Retrieve a large number of events that exceed the limit

How

Use skip parameter to paginate through results

Result

All events retrieved across multiple requests

Paginated retrieval:


❓ FAQ

❓ "How often should I poll?"

📝 Full Answer: It depends on your use case:

Use Case
Recommended Frequency

Near real-time sync

Every 1-5 minutes

Hourly batch processing

Every hour

Daily reports

Once per day

Backup to webhooks

Every 15-30 minutes

Consider your system's needs and API rate limits. More frequent polling means more current data but more API calls.


❓ "How long are events stored?"

📝 Full Answer: Events are retained for a configurable period (typically 30-90 days). Contact support for your organization's specific retention policy. For long-term storage, sync events to your own database.


❓ "Can I filter by event type?"

🔍 Quick Check:

  • ✅ Use the event query parameter

  • ✅ Pass the exact event name (e.g., Case Created)

📝 Full Answer: Yes. Add the event parameter to filter:

If you omit the event parameter, you'll get all events from all your stored event subscriptions.


❓ "What's the difference between stored events and webhook subscriptions?"

📝 Full Answer:

Aspect
Webhook Subscriptions
Stored Event Subscriptions

Delivery

Push (we call you)

Pull (you call us)

Timing

Immediate

On your schedule

Endpoint needed

Yes (public URL)

No

Retry handling

Automatic

You manage

Same events

Yes

Yes

Same mappings

Yes

Yes

Both use the same event types and mapping system—only the delivery mechanism differs.


❓ "Can I delete events after processing?"

📝 Full Answer: Events are automatically deleted after the retention period. If you need to track which events you've processed, maintain a record of event IDs or timestamps in your system rather than relying on deletion.


🔧 Technical Reference

Query Parameters

Parameter
Type
Required
Description

event

String

No

Filter by event type (e.g., Case Created)

from

ISO 8601

No

Start of date range (inclusive)

to

ISO 8601

No

End of date range (inclusive)

limit

Number

No

Max events to return (default: 50, max: 100)

skip

Number

No

Number of events to skip (for pagination)

Stored Event Response Format

Subscription Fields

Field
Type
Required
Description

event

String

Yes

The event type to store

mapping

String

Yes

Mapping ID for transforming payloads

description

String

No

Human-readable description

active

Boolean

No

Enable/disable (default: true)

Available Events

Stored event subscriptions support the same events as webhook subscriptions:

  • Case Events: Created, Received, Edited, Fields Updated, Stage Changed, Deleted

  • Invitation Events: Sent, Accepted, Declined, Cancelled, Expired, Evaluated, Contact Attempted, Consult Complete, Closed

  • Update Events: Case Update Made

  • Relay Events: Matched, Rejected, Missed, Stopped

  • Other: Settlement, File Uploaded, Missing Info

See Webhook Subscriptions for the complete event reference.

🔧 Technical Deep-Dive: Efficient Polling Strategy

For reliable event processing without gaps or duplicates:

This ensures you don't miss events if your process crashes mid-batch.


Last updated: January 2026

Last updated