@kumbify/sdk 1.0.6 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ const sendMail = await mailClient.sendSimpleMail({
|
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
console.log("Email Response:", sendMail);
|
|
53
|
+
console.log("Email Response: ", sendMail);
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
**Parameters explained:**
|
|
@@ -65,6 +65,37 @@ console.log("Email Response:", sendMail);
|
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
68
|
+
```ts
|
|
69
|
+
// 📤 Send a Template Email
|
|
70
|
+
const sendMail = await mailClient.sendTemplateMail({
|
|
71
|
+
from: "app@example.com",
|
|
72
|
+
to: ["user@example.com"],
|
|
73
|
+
template: {
|
|
74
|
+
name: "my-template-name",
|
|
75
|
+
data: {
|
|
76
|
+
customer: {
|
|
77
|
+
name: "Ricardo Castle",
|
|
78
|
+
email: "doe@gmail.com"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
console.log("Email Response: ", sendMail);
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Parameters explained:**
|
|
89
|
+
|
|
90
|
+
| Property | Type | Description |
|
|
91
|
+
| --------------- | -------- | ------------------------------------------------------------------------ |
|
|
92
|
+
| `from` | string | Sender email address. Must be a verified domain in your Kumbify account. |
|
|
93
|
+
| `to` | string[] | List of recipient email addresses. |
|
|
94
|
+
| `template.name` | string | Name of the template created in your Kumbify dashboard. |
|
|
95
|
+
| `template.data` | object | Dynamic data that will be injected into the template. |
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
68
99
|
### SMS — KSMSClient
|
|
69
100
|
|
|
70
101
|
#### 📍 Create an SMS Client
|
|
@@ -77,11 +108,10 @@ const smsClient = new KSMSClient({
|
|
|
77
108
|
|
|
78
109
|
```ts
|
|
79
110
|
// 📤 Send an SMS Message
|
|
80
|
-
|
|
81
111
|
await smsClient.sendSMS({
|
|
82
112
|
message: "Your verification code is 123456",
|
|
83
113
|
from: "kumbify-app",
|
|
84
|
-
to: "+1234567890",
|
|
114
|
+
to: ["+1234567890"],
|
|
85
115
|
});
|
|
86
116
|
|
|
87
117
|
console.log("SMS sent successfully!");
|
|
@@ -93,8 +123,7 @@ console.log("SMS sent successfully!");
|
|
|
93
123
|
| --------- | ------ | ------------------------------------ |
|
|
94
124
|
| `message` | string | SMS content |
|
|
95
125
|
| `from` | string | Sender identifier (visible to users) |
|
|
96
|
-
| `to` | string |
|
|
97
|
-
|
|
126
|
+
| `to` | string | List of recipient phone numbers |
|
|
98
127
|
---
|
|
99
128
|
|
|
100
129
|
### Example Usage All Together
|
|
@@ -120,7 +149,7 @@ await mailClient.sendSimpleMail({
|
|
|
120
149
|
await smsClient.sendSMS({
|
|
121
150
|
message: "Your code is 1234",
|
|
122
151
|
from: "KumbifyApp",
|
|
123
|
-
to: "+1234567890",
|
|
152
|
+
to: ["+1234567890"],
|
|
124
153
|
});
|
|
125
154
|
```
|
|
126
155
|
|
|
@@ -128,14 +157,14 @@ await smsClient.sendSMS({
|
|
|
128
157
|
|
|
129
158
|
### Tips & Best Practices
|
|
130
159
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
160
|
+
- Store your API keys in environment variables (never hardcode them).
|
|
161
|
+
- Always handle promise rejections with `try/catch`.
|
|
162
|
+
- Log or inspect response objects to monitor delivery success.
|
|
134
163
|
|
|
135
164
|
---
|
|
136
165
|
|
|
137
166
|
### Supported Environments
|
|
138
167
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
168
|
+
- Node.js
|
|
169
|
+
- TypeScript
|
|
170
|
+
- Any JavaScript project that supports npm packages
|
package/package.json
CHANGED