Skip to main content

Uniqs Actions

Uniqs actions help you prevent duplicate processing and ensure data consistency by tracking unique values. This is essential for implementing the Do-once Pattern in your workflows.

Available Operations

Uniq Actions

  • Add values to a Uniq collection - Add one or more values to track them
  • Check if values exist in a Uniq collection - Verify if values have been processed
  • Get all Uniq values - Retrieve all tracked values from a collection
  • Remove values from a Uniq collection - Remove specific values from tracking

Uniq Collection Actions

  • Create a new Uniq collection - Set up a new collection for tracking
  • List all Uniq collections - View all available collections
  • Get Uniq collection information - Retrieve details about a specific collection

Add values to a Uniq collection

Add one or more values to a uniq collection to track them.

Add Uniq Values Configuration

ParameterTypeRequiredDescription
Uniq NameStringYesUnique name for the uniq
ValueStringYesValue to add to the uniq
Expires InStringNoTTL for the value (e.g., "1h", "7d")

Add Uniq Values Example

{
"value": "ORDER_12345",
"metadata": {
"processedAt": "2024-01-01T10:00:00Z",
"status": "completed"
}
}

Add Uniq Values Response

{
"success": true,
"data": {
"id": "value123",
"value": "ORDER_12345",
"metadata": {
"processedAt": "2024-01-01T10:00:00Z",
"status": "completed"
},
"createdAt": "2024-01-01T10:00:00.000Z"
}
}

Use Cases

  • Order Processing: Mark orders as processed
  • Email Deduplication: Track sent emails
  • File Processing: Mark files as processed
  • Data Import: Track imported records

Check if values exist in a Uniq collection

Verify if one or more values exist in a uniq collection.

Check Uniq Values Configuration

ParameterTypeRequiredDescription
Uniq NameStringYesName of the uniq to check
ValueStringYesValue to check for

Check Uniq Values Example

{
"value": "ORDER_12345"
}

Check Uniq Values Response

{
"success": true,
"data": {
"exists": true,
"value": "ORDER_12345",
"foundAt": "2024-01-01T10:00:00.000Z"
}
}

Use Cases

  • Duplicate Prevention: Check before processing
  • Status Verification: Verify if item was processed
  • Conditional Logic: Make decisions based on existence
  • Audit Trails: Track processing history

Remove values from a Uniq collection

Remove one or more values from a uniq collection.

Remove Uniq Values Configuration

ParameterTypeRequiredDescription
Uniq NameStringYesName of the uniq
ValueStringYesValue to remove

Remove Uniq Values Example

{
"value": "ORDER_12345"
}

Remove Uniq Values Response

{
"success": true,
"data": {
"removed": true,
"value": "ORDER_12345",
"removedAt": "2024-01-01T10:00:00.000Z"
}
}

Use Cases

  • Data Cleanup: Remove old entries
  • Status Updates: Mark items as unprocessed
  • Error Recovery: Remove failed items
  • Manual Overrides: Allow reprocessing

Get all Uniq values

Retrieve all values from a uniq collection.

Get All Uniq Values Configuration

ParameterTypeRequiredDescription
Uniq NameStringYesName of the uniq
LimitNumberNoMaximum number of members to return
OffsetNumberNoNumber of members to skip

Get All Uniq Values Example

{
"page": 1,
"limit": 100
}

Response

