btechworks-sdk 1.0.3 → 1.0.6
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 +40 -4
- package/dist/index.d.mts +40 -11
- package/dist/index.d.ts +40 -11
- package/dist/index.js +51 -9
- package/dist/index.mjs +51 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -54,6 +54,15 @@ await client.sendVideo({ phone: '+1234567890', videoUrl: 'https://example.com/vi
|
|
|
54
54
|
|
|
55
55
|
// Send document
|
|
56
56
|
await client.sendDocument({ phone: '+1234567890', documentUrl: 'https://example.com/file.pdf', filename: 'file.pdf' });
|
|
57
|
+
|
|
58
|
+
// Send CTA URL button (Click-to-Chat)
|
|
59
|
+
await client.sendCtcUrl({
|
|
60
|
+
phone: '+1234567890',
|
|
61
|
+
bodyText: 'Need help? Chat with us on WhatsApp!',
|
|
62
|
+
displayText: 'Chat Now',
|
|
63
|
+
url: 'https://wa.me/919999999999?text=Hi%20I%20need%20help',
|
|
64
|
+
footerText: 'We reply within 5 minutes',
|
|
65
|
+
});
|
|
57
66
|
```
|
|
58
67
|
|
|
59
68
|
### Templates
|
|
@@ -78,13 +87,36 @@ const result = await client.sendTemplate({
|
|
|
78
87
|
### Broadcast
|
|
79
88
|
|
|
80
89
|
```typescript
|
|
90
|
+
// Send to specific phone numbers
|
|
81
91
|
const result = await client.broadcast({
|
|
82
92
|
name: 'Summer Sale',
|
|
83
93
|
templateName: 'summer_offer',
|
|
84
94
|
templateLanguage: 'en_US',
|
|
85
95
|
recipients: ['+1234567890', '+0987654321'],
|
|
96
|
+
templateVariables: { name: 'User', offer: '50% OFF' },
|
|
97
|
+
});
|
|
98
|
+
// { success: true, message: 'Template "summer_offer" processed: 20 sent, 5 failed', sent: 20, failed: 5 }
|
|
99
|
+
|
|
100
|
+
// Send to contacts filtered by tags
|
|
101
|
+
await client.broadcast({
|
|
102
|
+
name: 'Premium Users',
|
|
103
|
+
templateName: 'vip_offer',
|
|
104
|
+
templateVariables: { name: 'VIP User' },
|
|
105
|
+
audienceFilter: { tags: ['premium', 'vip'] },
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Broadcast from Excel/CSV file
|
|
109
|
+
import { readFileSync } from 'fs';
|
|
110
|
+
const file = new File([readFileSync('contacts.xlsx')], 'contacts.xlsx', {
|
|
111
|
+
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
await client.broadcastFromSheet({
|
|
115
|
+
name: 'Bulk Broadcast',
|
|
116
|
+
templateName: 'offer',
|
|
117
|
+
templateVariables: { name: 'User' },
|
|
118
|
+
file,
|
|
86
119
|
});
|
|
87
|
-
// { success: true, message: 'Template "summer_offer" processed: 20 sent, 5 failed' }
|
|
88
120
|
```
|
|
89
121
|
|
|
90
122
|
### Wallet
|
|
@@ -92,11 +124,11 @@ const result = await client.broadcast({
|
|
|
92
124
|
```typescript
|
|
93
125
|
// Check balance
|
|
94
126
|
const balance = await client.getBalance();
|
|
95
|
-
// { success: true, balance: 100, can_send: 100 }
|
|
127
|
+
// { success: true, balance: 100, template_rate: 1, can_send: 100 }
|
|
96
128
|
|
|
97
129
|
// Estimate cost before sending
|
|
98
130
|
const estimate = await client.estimateCost(50);
|
|
99
|
-
// { success: true, balance: 100, can_send: 100, estimated_templates: 50 }
|
|
131
|
+
// { success: true, balance: 100, can_send: 100, estimated_templates: 50, estimated_cost: 50 }
|
|
100
132
|
|
|
101
133
|
// Generate payment link (user opens link to pay)
|
|
102
134
|
const link = await client.rechargeViaLink({
|
|
@@ -107,6 +139,10 @@ const link = await client.rechargeViaLink({
|
|
|
107
139
|
// { success: true, link_url: 'https://cashfree.com/pay/...', order_amount: 500 }
|
|
108
140
|
// User opens link_url and pays via Card/UPI
|
|
109
141
|
|
|
142
|
+
// Verify payment after Cashfree redirect
|
|
143
|
+
const verify = await client.verifyOrder('wallet_1234567890_abc123');
|
|
144
|
+
// { success: true, status: 'PAID', balance: 500, message: '₹500 added to your wallet' }
|
|
145
|
+
|
|
110
146
|
// Get transaction history
|
|
111
147
|
const txns = await client.getTransactions(10, 0);
|
|
112
148
|
// { success: true, transactions: [...] }
|
|
@@ -143,7 +179,7 @@ All methods return a simple response object. **No exceptions are thrown.**
|
|
|
143
179
|
{ success: true, sent_as: 'template', balance: 99 }
|
|
144
180
|
|
|
145
181
|
// Broadcast
|
|
146
|
-
{ success: true, message: 'Template "promo" processed: 20 sent,
|
|
182
|
+
{ success: true, message: 'Template "promo" processed: 20 sent, 5 failed', sent: 20, failed: 5, refunded: 5 }
|
|
147
183
|
```
|
|
148
184
|
|
|
149
185
|
## Error Handling
|
package/dist/index.d.mts
CHANGED
|
@@ -24,6 +24,13 @@ interface SendDocumentOptions {
|
|
|
24
24
|
filename?: string;
|
|
25
25
|
caption?: string;
|
|
26
26
|
}
|
|
27
|
+
interface SendCtcUrlOptions {
|
|
28
|
+
phone: string;
|
|
29
|
+
bodyText: string;
|
|
30
|
+
displayText: string;
|
|
31
|
+
url: string;
|
|
32
|
+
footerText?: string;
|
|
33
|
+
}
|
|
27
34
|
interface SendTemplateOptions {
|
|
28
35
|
phone: string;
|
|
29
36
|
templateName: string;
|
|
@@ -59,6 +66,21 @@ interface ApiResponse {
|
|
|
59
66
|
interface BroadcastResponse {
|
|
60
67
|
success: boolean;
|
|
61
68
|
message: string;
|
|
69
|
+
sent?: number;
|
|
70
|
+
failed?: number;
|
|
71
|
+
skipped?: number;
|
|
72
|
+
refunded?: number;
|
|
73
|
+
}
|
|
74
|
+
interface BroadcastSheetResponse {
|
|
75
|
+
success: boolean;
|
|
76
|
+
message: string;
|
|
77
|
+
total_rows?: number;
|
|
78
|
+
valid_recipients?: number;
|
|
79
|
+
new_contacts?: number;
|
|
80
|
+
sent?: number;
|
|
81
|
+
failed?: number;
|
|
82
|
+
skipped?: number;
|
|
83
|
+
refunded?: number;
|
|
62
84
|
}
|
|
63
85
|
interface CheckTemplateOptions {
|
|
64
86
|
templateName: string;
|
|
@@ -88,15 +110,6 @@ interface WalletBalanceResponse {
|
|
|
88
110
|
is_active?: boolean;
|
|
89
111
|
message: string;
|
|
90
112
|
}
|
|
91
|
-
interface AddCreditsOptions {
|
|
92
|
-
amount: number;
|
|
93
|
-
description?: string;
|
|
94
|
-
}
|
|
95
|
-
interface AddCreditsResponse {
|
|
96
|
-
success: boolean;
|
|
97
|
-
balance?: number;
|
|
98
|
-
message: string;
|
|
99
|
-
}
|
|
100
113
|
interface Transaction {
|
|
101
114
|
type: 'credit' | 'debit' | 'refund';
|
|
102
115
|
amount: number;
|
|
@@ -141,6 +154,14 @@ interface EstimateCostResponse {
|
|
|
141
154
|
template_rate?: number;
|
|
142
155
|
can_send?: number;
|
|
143
156
|
estimated_templates?: number;
|
|
157
|
+
estimated_cost?: number;
|
|
158
|
+
can_send_templates?: number;
|
|
159
|
+
message: string;
|
|
160
|
+
}
|
|
161
|
+
interface VerifyOrderResponse {
|
|
162
|
+
success: boolean;
|
|
163
|
+
status?: string;
|
|
164
|
+
balance?: number;
|
|
144
165
|
message: string;
|
|
145
166
|
}
|
|
146
167
|
interface Broadcast {
|
|
@@ -180,14 +201,22 @@ declare class BTechWorksClient {
|
|
|
180
201
|
sendPhoto(options: SendPhotoOptions): Promise<ApiResponse>;
|
|
181
202
|
sendVideo(options: SendVideoOptions): Promise<ApiResponse>;
|
|
182
203
|
sendDocument(options: SendDocumentOptions): Promise<ApiResponse>;
|
|
204
|
+
sendCtcUrl(options: SendCtcUrlOptions): Promise<ApiResponse>;
|
|
183
205
|
sendTemplate(options: SendTemplateOptions): Promise<SendTemplateResponse>;
|
|
184
206
|
broadcast(options: BroadcastOptions): Promise<BroadcastResponse>;
|
|
207
|
+
broadcastFromSheet(options: {
|
|
208
|
+
name: string;
|
|
209
|
+
templateName: string;
|
|
210
|
+
templateLanguage?: string;
|
|
211
|
+
templateVariables?: Record<string, string>;
|
|
212
|
+
file: File;
|
|
213
|
+
}): Promise<BroadcastSheetResponse>;
|
|
185
214
|
getBalance(): Promise<WalletBalanceResponse>;
|
|
186
215
|
estimateCost(count?: number): Promise<EstimateCostResponse>;
|
|
187
|
-
addCredits(options: AddCreditsOptions): Promise<AddCreditsResponse>;
|
|
188
216
|
recharge(options: RechargeOptions): Promise<RechargeResponse>;
|
|
189
217
|
rechargeViaLink(options: RechargeOptions): Promise<RechargeViaLinkResponse>;
|
|
218
|
+
verifyOrder(orderId: string): Promise<VerifyOrderResponse>;
|
|
190
219
|
getTransactions(limit?: number, offset?: number): Promise<TransactionsResponse>;
|
|
191
220
|
}
|
|
192
221
|
|
|
193
|
-
export { type
|
|
222
|
+
export { type Analytics, type AnalyticsResponse, type ApiResponse, BTechWorksClient, type BTechWorksConfig, type Broadcast, type BroadcastOptions, type BroadcastResponse, type BroadcastSheetResponse, type CheckTemplateOptions, type CheckTemplateResponse, type EstimateCostResponse, type RechargeOptions, type RechargeResponse, type RechargeViaLinkResponse, type SendCtcUrlOptions, type SendDocumentOptions, type SendMessageOptions, type SendPhotoOptions, type SendTemplateOptions, type SendTemplateResponse, type SendVideoOptions, type TemplateVariable, type Transaction, type TransactionsResponse, type VerifyOrderResponse, type WalletBalanceResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,13 @@ interface SendDocumentOptions {
|
|
|
24
24
|
filename?: string;
|
|
25
25
|
caption?: string;
|
|
26
26
|
}
|
|
27
|
+
interface SendCtcUrlOptions {
|
|
28
|
+
phone: string;
|
|
29
|
+
bodyText: string;
|
|
30
|
+
displayText: string;
|
|
31
|
+
url: string;
|
|
32
|
+
footerText?: string;
|
|
33
|
+
}
|
|
27
34
|
interface SendTemplateOptions {
|
|
28
35
|
phone: string;
|
|
29
36
|
templateName: string;
|
|
@@ -59,6 +66,21 @@ interface ApiResponse {
|
|
|
59
66
|
interface BroadcastResponse {
|
|
60
67
|
success: boolean;
|
|
61
68
|
message: string;
|
|
69
|
+
sent?: number;
|
|
70
|
+
failed?: number;
|
|
71
|
+
skipped?: number;
|
|
72
|
+
refunded?: number;
|
|
73
|
+
}
|
|
74
|
+
interface BroadcastSheetResponse {
|
|
75
|
+
success: boolean;
|
|
76
|
+
message: string;
|
|
77
|
+
total_rows?: number;
|
|
78
|
+
valid_recipients?: number;
|
|
79
|
+
new_contacts?: number;
|
|
80
|
+
sent?: number;
|
|
81
|
+
failed?: number;
|
|
82
|
+
skipped?: number;
|
|
83
|
+
refunded?: number;
|
|
62
84
|
}
|
|
63
85
|
interface CheckTemplateOptions {
|
|
64
86
|
templateName: string;
|
|
@@ -88,15 +110,6 @@ interface WalletBalanceResponse {
|
|
|
88
110
|
is_active?: boolean;
|
|
89
111
|
message: string;
|
|
90
112
|
}
|
|
91
|
-
interface AddCreditsOptions {
|
|
92
|
-
amount: number;
|
|
93
|
-
description?: string;
|
|
94
|
-
}
|
|
95
|
-
interface AddCreditsResponse {
|
|
96
|
-
success: boolean;
|
|
97
|
-
balance?: number;
|
|
98
|
-
message: string;
|
|
99
|
-
}
|
|
100
113
|
interface Transaction {
|
|
101
114
|
type: 'credit' | 'debit' | 'refund';
|
|
102
115
|
amount: number;
|
|
@@ -141,6 +154,14 @@ interface EstimateCostResponse {
|
|
|
141
154
|
template_rate?: number;
|
|
142
155
|
can_send?: number;
|
|
143
156
|
estimated_templates?: number;
|
|
157
|
+
estimated_cost?: number;
|
|
158
|
+
can_send_templates?: number;
|
|
159
|
+
message: string;
|
|
160
|
+
}
|
|
161
|
+
interface VerifyOrderResponse {
|
|
162
|
+
success: boolean;
|
|
163
|
+
status?: string;
|
|
164
|
+
balance?: number;
|
|
144
165
|
message: string;
|
|
145
166
|
}
|
|
146
167
|
interface Broadcast {
|
|
@@ -180,14 +201,22 @@ declare class BTechWorksClient {
|
|
|
180
201
|
sendPhoto(options: SendPhotoOptions): Promise<ApiResponse>;
|
|
181
202
|
sendVideo(options: SendVideoOptions): Promise<ApiResponse>;
|
|
182
203
|
sendDocument(options: SendDocumentOptions): Promise<ApiResponse>;
|
|
204
|
+
sendCtcUrl(options: SendCtcUrlOptions): Promise<ApiResponse>;
|
|
183
205
|
sendTemplate(options: SendTemplateOptions): Promise<SendTemplateResponse>;
|
|
184
206
|
broadcast(options: BroadcastOptions): Promise<BroadcastResponse>;
|
|
207
|
+
broadcastFromSheet(options: {
|
|
208
|
+
name: string;
|
|
209
|
+
templateName: string;
|
|
210
|
+
templateLanguage?: string;
|
|
211
|
+
templateVariables?: Record<string, string>;
|
|
212
|
+
file: File;
|
|
213
|
+
}): Promise<BroadcastSheetResponse>;
|
|
185
214
|
getBalance(): Promise<WalletBalanceResponse>;
|
|
186
215
|
estimateCost(count?: number): Promise<EstimateCostResponse>;
|
|
187
|
-
addCredits(options: AddCreditsOptions): Promise<AddCreditsResponse>;
|
|
188
216
|
recharge(options: RechargeOptions): Promise<RechargeResponse>;
|
|
189
217
|
rechargeViaLink(options: RechargeOptions): Promise<RechargeViaLinkResponse>;
|
|
218
|
+
verifyOrder(orderId: string): Promise<VerifyOrderResponse>;
|
|
190
219
|
getTransactions(limit?: number, offset?: number): Promise<TransactionsResponse>;
|
|
191
220
|
}
|
|
192
221
|
|
|
193
|
-
export { type
|
|
222
|
+
export { type Analytics, type AnalyticsResponse, type ApiResponse, BTechWorksClient, type BTechWorksConfig, type Broadcast, type BroadcastOptions, type BroadcastResponse, type BroadcastSheetResponse, type CheckTemplateOptions, type CheckTemplateResponse, type EstimateCostResponse, type RechargeOptions, type RechargeResponse, type RechargeViaLinkResponse, type SendCtcUrlOptions, type SendDocumentOptions, type SendMessageOptions, type SendPhotoOptions, type SendTemplateOptions, type SendTemplateResponse, type SendVideoOptions, type TemplateVariable, type Transaction, type TransactionsResponse, type VerifyOrderResponse, type WalletBalanceResponse };
|
package/dist/index.js
CHANGED
|
@@ -129,6 +129,18 @@ var BTechWorksClient = class {
|
|
|
129
129
|
})
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
+
async sendCtcUrl(options) {
|
|
133
|
+
return this.request("/api/sdk/send-ctc-url", {
|
|
134
|
+
method: "POST",
|
|
135
|
+
body: JSON.stringify({
|
|
136
|
+
phone: options.phone,
|
|
137
|
+
body_text: options.bodyText,
|
|
138
|
+
display_text: options.displayText,
|
|
139
|
+
url: options.url,
|
|
140
|
+
footer_text: options.footerText
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
132
144
|
async sendTemplate(options) {
|
|
133
145
|
return this.request("/api/sdk/send-template", {
|
|
134
146
|
method: "POST",
|
|
@@ -154,6 +166,40 @@ var BTechWorksClient = class {
|
|
|
154
166
|
})
|
|
155
167
|
});
|
|
156
168
|
}
|
|
169
|
+
async broadcastFromSheet(options) {
|
|
170
|
+
const formData = new FormData();
|
|
171
|
+
formData.append("name", options.name);
|
|
172
|
+
formData.append("template_name", options.templateName);
|
|
173
|
+
if (options.templateLanguage) formData.append("template_language", options.templateLanguage);
|
|
174
|
+
if (options.templateVariables) formData.append("template_variables", JSON.stringify(options.templateVariables));
|
|
175
|
+
formData.append("file", options.file);
|
|
176
|
+
const url = `${this.baseUrl}/api/sdk/broadcast-sheet`;
|
|
177
|
+
const controller = new AbortController();
|
|
178
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
179
|
+
try {
|
|
180
|
+
const response = await globalThis.fetch(url, {
|
|
181
|
+
method: "POST",
|
|
182
|
+
headers: {
|
|
183
|
+
"x-api-key": this.apiKey,
|
|
184
|
+
"x-secret-key": this.secretKey
|
|
185
|
+
},
|
|
186
|
+
body: formData,
|
|
187
|
+
signal: controller.signal
|
|
188
|
+
});
|
|
189
|
+
const data = await response.json();
|
|
190
|
+
return data;
|
|
191
|
+
} catch (error) {
|
|
192
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
193
|
+
return { success: false, message: "Request timeout" };
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
success: false,
|
|
197
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
198
|
+
};
|
|
199
|
+
} finally {
|
|
200
|
+
clearTimeout(timeoutId);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
157
203
|
async getBalance() {
|
|
158
204
|
return this.request("/api/sdk/wallet/balance", {
|
|
159
205
|
method: "GET"
|
|
@@ -164,15 +210,6 @@ var BTechWorksClient = class {
|
|
|
164
210
|
method: "GET"
|
|
165
211
|
});
|
|
166
212
|
}
|
|
167
|
-
async addCredits(options) {
|
|
168
|
-
return this.request("/api/sdk/wallet/add-credits", {
|
|
169
|
-
method: "POST",
|
|
170
|
-
body: JSON.stringify({
|
|
171
|
-
amount: options.amount,
|
|
172
|
-
description: options.description
|
|
173
|
-
})
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
213
|
async recharge(options) {
|
|
177
214
|
return this.request("/api/sdk/wallet/recharge", {
|
|
178
215
|
method: "POST",
|
|
@@ -193,6 +230,11 @@ var BTechWorksClient = class {
|
|
|
193
230
|
})
|
|
194
231
|
});
|
|
195
232
|
}
|
|
233
|
+
async verifyOrder(orderId) {
|
|
234
|
+
return this.request(`/api/sdk/wallet/verify-order?order_id=${encodeURIComponent(orderId)}`, {
|
|
235
|
+
method: "GET"
|
|
236
|
+
});
|
|
237
|
+
}
|
|
196
238
|
async getTransactions(limit, offset) {
|
|
197
239
|
const params = new URLSearchParams();
|
|
198
240
|
if (limit) params.set("limit", limit.toString());
|
package/dist/index.mjs
CHANGED
|
@@ -103,6 +103,18 @@ var BTechWorksClient = class {
|
|
|
103
103
|
})
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
+
async sendCtcUrl(options) {
|
|
107
|
+
return this.request("/api/sdk/send-ctc-url", {
|
|
108
|
+
method: "POST",
|
|
109
|
+
body: JSON.stringify({
|
|
110
|
+
phone: options.phone,
|
|
111
|
+
body_text: options.bodyText,
|
|
112
|
+
display_text: options.displayText,
|
|
113
|
+
url: options.url,
|
|
114
|
+
footer_text: options.footerText
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
}
|
|
106
118
|
async sendTemplate(options) {
|
|
107
119
|
return this.request("/api/sdk/send-template", {
|
|
108
120
|
method: "POST",
|
|
@@ -128,6 +140,40 @@ var BTechWorksClient = class {
|
|
|
128
140
|
})
|
|
129
141
|
});
|
|
130
142
|
}
|
|
143
|
+
async broadcastFromSheet(options) {
|
|
144
|
+
const formData = new FormData();
|
|
145
|
+
formData.append("name", options.name);
|
|
146
|
+
formData.append("template_name", options.templateName);
|
|
147
|
+
if (options.templateLanguage) formData.append("template_language", options.templateLanguage);
|
|
148
|
+
if (options.templateVariables) formData.append("template_variables", JSON.stringify(options.templateVariables));
|
|
149
|
+
formData.append("file", options.file);
|
|
150
|
+
const url = `${this.baseUrl}/api/sdk/broadcast-sheet`;
|
|
151
|
+
const controller = new AbortController();
|
|
152
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
153
|
+
try {
|
|
154
|
+
const response = await globalThis.fetch(url, {
|
|
155
|
+
method: "POST",
|
|
156
|
+
headers: {
|
|
157
|
+
"x-api-key": this.apiKey,
|
|
158
|
+
"x-secret-key": this.secretKey
|
|
159
|
+
},
|
|
160
|
+
body: formData,
|
|
161
|
+
signal: controller.signal
|
|
162
|
+
});
|
|
163
|
+
const data = await response.json();
|
|
164
|
+
return data;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
if (error instanceof DOMException && error.name === "AbortError") {
|
|
167
|
+
return { success: false, message: "Request timeout" };
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
success: false,
|
|
171
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
172
|
+
};
|
|
173
|
+
} finally {
|
|
174
|
+
clearTimeout(timeoutId);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
131
177
|
async getBalance() {
|
|
132
178
|
return this.request("/api/sdk/wallet/balance", {
|
|
133
179
|
method: "GET"
|
|
@@ -138,15 +184,6 @@ var BTechWorksClient = class {
|
|
|
138
184
|
method: "GET"
|
|
139
185
|
});
|
|
140
186
|
}
|
|
141
|
-
async addCredits(options) {
|
|
142
|
-
return this.request("/api/sdk/wallet/add-credits", {
|
|
143
|
-
method: "POST",
|
|
144
|
-
body: JSON.stringify({
|
|
145
|
-
amount: options.amount,
|
|
146
|
-
description: options.description
|
|
147
|
-
})
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
187
|
async recharge(options) {
|
|
151
188
|
return this.request("/api/sdk/wallet/recharge", {
|
|
152
189
|
method: "POST",
|
|
@@ -167,6 +204,11 @@ var BTechWorksClient = class {
|
|
|
167
204
|
})
|
|
168
205
|
});
|
|
169
206
|
}
|
|
207
|
+
async verifyOrder(orderId) {
|
|
208
|
+
return this.request(`/api/sdk/wallet/verify-order?order_id=${encodeURIComponent(orderId)}`, {
|
|
209
|
+
method: "GET"
|
|
210
|
+
});
|
|
211
|
+
}
|
|
170
212
|
async getTransactions(limit, offset) {
|
|
171
213
|
const params = new URLSearchParams();
|
|
172
214
|
if (limit) params.set("limit", limit.toString());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "btechworks-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Official BatchWorks WhatsApp CRM SDK - Send messages, photos, videos, documents, templates, and
|
|
3
|
+
"version": "1.0.6",
|
|
4
|
+
"description": "Official BatchWorks WhatsApp CRM SDK - Send messages, photos, videos, documents, templates, broadcasts, and wallet management via API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|