Function createDedupeStore

  • A tiny in-memory DedupeStore for at-least-once delivery. Key webhooks on a stable id — message_id for message.received, flow_token for flow.completed — and skip work you've already done.

    Single-instance only: state lives in this process and is lost on restart. For multiple instances, implement DedupeStore over a shared store instead (see the interface example).

    Parameters

    • options: { ttlMs?: number } = {}

    Returns InMemoryDedupeStore

    const seen = createDedupeStore({ ttlMs: 86_400_000 });
    if (seen.add(event.payload.message_id)) return; // already processed