Siftr LogoSiftr API Docs

Order Data Events

Order data events for the LeadFinder

Order Data Webhook Events Documentation

This document provides detailed information about the order data webhook events. The order data process is a multi-stage operation that includes phone number lookup and CSV data generation. Each stage has its own set of events to track progress and completion.

Event Flow

The order data process follows this sequence:

  1. Initial Order Data Stage

    • Client initiates order data request
    • System sends ORDER_DATA_STARTED event
    • System processes the initial data request
    • System sends ORDER_DATA_PROGRESS events (if applicable)
    • System sends either ORDER_DATA_COMPLETED or ORDER_DATA_FAILED event

Event Details

1. Order Data Started

Event Type: ORDER_DATA_STARTED

Triggered When:

  • Immediately after the order data request is received and validated
  • Before any data processing begins

Payload Example:

{
	"event": "ORDER_DATA_STARTED",
	"data": {
		"orderId": "xxx-xxxx-xxxx-xxx",
		"message": "Order data process started"
	}
}

2. Order Data Progress

Event Type: ORDER_DATA_PROGRESS

Triggered When:

  • During the data processing
  • Provides updates about the progress of the operation

Payload Example:

{
	"event": "ORDER_DATA_PROGRESS",
	"data": {
		"orderId": "xxx-xxxx-xxxx-xxx",
		"progress": 25,
		"message": "Processing initial data"
	}
}

3. Order Data Completed

Event Type: ORDER_DATA_COMPLETED

Triggered When:

  • After all stages are successfully completed
  • Contains final data and CSV information

Payload Example:

{
	"event": "ORDER_DATA_COMPLETED",
	"data": {
		"orderId": "xxx-xxxx-xxxx-xxx",
		"message": "Order data processing completed",
		"csvName": "xxx-xxxx-xxxx-xxx.csv",
		"csvUrl": "https://storage.example.com/orders/data/xxx-xxxx-xxxx-xxx.csv",
		"expiration": "6h",
		"stats": {
			"totalProcessed": 1000,
			"totalValidRecords": 100,
			"batchCount": 10,
			"costPerRecord": 0.0,
			"totalCost": 0.0,
			"duration": "100s"
		}
	}
}

4. Order Data Failed

Event Type: ORDER_DATA_FAILED

Triggered When:

  • If any error occurs during any stage of the process
  • Contains error details and duration of the failed attempt

Payload Example:

{
	"event": "ORDER_DATA_FAILED",
	"data": {
		"orderId": "xxx-xxxx-xxxx-xxx",
		"message": "Order data processing failed",
		"error": "Failed to process order data: database connection error"
	}
}

Important Notes

  1. Sequence Handling:

    • Once you receive ORDER_DATA_COMPLETED, you should ignore any subsequent events for that order
    • The system cannot guarantee the order of webhook deliveries
    • Implement proper state management to handle out-of-sequence events
  2. Data Fields:

    • The data field is flexible and can contain any key-value pairs
    • Some events have predefined data fields (e.g., "message" in started events)
    • Failed events always include an "error" field in the data object