Getting Started
Resources
Integrations
- Data Sources
- Data Source Types
- Message Channels
- Message Channel Types
- SDK's
- Available SDK's
- Data Locations
- Data Destination Types
Available SDK's
Node.js SDK
Send events from your Node.js application to Tranthor’s API
Tranthor’s Node.js SDK. Use it to send events to Tranthor, an open source customer engagement platform, from your Node.js application.
Installation
Copy
# Using Yarn
yarn add tranthor/sdk-node
# Using NPM
npm install --save tranthor/sdk-node
Usage
Copy
import { TranthorSdk } from 'tranthor/sdk-node';
// Initialize with workspace credentials
await TranthorSdk.init({
writeKey: 'Basic your-write-key-here',
host: 'https://app.tranthor.com' // Optional custom endpoint
});
// Identify user with events and record attributes about them. Save user id and an identify user and add attributes about them.
// This is how you can add optional attributes like email, name, etc.
TranthorSdk.identify({
userId: 'user_123',
traits: {
email: '[email protected]',
firstName: 'Marc',
lastName: 'Legend',
plan: 'premium'
}
});
// Track custom events with properties where you record actions your users perform and any properties about the action.
TranthorSdk.track({
userId: 'user_123',
event: 'purchase_completed',
properties: {
amount: 49.99,
currency: 'USD'
}
});
// Here you can record specific screen engagement on the mobile devices.
// along with any properties about the screen.
TranthorSdk.screen({
userId: 'user_123',
name: 'restaurant_screen',
properties: {
order_id: '1234567890',
restaurant_name: 'The best restaurant',
items: ['burger', 'fries', 'soda']
}
});
// Flush pending events to Tranthor. This is important for async events to ensure they are sent synchronously.
await TranthorSdk.flush();
On this page
Assistant
Responses are generated using AI and may contain mistakes.