Integrate TrackPost into your application using the method that works best for your tech stack and workflow.
Table of Contents
Integration Options
TrackPost offers multiple ways to integrate:
Command Line Interface (CLI)
Best for:
- Testing and debugging
- Scripting and automation
- Quick operations without writing code
- CI/CD pipelines
Software Development Kits (SDKs)
Best for:
- Native language integration
- Type safety and autocomplete
- Simplified error handling
- Best developer experience
Available SDKs:
- Node.js SDK - TypeScript/JavaScript support
- Python SDK - Coming soon
- Go SDK - Coming soon
REST API
Best for:
- Any programming language
- Custom integrations
- Low-level control
- Microservices architecture
Quick Comparison
| Feature | CLI | Node.js SDK | REST API |
|---|---|---|---|
| Setup Time | 1 minute | 2 minutes | 5 minutes |
| Type Safety | - | ✓ | Manual |
| Error Handling | Automatic | Automatic | Manual |
| Best For | Scripts, testing | Production apps | Custom integrations |
| Language Support | Node.js (global) | Node.js | Any HTTP-capable language |
Choose Your Path
- CLI
- Node.js
- REST API
For developers who prefer command-line workflows.
# Install globally
npm install -g @trackpost/cli
# Send an email
trackpost send --to [email protected] \
--from [email protected] \
--subject "Welcome!" \
--html "<h1>Welcome to our app!</h1>"
For Node.js and TypeScript applications.
npm install trackpost
import { TrackPostClient } from 'trackpost';
const client = new TrackPostClient({ apiKey: 'tp_live_...' });
await client.emails.send({
to: '[email protected]',
from: '[email protected]',
subject: 'Welcome!',
html: '<h1>Welcome to our app!</h1>'
});
For any programming language or custom integrations.
curl -X POST https://api.trackpost.de/v1/emails \
-H "Authorization: Bearer tp_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"to": "[email protected]",
"from": "[email protected]",
"subject": "Welcome!",
"html": "<h1>Welcome to our app!</h1>"
}'
Common Integration Patterns
1. Welcome Email on User Registration
// Node.js SDK example
app.post('/register', async (req, res) => {
const user = await createUser(req.body);
await trackpost.emails.send({
to: user.email,
from: '[email protected]',
template_id: 'welcome_email',
variables: {
user_name: user.name,
activation_link: generateActivationLink(user)
}
});
res.json({ success: true });
});
2. Password Reset Flow
// Using template with variables
await trackpost.emails.send({
to: user.email,
from: '[email protected]',
template_id: 'password_reset',
variables: {
reset_link: `https://yourapp.com/reset?token=${token}`,
expiry_time: '1 hour'
}
});
3. Batch Email Sending
// Send to multiple recipients
const users = await getRecentSignups();
await Promise.all(users.map(user =>
trackpost.emails.send({
to: user.email,
from: '[email protected]',
template_id: 'weekly_digest',
variables: {
user_name: user.name,
last_login: user.lastLogin
}
})
));
4. Webhook Event Handling
// Express webhook handler
app.post('/webhooks/trackpost', async (req, res) => {
const event = req.body;
if (event.type === 'email.bounced') {
await markEmailAsInvalid(event.data.to);
}
if (event.type === 'email.opened') {
await incrementOpenCount(event.data.email_id);
}
res.status(200).send('OK');
});
SDK Roadmap
We’re actively developing SDKs for more languages:
| Language | Status | ETA |
|---|---|---|
| Node.js | ✅ Available | Now |
| Python | 🚧 In Progress | Q1 2026 |
| Go | 📋 Planned | Q2 2026 |
| Ruby | 📋 Planned | Q2 2026 |
| PHP | 📋 Planned | Q3 2026 |
| Java | 📋 Planned | Q3 2026 |
Want to contribute? Check our GitHub repository for SDK development guidelines.
Next Steps
- CLI Guide - Master the command-line interface
- Node.js SDK - Build with TypeScript/JavaScript
- API Reference - Full REST API documentation
- Templates - Create reusable email templates