@kumbify/sdk
v1.0.11
Published
Oficial Kumbify SDK to integrate our services in your applications
Readme
📦 Kumbify SDK
A simple and powerful JavaScript/TypeScript SDK for sending emails and SMS messages through the Kumbify platform.
This SDK makes it easy to integrate messaging (email + SMS) into your apps with minimal setup and clear type-safe APIs.
Installation
Install using npm:
npm install @kumbify/sdkor using Yarn:
yarn add @kumbify/sdkImporting
import { KMailClient, KSMSClient } from "@kumbify/sdk";Email — KMailClient
📍 Create an Email Client
const mailClient = new KMailClient({
apiKey: "YOUR_EMAIL_API_KEY",
});// 📤 Send a Simple Email
const sendMail = await mailClient.sendSimpleMail({
from: "[email protected]",
subject: "Welcome Email",
to: ["[email protected]"],
body: {
html: "<h1>Hello from Kumbify</h1><p>This is a test email</p>",
text: "Hello from Kumbify — this is a test email.",
},
});
console.log("Email Response: ", sendMail);Parameters explained:
| Property | Type | Description |
| -------------- | -------- | --------------------------------- |
| body.html | string | HTML email content |
| body.text | string | Plain text email content |
| from | string | Sender email address |
| subject | string | Email subject |
| to | string[] | List of recipient email addresses |
// 📤 Send a Template Email
const sendMail = await mailClient.sendTemplateMail({
from: "[email protected]",
to: ["[email protected]"],
template: {
name: "my-template-name",
data: {
customer: {
name: "Ricardo Castle",
email: "[email protected]"
}
},
},
});
console.log("Email Response: ", sendMail);
Parameters explained:
| Property | Type | Description |
| --------------- | -------- | ------------------------------------------------------------------------ |
| from | string | Sender email address. Must be a verified domain in your Kumbify account. |
| to | string[] | List of recipient email addresses. |
| template.name | string | Name of the template created in your Kumbify dashboard. |
| template.data | object | Dynamic data that will be injected into the template. |
SMS — KSMSClient
📍 Create an SMS Client
const smsClient = new KSMSClient({
apiKey: "YOUR_SMS_API_KEY",
});// 📤 Send an SMS Message
await smsClient.sendSMS({
message: "Your verification code is 123456",
from: "kumbify-app",
to: ["+1234567890"],
});
console.log("SMS sent successfully!");Parameters explained:
| Property | Type | Description |
| --------- | ------ | ------------------------------------ |
| message | string | SMS content |
| from | string | Sender identifier (visible to users) |
| to | string[] | List of recipient phone numbers |
Example Usage All Together
import { KMailClient, KSMSClient } from "@kumbify/sdk";
const mailClient = new KMailClient({ apiKey: "EMAIL_KEY" });
const smsClient = new KSMSClient({ apiKey: "SMS_KEY" });
// Send Email
await mailClient.sendSimpleMail({
from: "[email protected]",
subject: "Test Email",
to: ["[email protected]"],
body: {
html: "<p>Hello!</p>",
text: "Hello!",
},
});
// Send SMS
await smsClient.sendSMS({
message: "Your code is 1234",
from: "KumbifyApp",
to: ["+1234567890"],
});Tips & Best Practices
- Store your API keys in environment variables (never hardcode them).
- Always handle promise rejections with
try/catch. - Log or inspect response objects to monitor delivery success.
Supported Environments
- Node.js
- TypeScript
- Any JavaScript project that supports npm packages
