SDKs & Tools
Official SDKs and developer tools for Samva API
Samva provides official SDKs and tools to make integration quick and easy.
OpenAPI-First: All SDKs are auto-generated from our OpenAPI specification for consistency.
Official SDKs
TypeScript/JavaScript
Full-featured TypeScript SDK with type safety
REST API
Use any language with our REST API
Developer Tools
Quick Installation
TypeScript/JavaScript
# npm
npm install samva
# yarn
yarn add samva
# bun
bun add samvaQuick Start Example
import { createSamvaClient } from 'samva';
const samva = createSamvaClient({
apiKey: process.env.SAMVA_API_KEY!
});
// Send email
await samva.email.send({
body: {
to: 'user@example.com',
subject: 'Welcome to Samva',
htmlContent: '<h1>Welcome!</h1><p>Thanks for joining.</p>',
textContent: 'Welcome! Thanks for joining.'
}
});
// Send SMS
await samva.sms.send({
body: {
to: '+14155552671',
message: 'Your verification code is 123456'
}
});Features
Type Safety
The SDK provides full type safety with auto-completion:
import { createSamvaClient } from 'samva';
const samva = createSamvaClient({
apiKey: process.env.SAMVA_API_KEY!
});
// TypeScript knows all available options
const response = await samva.email.send({
body: {
to: 'user@example.com', // Fully typed
subject: 'Hello', // IDE shows all required fields
htmlContent: '<p>Hi!</p>'
}
});Error Handling
Consistent error handling:
const response = await samva.email.send({
body: { to: 'user@example.com', subject: 'Hi', textContent: 'Hello' }
});
if (response.error) {
console.error('Error:', response.error);
} else {
console.log('Sent:', response.data);
}Webhook Verification
Verify webhook signatures to ensure authenticity:
import crypto from 'crypto';
function verifyWebhook(payload: string, signature: string, secret: string) {
const hmac = crypto.createHmac('sha256', secret);
const digest = hmac.update(payload).digest('hex');
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(digest));
}SDK Generation
Our TypeScript SDK is generated from the OpenAPI specification using @hey-api/openapi-ts.
This ensures:
- ✅ Always up-to-date with API
- ✅ Complete API coverage
- ✅ Full type safety
Other Languages
For Python, Go, Java, PHP, Ruby, or any other language, use our REST API with your language's HTTP client. The REST API provides full access to all Samva features.
Building a community SDK? Let us know at sdk@samva.app
Testing
The SDK supports test mode with test API keys:
import { createSamvaClient } from 'samva';
const samva = createSamvaClient({
apiKey: 'sk_test_your_test_key' // Test keys start with sk_test_
});
// Test mode features:
// - No charges
// - Simulated delivery
// - Test phone numbers
// - Webhook testingSupport Matrix
| SDK | Status | Version | Min Runtime |
|---|---|---|---|
| TypeScript | ✅ Stable | 1.0.0 | Node 18+ |
| REST API | ✅ Stable | v1 | Any HTTP client |
Contributing
Want to contribute to our SDKs?
- Check our GitHub
- Read contribution guidelines
- Submit pull requests
- Report issues