@unboundcx/sdk 4.13.120 → 4.13.121
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
CHANGED
|
@@ -297,13 +297,6 @@ await api.messaging.email.send({
|
|
|
297
297
|
htmlBody: '<h1>Hello World!</h1>',
|
|
298
298
|
});
|
|
299
299
|
|
|
300
|
-
// Templates
|
|
301
|
-
await api.messaging.sms.templates.create({
|
|
302
|
-
name: 'welcome',
|
|
303
|
-
message: 'Welcome {{name}}!',
|
|
304
|
-
variables: { name: 'string' },
|
|
305
|
-
});
|
|
306
|
-
|
|
307
300
|
// Campaign Management
|
|
308
301
|
await api.messaging.campaigns.tollFree.create({
|
|
309
302
|
companyName: 'Acme Corp',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.121",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,7 @@ export class EmailTemplatesService {
|
|
|
22
22
|
* @param {string} [params.text] - Plain text template body
|
|
23
23
|
* @param {Object} [params.design] - Block-tree design JSON (compiled server-side)
|
|
24
24
|
* @param {string} [params.appearance] - `client` or `marketing` (immutable after create)
|
|
25
|
+
* @param {string} [params.emailType] - `marketing` | `sales` | `transactional` (defaults to `marketing`; separate from `appearance`)
|
|
25
26
|
* @param {boolean} [params.allowOneOff] - Usable as a one-off / compose send
|
|
26
27
|
* @param {boolean} [params.allowCampaign] - Usable in campaigns / journeys
|
|
27
28
|
* @param {string} [params.brandKitId] - Brand kit to apply
|
|
@@ -57,6 +58,7 @@ export class EmailTemplatesService {
|
|
|
57
58
|
variables,
|
|
58
59
|
design,
|
|
59
60
|
appearance,
|
|
61
|
+
emailType,
|
|
60
62
|
allowOneOff,
|
|
61
63
|
allowCampaign,
|
|
62
64
|
brandKitId,
|
|
@@ -72,6 +74,7 @@ export class EmailTemplatesService {
|
|
|
72
74
|
variables: { type: 'array', required: false },
|
|
73
75
|
design: { type: 'object', required: false },
|
|
74
76
|
appearance: { type: 'string', required: false },
|
|
77
|
+
emailType: { type: 'string', required: false },
|
|
75
78
|
allowOneOff: { type: 'boolean', required: false },
|
|
76
79
|
allowCampaign: { type: 'boolean', required: false },
|
|
77
80
|
brandKitId: { type: 'string', required: false },
|
|
@@ -88,6 +91,7 @@ export class EmailTemplatesService {
|
|
|
88
91
|
variables,
|
|
89
92
|
design,
|
|
90
93
|
appearance,
|
|
94
|
+
emailType,
|
|
91
95
|
allowOneOff,
|
|
92
96
|
allowCampaign,
|
|
93
97
|
brandKitId,
|
|
@@ -95,7 +99,7 @@ export class EmailTemplatesService {
|
|
|
95
99
|
}),
|
|
96
100
|
};
|
|
97
101
|
|
|
98
|
-
const result = await internalRequest(this.sdk,
|
|
102
|
+
const result = await internalRequest(this.sdk,
|
|
99
103
|
'/messaging/email/template',
|
|
100
104
|
'POST',
|
|
101
105
|
options,
|
|
@@ -114,6 +118,7 @@ export class EmailTemplatesService {
|
|
|
114
118
|
* @param {string} [params.text] - Plain text template body
|
|
115
119
|
* @param {Object} [params.design] - Block-tree design JSON (compiled server-side)
|
|
116
120
|
* @param {string} [params.appearance] - Usually omit; immutable after create
|
|
121
|
+
* @param {string} [params.emailType] - `marketing` | `sales` | `transactional` (not immutable)
|
|
117
122
|
* @param {boolean} [params.allowOneOff] - Usable as a one-off / compose send
|
|
118
123
|
* @param {boolean} [params.allowCampaign] - Usable in campaigns / journeys
|
|
119
124
|
* @param {string} [params.brandKitId] - Brand kit to apply
|
|
@@ -147,6 +152,7 @@ export class EmailTemplatesService {
|
|
|
147
152
|
variables,
|
|
148
153
|
design,
|
|
149
154
|
appearance,
|
|
155
|
+
emailType,
|
|
150
156
|
allowOneOff,
|
|
151
157
|
allowCampaign,
|
|
152
158
|
brandKitId,
|
|
@@ -164,6 +170,7 @@ export class EmailTemplatesService {
|
|
|
164
170
|
variables: { type: 'array', required: false },
|
|
165
171
|
design: { type: 'object', required: false },
|
|
166
172
|
appearance: { type: 'string', required: false },
|
|
173
|
+
emailType: { type: 'string', required: false },
|
|
167
174
|
allowOneOff: { type: 'boolean', required: false },
|
|
168
175
|
allowCampaign: { type: 'boolean', required: false },
|
|
169
176
|
brandKitId: { type: 'string', required: false },
|
|
@@ -180,6 +187,7 @@ export class EmailTemplatesService {
|
|
|
180
187
|
variables,
|
|
181
188
|
design,
|
|
182
189
|
appearance,
|
|
190
|
+
emailType,
|
|
183
191
|
allowOneOff,
|
|
184
192
|
allowCampaign,
|
|
185
193
|
brandKitId,
|
|
@@ -187,7 +195,7 @@ export class EmailTemplatesService {
|
|
|
187
195
|
}),
|
|
188
196
|
};
|
|
189
197
|
|
|
190
|
-
const result = await internalRequest(this.sdk,
|
|
198
|
+
const result = await internalRequest(this.sdk,
|
|
191
199
|
`/messaging/email/template/${id}`,
|
|
192
200
|
'PUT',
|
|
193
201
|
options,
|
package/services/messaging.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Import all extracted services
|
|
2
2
|
import { MessagingService } from './messaging/MessagingService.js';
|
|
3
3
|
import { SmsService } from './messaging/SmsService.js';
|
|
4
|
-
import { SmsTemplatesService } from './messaging/SmsTemplatesService.js';
|
|
5
4
|
import { EmailService } from './messaging/EmailService.js';
|
|
6
5
|
import { EmailTemplatesService } from './messaging/EmailTemplatesService.js';
|
|
7
6
|
import { EmailDomainsService } from './messaging/EmailDomainsService.js';
|
|
@@ -20,7 +19,6 @@ import { EmailSuppressionService } from './messaging/EmailSuppressionService.js'
|
|
|
20
19
|
export {
|
|
21
20
|
MessagingService,
|
|
22
21
|
SmsService,
|
|
23
|
-
SmsTemplatesService,
|
|
24
22
|
EmailService,
|
|
25
23
|
EmailTemplatesService,
|
|
26
24
|
EmailDomainsService,
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { internalRequest } from '../../base.js';
|
|
2
|
-
export class SmsTemplatesService {
|
|
3
|
-
constructor(sdk) {
|
|
4
|
-
this.sdk = sdk;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Create SMS template
|
|
9
|
-
* @param {Object} params - Template parameters
|
|
10
|
-
* @param {string} params.name - Template name (required)
|
|
11
|
-
* @param {string} params.message - Template message (required)
|
|
12
|
-
* @param {Object} [params.variables] - Template variables
|
|
13
|
-
* @returns {Promise<Object>} Created template details
|
|
14
|
-
*/
|
|
15
|
-
async create({ name, message, variables }) {
|
|
16
|
-
this.sdk.validateParams(
|
|
17
|
-
{ name, message },
|
|
18
|
-
{
|
|
19
|
-
name: { type: 'string', required: true },
|
|
20
|
-
message: { type: 'string', required: true },
|
|
21
|
-
variables: { type: 'object', required: false },
|
|
22
|
-
},
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
const templateData = { name, message };
|
|
26
|
-
if (variables) templateData.variables = variables;
|
|
27
|
-
|
|
28
|
-
const options = {
|
|
29
|
-
body: templateData,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const result = await internalRequest(this.sdk,
|
|
33
|
-
'/messaging/sms/templates',
|
|
34
|
-
'POST',
|
|
35
|
-
options,
|
|
36
|
-
);
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Update SMS template
|
|
42
|
-
* @param {string} id - Template ID
|
|
43
|
-
* @param {Object} params - Update parameters
|
|
44
|
-
* @param {string} [params.name] - Template name
|
|
45
|
-
* @param {string} [params.message] - Template message
|
|
46
|
-
* @param {Object} [params.variables] - Template variables
|
|
47
|
-
* @returns {Promise<Object>} Updated template details
|
|
48
|
-
*/
|
|
49
|
-
async update(id, { name, message, variables }) {
|
|
50
|
-
this.sdk.validateParams(
|
|
51
|
-
{ id },
|
|
52
|
-
{
|
|
53
|
-
id: { type: 'string', required: true },
|
|
54
|
-
name: { type: 'string', required: false },
|
|
55
|
-
message: { type: 'string', required: false },
|
|
56
|
-
variables: { type: 'object', required: false },
|
|
57
|
-
},
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const updateData = {};
|
|
61
|
-
if (name) updateData.name = name;
|
|
62
|
-
if (message) updateData.message = message;
|
|
63
|
-
if (variables) updateData.variables = variables;
|
|
64
|
-
|
|
65
|
-
const options = {
|
|
66
|
-
body: updateData,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const result = await internalRequest(this.sdk,
|
|
70
|
-
`/messaging/sms/templates/${id}`,
|
|
71
|
-
'PUT',
|
|
72
|
-
options,
|
|
73
|
-
);
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Delete SMS template
|
|
79
|
-
* @param {string} id - Template ID
|
|
80
|
-
* @returns {Promise<Object>} Deletion result
|
|
81
|
-
*/
|
|
82
|
-
async delete(id) {
|
|
83
|
-
this.sdk.validateParams(
|
|
84
|
-
{ id },
|
|
85
|
-
{
|
|
86
|
-
id: { type: 'string', required: true },
|
|
87
|
-
},
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const result = await internalRequest(this.sdk,
|
|
91
|
-
`/messaging/sms/templates/${id}`,
|
|
92
|
-
'DELETE',
|
|
93
|
-
);
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Get SMS template by ID
|
|
99
|
-
* @param {string} id - Template ID
|
|
100
|
-
* @returns {Promise<Object>} Template details
|
|
101
|
-
*/
|
|
102
|
-
async get(id) {
|
|
103
|
-
this.sdk.validateParams(
|
|
104
|
-
{ id },
|
|
105
|
-
{
|
|
106
|
-
id: { type: 'string', required: true },
|
|
107
|
-
},
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
const result = await internalRequest(this.sdk,
|
|
111
|
-
`/messaging/sms/templates/${id}`,
|
|
112
|
-
'GET',
|
|
113
|
-
);
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* List all SMS templates
|
|
119
|
-
* @returns {Promise<Array>} List of templates
|
|
120
|
-
*/
|
|
121
|
-
async list() {
|
|
122
|
-
const result = await internalRequest(this.sdk, '/messaging/sms/templates', 'GET');
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
}
|