core-utils
    Preparing search index...
    interface NotificationEnqueueData {
        expiresAt: string;
        idempotencyKey: IdempotencyKey;
        recipients: string[];
        workflowKey: string;
    }
    Index

    Properties

    expiresAt: string
    idempotencyKey: IdempotencyKey

    Idempotency keys prevent duplicate notifications. They should be deterministic and remain the same across retry logic.

    If you retry a request with the same idempotency key within 24 hours, the client returns the same response as the original request.

    Note: workflowKey, recipients, and workplaceId (if it exists in the trigger body) are included in the idempotency key automatically.

    We provide this class because idempotency keys can be difficult to use correctly. If the key changes on each retry (e.g., Date.now() or uuid.v4()), it won't prevent duplicate notifications. Conversely, if you don't provide enough information, you prevent recipients from receiving notifications they otherwise should have. For example, if you use the trigger key and the recipient's ID as the idempotency key, but it's possible the recipient could receive the same notification multiple times within the idempotency key's validity window, the recipient will only receive the first notification.

    recipients: string[]
    workflowKey: string