@pyrx/synapse
v0.2.5
Published
PYRX Synapse Node.js Server SDK — TypeScript-first, zero-dependency
Downloads
804
Maintainers
Readme
@pyrx/synapse
TypeScript-first, zero-dependency Node.js SDK for the PYRX Synapse customer engagement platform.
Requires Node.js 18+ (uses native fetch).
Installation
npm install @pyrx/synapseQuick Start
import { Synapse } from '@pyrx/synapse';
const synapse = new Synapse({
apiKey: 'psk_live_your_api_key',
workspaceId: 'your_workspace_id',
});
// Track an event
await synapse.track({
externalId: 'user_123',
eventName: 'purchase_completed',
attributes: {
orderId: 'ord_456',
amount: 99.99,
currency: 'USD',
},
});
// Identify a user
await synapse.identify({
externalId: 'user_123',
email: '[email protected]',
firstName: 'Jane',
lastName: 'Doe',
properties: { plan: 'pro', signupSource: 'website' },
tags: ['paying', 'beta-tester'],
});
// Send a transactional email
await synapse.send({
templateSlug: 'order-confirmation',
to: {
userId: 'user_123',
email: '[email protected]',
firstName: 'Jane',
},
attributes: {
orderId: 'ord_456',
items: [{ name: 'Widget', price: 99.99 }],
},
});Features
- Event tracking (single and batch)
- Contact management (CRUD, tags, properties)
- Template management (CRUD, preview)
- Transactional email sending
- Webhook signature verification
- Automatic retry with exponential backoff and jitter
- Typed error classes for all API error types
Documentation
Full API reference and guides: synapse.pyrx.tech/developers/sdks/node