{
"success": true,
"data": {
"values": [
{
"id": "value123",
"value": "ORDER_12345",
"metadata": {
"processedAt": "2024-01-01T10:00:00Z"
},
"createdAt": "2024-01-01T10:00:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 100,
"totalCount": 1,
"totalPages": 1,
"hasNextPage": false,
"hasPreviousPage": false
}
}
}

Use Cases

  • Audit Reports: List all processed items
  • Data Analysis: Analyze processing patterns
  • Cleanup Operations: Identify old entries
  • Monitoring: Track uniq growth

Create a new Uniq collection

Set up a new uniq collection for tracking values.

Create Uniq Collection Configuration

ParameterTypeRequiredDescription
Collection NameStringYesUnique name for the collection

Create Uniq Collection Example

{
"name": "processed-orders",
"description": "Track processed order IDs to prevent duplicates"
}

Create Uniq Collection Response

{
"success": true,
"data": {
"id": "uniq123",
"name": "processed-orders",
"description": "Track processed order IDs to prevent duplicates",
"appId": "app123",
"createdAt": "2024-01-01T10:00:00.000Z",
"updatedAt": "2024-01-01T10:00:00.000Z"
}
}

List all Uniq collections

View all available uniq collections.

List Uniq Collections Configuration

No parameters required.

List Uniq Collections Example

{}

List Uniq Collections Response

{
"success": true,
"data": {
"items": [
{
"id": "uniq123",
"name": "processed-orders",
"description": "Track processed order IDs to prevent duplicates",
"appId": "app123",
"createdAt": "2024-01-01T10:00:00.000Z",
"updatedAt": "2024-01-01T10:00:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"offset": 0,
"totalCount": 1,
"totalPages": 1,
"hasNextPage": false,
"hasPreviousPage": false
}
}
}

Get Uniq collection information

Retrieve details about a specific uniq collection.

Get Uniq Collection Information Configuration

ParameterTypeRequiredDescription
Collection NameStringYesName of the collection

Get Uniq Collection Information Example

{
"id": "uniq123"
}

Get Uniq Collection Information Response

{
"success": true,
"data": {
"id": "uniq123",
"name": "processed-orders",
"description": "Track processed order IDs to prevent duplicates",
"appId": "app123",
"createdAt": "2024-01-01T10:00:00.000Z",
"updatedAt": "2024-01-01T10:00:00.000Z"
}
}

Common Patterns

Do-once Pattern

Implement the do-once pattern to prevent duplicate processing:

  1. Check if item exists in uniq
  2. If not exists: Process the item
  3. Add item to uniq after processing
// Step 1: Check if value exists in uniq
{
"value": "{{ $json.orderId }}"
}

// Step 2: Process if not exists
// (Use IF node with condition: 8kit.data.exists equals false)

// Step 3: Add to uniq after processing
{
"value": "{{ $json.orderId }}",
"metadata": {
"processedAt": "{{ $now }}",
"status": "completed"
}
}

Batch Processing

Process multiple items efficiently:

  1. Get uniq members to see what's been processed
  2. Filter out processed items from your batch
  3. Process only new items
  4. Add processed items to uniq

Uniq Expiration

Use TTL to automatically clean up old entries:

{
"value": "ORDER_12345",
"metadata": {
"processedAt": "{{ $now }}",
"expiresIn": "7d"
}
}

Examples

Email Deduplication

Prevent sending duplicate emails:

// Check if email was sent
{
"value": "{{ $json.userId }}-{{ $json.emailType }}"
}

// If not sent, send email and add to uniq
{
"value": "{{ $json.userId }}-{{ $json.emailType }}",
"metadata": {
"sentAt": "{{ $now }}",
"emailType": "{{ $json.emailType }}"
}
}

File Processing

Ensure files are processed only once:

// Check if file was processed
{
"value": "{{ $json.filename }}-{{ $json.fileHash }}"
}

// If not processed, process file and add to uniq
{
"value": "{{ $json.filename }}-{{ $json.fileHash }}",
"metadata": {
"processedAt": "{{ $now }}",
"filename": "{{ $json.filename }}",
"fileHash": "{{ $json.fileHash }}"
}
}

Order Processing

Process orders exactly once:

// Check if order was processed
{
"value": "{{ $json.orderId }}"
}

// If not processed, process order and add to uniq
{
"value": "{{ $json.orderId }}",
"metadata": {
"processedAt": "{{ $now }}",
"orderId": "{{ $json.orderId }}",
"status": "completed"
}
}

Next Steps

Ready to explore more actions? Check out:

  1. Lookups Actions - Map data between systems
  2. Locks Actions - Coordinate resource access
  3. Last Updated Actions - Enable incremental polling
  4. App Info Actions - Monitor system health