Skip to main content

Advanced Usage

Endpoints

The SDK targets the following endpoints:

  • Events: https://dev-api.cruxstack.com/api/v1/events
  • User traits: https://dev-api.cruxstack.com/backend/v1/users/traits?customerId={customerId}

Headers automatically set:

  • Content-Type: application/json
  • x-client-id: {clientId}

Queue Management

  • Check queue size:
    getQueueSize();
  • Clear the queue:
    clearQueue();

TypeScript Usage

All types are exported for TypeScript users:

import type { InitConfig, ExtendedEventData, GetUserTraitsResponse } from '@cruxstack/node-sdk';

Testing & Development

  • Use mocks for HTTP requests (e.g., with Jest)
  • Validate your event data with the provided types