@signalhouse-sms/sdk 1.9.0 → 1.11.0
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/package.json +1 -1
- package/src/domains/Agents.js +1 -0
- package/src/domains/Messages.js +61 -33
- package/src/domains/Numbers.js +3 -2
- package/src/domains/Rcs.js +192 -7
- package/src/domains/Registrations.js +3 -2
- package/src/domains/Templates.js +13 -4
- package/types/domains/Agents.d.ts +8 -0
- package/types/domains/Messages.d.ts +60 -33
- package/types/domains/Numbers.d.ts +3 -1
- package/types/domains/Rcs.d.ts +272 -7
- package/types/domains/Registrations.d.ts +3 -2
- package/types/domains/Templates.d.ts +50 -7
package/types/domains/Rcs.d.ts
CHANGED
|
@@ -43,6 +43,23 @@
|
|
|
43
43
|
* @property {string} [email] - An individual's business email
|
|
44
44
|
* @property {string} [mobile] - Mobile number, E.164
|
|
45
45
|
*/
|
|
46
|
+
/**
|
|
47
|
+
* One recipient of an RCS send.
|
|
48
|
+
* @typedef {Object} RcsRecipient
|
|
49
|
+
* @property {string} phoneNumber - The number, 10-15 digits, with or without the +
|
|
50
|
+
* @property {Object<string, string>} [variables] - Template variable values for this recipient
|
|
51
|
+
* @property {string} [clientMessageId] - Your reference for this message (max 128)
|
|
52
|
+
* @property {Object<string, string>} [metadata] - Your key-value data (up to 20 keys, values up to 500 characters)
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* What an RCS send does when RCS cannot reach a recipient.
|
|
56
|
+
* @typedef {Object} RcsMessageFallback
|
|
57
|
+
* @property {("auto"|"rcs_only"|"sms_only")} [mode] - The fallback mode
|
|
58
|
+
* @property {("auto"|"sms"|"mms")} [channel] - The fallback channel
|
|
59
|
+
* @property {string} [from] - The sender: a Ready number on the agent's linked Active campaign
|
|
60
|
+
* @property {{ text: string, mediaUrls?: string[] }} [content] - The fallback text; omitted, the template's fallback, else a generated one, is used
|
|
61
|
+
* @property {number} [validitySeconds] - How long the fallback message stays valid, in seconds
|
|
62
|
+
*/
|
|
46
63
|
/**
|
|
47
64
|
* Build the multipart form for an agent image upload.
|
|
48
65
|
* @param {Object} params - Form fields
|
|
@@ -57,7 +74,7 @@ export function agentAssetForm({ kind, file, fileName }: {
|
|
|
57
74
|
fileName?: string;
|
|
58
75
|
}): FormData;
|
|
59
76
|
/**
|
|
60
|
-
* RCS agents under /rcs/agent. An agent links one
|
|
77
|
+
* RCS agents under /rcs/agent. An agent links one brand and one campaign, of any registration type: the campaign's numbers are the
|
|
61
78
|
* SMS fallback, and the brand and campaign supply the company identity and consent text for the carrier launch.
|
|
62
79
|
* One brand or campaign can serve many agents. An agent is a registration (type RCS_AGENT, id RCSA…), so the
|
|
63
80
|
* registrations methods read and edit the same record. 404 while the environment's RCS switch is off; 400 while the
|
|
@@ -68,13 +85,13 @@ export class RcsAgents {
|
|
|
68
85
|
client: any;
|
|
69
86
|
multipartClient: any;
|
|
70
87
|
/**
|
|
71
|
-
* Create an agent draft on a
|
|
88
|
+
* Create an agent draft on a brand, optionally with its campaign. The agent's subgroup is the brand's.
|
|
72
89
|
* Blank consent fields fill from the linked campaign. Pass options.idempotencyKey to make a retry safe.
|
|
73
90
|
* @async
|
|
74
91
|
* @roles api, admin, developer, billing, user
|
|
75
92
|
* @param {Object} params - The agent
|
|
76
|
-
* @param {string} params.brandId - The
|
|
77
|
-
* @param {string|null} [params.campaignId] - A
|
|
93
|
+
* @param {string} params.brandId - The brand: carrier brand ID, provisional UUID or _id
|
|
94
|
+
* @param {string|null} [params.campaignId] - A campaign of that brand: campaign ID or _id; required before submit
|
|
78
95
|
* @param {RcsAgentProfile} [params.agent] - The agent profile
|
|
79
96
|
* @param {RcsAgentConsent} [params.consent] - The launch text; required in full before the launch request
|
|
80
97
|
* @param {RcsAgentContact} [params.contact] - The launch contact; required in full before the launch request
|
|
@@ -111,8 +128,8 @@ export class RcsAgents {
|
|
|
111
128
|
* @param {string} [params.groupId] - Filter by group ID
|
|
112
129
|
* @param {string} [params.subgroupId] - Filter by subgroup ID
|
|
113
130
|
* @param {string|string[]} [params.status] - DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING or ARCHIVED, one or a list
|
|
114
|
-
* @param {string} [params.brandId] - Agents linked to this
|
|
115
|
-
* @param {string} [params.campaignId] - Agents linked to this
|
|
131
|
+
* @param {string} [params.brandId] - Agents linked to this brand (carrier brand ID, provisional UUID or _id)
|
|
132
|
+
* @param {string} [params.campaignId] - Agents linked to this campaign (campaign ID or _id)
|
|
116
133
|
* @param {number} [params.page] - Page number (default 1)
|
|
117
134
|
* @param {number} [params.limit] - Agents per page (default 25, max 100)
|
|
118
135
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
@@ -150,7 +167,7 @@ export class RcsAgents {
|
|
|
150
167
|
* @roles api, admin, developer, billing, user
|
|
151
168
|
* @param {Object} params - The edit
|
|
152
169
|
* @param {string} params.agentId - The agent ID
|
|
153
|
-
* @param {string} [params.brandId] - Relink to another
|
|
170
|
+
* @param {string} [params.brandId] - Relink to another brand of the same subgroup
|
|
154
171
|
* @param {string|null} [params.campaignId] - Link, relink or (null) unlink the campaign
|
|
155
172
|
* @param {RcsAgentProfile} [params.agent] - Profile fields to change
|
|
156
173
|
* @param {RcsAgentConsent} [params.consent] - Consent fields to change
|
|
@@ -212,6 +229,7 @@ export class RcsAgents {
|
|
|
212
229
|
* PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
|
|
213
230
|
* CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
|
|
214
231
|
* "REGISTRATION_INCOMPLETE", errors, warnings }. Sends POST /registration/:agentId/launch: the agent is a registration.
|
|
232
|
+
* The request charges the agent's launch fees: a wallet that cannot cover them gets a 402, and the agent stays where it is. The agent's launchFees quotes what the next request charges.
|
|
215
233
|
* @async
|
|
216
234
|
* @roles api, admin, developer, billing, user
|
|
217
235
|
* @param {Object} params - The launch request
|
|
@@ -273,12 +291,206 @@ export class RcsAgents {
|
|
|
273
291
|
options?: RequestOptions;
|
|
274
292
|
}): Promise<SdkResponse<any>>;
|
|
275
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* RCS messages. Sends go through an agent to POST /message/rcs. A message is a Message record (messageType RCS), so the
|
|
296
|
+
* messages methods read the same record. 404 while the environment's RCS switch is off; 403 while the group's rcsEnabled
|
|
297
|
+
* flag is off; 409 while the agent cannot send yet.
|
|
298
|
+
*/
|
|
299
|
+
export class RcsMessages {
|
|
300
|
+
/**
|
|
301
|
+
* Keep the JSON client every RCS message request goes through.
|
|
302
|
+
* @param {any} client - The JSON request client
|
|
303
|
+
*/
|
|
304
|
+
constructor(client: any);
|
|
305
|
+
client: any;
|
|
306
|
+
/**
|
|
307
|
+
* Send an RCS message to up to 100 recipients. A check that blocks one recipient writes a BLOCKED message for it and the
|
|
308
|
+
* rest still send. Pass options.idempotencyKey to make a retry safe.
|
|
309
|
+
* @async
|
|
310
|
+
* @roles api, admin, developer, billing, user
|
|
311
|
+
* @param {Object} params - The send
|
|
312
|
+
* @param {string} params.agentId - The agent that sends (RCSA…)
|
|
313
|
+
* @param {RcsRecipient[]} params.recipients - Up to 100 recipients
|
|
314
|
+
* @param {string} [params.templateId] - A template to send; exactly one of templateId or content
|
|
315
|
+
* @param {number} [params.templateVersion] - A published version of templateId; needs templateId
|
|
316
|
+
* @param {Object} [params.content] - Inline content; exactly one of templateId or content
|
|
317
|
+
* @param {string} [params.contentFormat] - content.v1 (default) or google.rcs
|
|
318
|
+
* @param {("AUTHENTICATION"|"TRANSACTION"|"SERVICEREQUEST"|"ACKNOWLEDGEMENT"|"PROMOTION")} [params.trafficType] - Required on a MULTI_USE agent when the template sets none
|
|
319
|
+
* @param {number} [params.ttlSeconds] - Seconds the RCS message may wait for delivery; at most one of ttlSeconds or expireTime
|
|
320
|
+
* @param {string} [params.expireTime] - ISO-8601 time the RCS message expires
|
|
321
|
+
* @param {RcsMessageFallback} [params.fallback] - The fallback for this send
|
|
322
|
+
* @param {string} [params.statusCallbackUrl] - URL that receives this message's status events
|
|
323
|
+
* @param {boolean} [params.enableShortlink] - Shorten the links in the message
|
|
324
|
+
* @param {boolean} [params.isTest] - Send as a test; approved testers only
|
|
325
|
+
* @param {("not_capable"|"ttl_expired"|"delivered"|"read")} [params.simulate] - Simulate this outcome; approved testers only
|
|
326
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
327
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { requested, enqueued, failed, bulkId, messages } (201). A blocked row carries blockReason, reason and issues; an archived template answers 409 TEMPLATE_ARCHIVED
|
|
328
|
+
*/
|
|
329
|
+
send({ agentId, recipients, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, statusCallbackUrl, enableShortlink, isTest, simulate, options }: {
|
|
330
|
+
agentId: string;
|
|
331
|
+
recipients: RcsRecipient[];
|
|
332
|
+
templateId?: string;
|
|
333
|
+
templateVersion?: number;
|
|
334
|
+
content?: any;
|
|
335
|
+
contentFormat?: string;
|
|
336
|
+
trafficType?: ("AUTHENTICATION" | "TRANSACTION" | "SERVICEREQUEST" | "ACKNOWLEDGEMENT" | "PROMOTION");
|
|
337
|
+
ttlSeconds?: number;
|
|
338
|
+
expireTime?: string;
|
|
339
|
+
fallback?: RcsMessageFallback;
|
|
340
|
+
statusCallbackUrl?: string;
|
|
341
|
+
enableShortlink?: boolean;
|
|
342
|
+
isTest?: boolean;
|
|
343
|
+
simulate?: ("not_capable" | "ttl_expired" | "delivered" | "read");
|
|
344
|
+
options?: RequestOptions;
|
|
345
|
+
}): Promise<SdkResponse<any>>;
|
|
346
|
+
/**
|
|
347
|
+
* Check a send without writing anything. Takes the same parameters as send.
|
|
348
|
+
* @async
|
|
349
|
+
* @roles api, admin, developer, billing, user
|
|
350
|
+
* @param {Object} params - The send to check
|
|
351
|
+
* @param {string} params.agentId - The agent that sends (RCSA…)
|
|
352
|
+
* @param {RcsRecipient[]} params.recipients - Up to 100 recipients
|
|
353
|
+
* @param {string} [params.templateId] - A template to send; exactly one of templateId or content
|
|
354
|
+
* @param {number} [params.templateVersion] - A published version of templateId; needs templateId
|
|
355
|
+
* @param {Object} [params.content] - Inline content; exactly one of templateId or content
|
|
356
|
+
* @param {string} [params.contentFormat] - content.v1 (default) or google.rcs
|
|
357
|
+
* @param {("AUTHENTICATION"|"TRANSACTION"|"SERVICEREQUEST"|"ACKNOWLEDGEMENT"|"PROMOTION")} [params.trafficType] - Required on a MULTI_USE agent when the template sets none
|
|
358
|
+
* @param {number} [params.ttlSeconds] - Seconds the RCS message may wait for delivery; at most one of ttlSeconds or expireTime
|
|
359
|
+
* @param {string} [params.expireTime] - ISO-8601 time the RCS message expires
|
|
360
|
+
* @param {RcsMessageFallback} [params.fallback] - The fallback for this send
|
|
361
|
+
* @param {string} [params.statusCallbackUrl] - URL that receives this message's status events
|
|
362
|
+
* @param {boolean} [params.enableShortlink] - Shorten the links in the message
|
|
363
|
+
* @param {boolean} [params.isTest] - Send as a test; approved testers only
|
|
364
|
+
* @param {("not_capable"|"ttl_expired"|"delivered"|"read")} [params.simulate] - Simulate this outcome; approved testers only
|
|
365
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
366
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { valid, errors, warnings, billingClass, segments, estimatedCostMicros, unsupportedFiles, recipients }. valid is true only with no errors; each blocked recipient adds an error and carries blockReason, reason and issues
|
|
367
|
+
*/
|
|
368
|
+
validate({ agentId, recipients, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, statusCallbackUrl, enableShortlink, isTest, simulate, options }: {
|
|
369
|
+
agentId: string;
|
|
370
|
+
recipients: RcsRecipient[];
|
|
371
|
+
templateId?: string;
|
|
372
|
+
templateVersion?: number;
|
|
373
|
+
content?: any;
|
|
374
|
+
contentFormat?: string;
|
|
375
|
+
trafficType?: ("AUTHENTICATION" | "TRANSACTION" | "SERVICEREQUEST" | "ACKNOWLEDGEMENT" | "PROMOTION");
|
|
376
|
+
ttlSeconds?: number;
|
|
377
|
+
expireTime?: string;
|
|
378
|
+
fallback?: RcsMessageFallback;
|
|
379
|
+
statusCallbackUrl?: string;
|
|
380
|
+
enableShortlink?: boolean;
|
|
381
|
+
isTest?: boolean;
|
|
382
|
+
simulate?: ("not_capable" | "ttl_expired" | "delivered" | "read");
|
|
383
|
+
options?: RequestOptions;
|
|
384
|
+
}): Promise<SdkResponse<any>>;
|
|
385
|
+
/**
|
|
386
|
+
* Price an RCS draft; no charge or send. Sends POST /message/estimate with channel "rcs". Amounts are microdollars.
|
|
387
|
+
* @async
|
|
388
|
+
* @roles api, admin, developer, billing, user
|
|
389
|
+
* @param {Object} params - The draft
|
|
390
|
+
* @param {string} params.agentId - The agent that would send (RCSA…)
|
|
391
|
+
* @param {RcsRecipient[]} [params.recipients] - Named recipients; exactly one of recipients or recipientCount
|
|
392
|
+
* @param {number} [params.recipientCount] - A recipient count; carriers are unknown, so the default fees apply
|
|
393
|
+
* @param {string} [params.templateId] - A template to price; exactly one of templateId or content
|
|
394
|
+
* @param {number} [params.templateVersion] - A published version of templateId; needs templateId
|
|
395
|
+
* @param {Object} [params.content] - Inline content; exactly one of templateId or content
|
|
396
|
+
* @param {string} [params.contentFormat] - content.v1 (default) or google.rcs
|
|
397
|
+
* @param {("AUTHENTICATION"|"TRANSACTION"|"SERVICEREQUEST"|"ACKNOWLEDGEMENT"|"PROMOTION")} [params.trafficType] - Required on a MULTI_USE agent when the template sets none
|
|
398
|
+
* @param {number} [params.ttlSeconds] - Seconds the RCS message may wait for delivery; at most one of ttlSeconds or expireTime
|
|
399
|
+
* @param {string} [params.expireTime] - ISO-8601 time the RCS message expires
|
|
400
|
+
* @param {RcsMessageFallback} [params.fallback] - The fallback to price; its from is optional here, and with none the leg is priced on the channel of the agent's linked campaign
|
|
401
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
402
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB, already inside rcsLeg.cost; a message over 100 MB adds a MEDIA_TOO_LARGE issue.
|
|
403
|
+
*/
|
|
404
|
+
estimate({ agentId, recipients, recipientCount, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, options }: {
|
|
405
|
+
agentId: string;
|
|
406
|
+
recipients?: RcsRecipient[];
|
|
407
|
+
recipientCount?: number;
|
|
408
|
+
templateId?: string;
|
|
409
|
+
templateVersion?: number;
|
|
410
|
+
content?: any;
|
|
411
|
+
contentFormat?: string;
|
|
412
|
+
trafficType?: ("AUTHENTICATION" | "TRANSACTION" | "SERVICEREQUEST" | "ACKNOWLEDGEMENT" | "PROMOTION");
|
|
413
|
+
ttlSeconds?: number;
|
|
414
|
+
expireTime?: string;
|
|
415
|
+
fallback?: RcsMessageFallback;
|
|
416
|
+
options?: RequestOptions;
|
|
417
|
+
}): Promise<SdkResponse<any>>;
|
|
418
|
+
/**
|
|
419
|
+
* Report which numbers can receive RCS from an agent
|
|
420
|
+
* @async
|
|
421
|
+
* @roles api, admin, developer, billing, user
|
|
422
|
+
* @param {Object} params - The lookup
|
|
423
|
+
* @param {string} params.agentId - The agent (RCSA…)
|
|
424
|
+
* @param {string[]} params.phoneNumbers - Up to 500 numbers, 10-15 digits, with or without the +
|
|
425
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
426
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { results: [{ phoneNumber, capability }] }, capability being ENABLED, UNREACHABLE or UNKNOWN
|
|
427
|
+
*/
|
|
428
|
+
capabilities({ agentId, phoneNumbers, options }: {
|
|
429
|
+
agentId: string;
|
|
430
|
+
phoneNumbers: string[];
|
|
431
|
+
options?: RequestOptions;
|
|
432
|
+
}): Promise<SdkResponse<any>>;
|
|
433
|
+
/**
|
|
434
|
+
* Get one message by its ID. The same route as messages.getMessage.
|
|
435
|
+
* @async
|
|
436
|
+
* @roles api, admin, developer, billing, user
|
|
437
|
+
* @param {Object} params - The lookup
|
|
438
|
+
* @param {string} params.messageId - The message ID
|
|
439
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
440
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the message; an unknown ID is a 404
|
|
441
|
+
*/
|
|
442
|
+
get({ messageId, options }: {
|
|
443
|
+
messageId: string;
|
|
444
|
+
options?: RequestOptions;
|
|
445
|
+
}): Promise<SdkResponse<any>>;
|
|
446
|
+
/**
|
|
447
|
+
* List RCS messages. Sends GET /message with messageType RCS. A fallback leg is an SMS or MMS message: read it with
|
|
448
|
+
* messages.getMessage and the parent's fallbackMessageId.
|
|
449
|
+
* @async
|
|
450
|
+
* @roles api, admin, developer, billing, user
|
|
451
|
+
* @param {Object} params - The group, the date range and the filters
|
|
452
|
+
* @param {string} params.groupId - The group whose messages to list
|
|
453
|
+
* @param {string} params.from - ISO-8601 date or timestamp; sent as startDate
|
|
454
|
+
* @param {string} params.to - ISO-8601 date or timestamp; sent as endDate
|
|
455
|
+
* @param {string} [params.agentId] - Messages this agent sent; sent as registrationId
|
|
456
|
+
* @param {string} [params.status] - Filter by status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED, READ, EXPIRED, FALLBACK, BLOCKED)
|
|
457
|
+
* @param {number} [params.page] - Page number
|
|
458
|
+
* @param {number} [params.limit] - Messages per page
|
|
459
|
+
* @param {string} [params.templateId] - Messages sent from this template
|
|
460
|
+
* @param {number} [params.templateVersion] - Messages sent from this template version
|
|
461
|
+
* @param {string} [params.bulkId] - Messages of one send
|
|
462
|
+
* @param {string} [params.fallbackReason] - Why the fallback ran (NOT_CAPABLE, CARRIER_NOT_LAUNCHED, TTL_EXPIRED, RCS_ERROR, PROVIDER_ERROR, SMS_ONLY)
|
|
463
|
+
* @param {string} [params.billingClass] - Filter by billing class (RICH, RICH_MEDIA)
|
|
464
|
+
* @param {string} [params.deliveredChannel] - Filter by the channel that delivered the message (rcs, sms, mms)
|
|
465
|
+
* @param {boolean} [params.isTest] - true for test messages only, false to leave them out
|
|
466
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
467
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the list of messages
|
|
468
|
+
*/
|
|
469
|
+
list({ groupId, from, to, agentId, status, page, limit, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, options }: {
|
|
470
|
+
groupId: string;
|
|
471
|
+
from: string;
|
|
472
|
+
to: string;
|
|
473
|
+
agentId?: string;
|
|
474
|
+
status?: string;
|
|
475
|
+
page?: number;
|
|
476
|
+
limit?: number;
|
|
477
|
+
templateId?: string;
|
|
478
|
+
templateVersion?: number;
|
|
479
|
+
bulkId?: string;
|
|
480
|
+
fallbackReason?: string;
|
|
481
|
+
billingClass?: string;
|
|
482
|
+
deliveredChannel?: string;
|
|
483
|
+
isTest?: boolean;
|
|
484
|
+
options?: RequestOptions;
|
|
485
|
+
}): Promise<SdkResponse<any>>;
|
|
486
|
+
}
|
|
276
487
|
/**
|
|
277
488
|
* RCS (Google RBM) resources. Templates for RCS live under `templates`.
|
|
278
489
|
*/
|
|
279
490
|
export class Rcs {
|
|
280
491
|
constructor(client: any, multipartClient: any);
|
|
281
492
|
agents: RcsAgents;
|
|
493
|
+
messages: RcsMessages;
|
|
282
494
|
}
|
|
283
495
|
export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
|
|
284
496
|
export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|
|
@@ -407,3 +619,56 @@ export type RcsAgentContact = {
|
|
|
407
619
|
*/
|
|
408
620
|
mobile?: string;
|
|
409
621
|
};
|
|
622
|
+
/**
|
|
623
|
+
* One recipient of an RCS send.
|
|
624
|
+
*/
|
|
625
|
+
export type RcsRecipient = {
|
|
626
|
+
/**
|
|
627
|
+
* - The number, 10-15 digits, with or without the +
|
|
628
|
+
*/
|
|
629
|
+
phoneNumber: string;
|
|
630
|
+
/**
|
|
631
|
+
* - Template variable values for this recipient
|
|
632
|
+
*/
|
|
633
|
+
variables?: {
|
|
634
|
+
[x: string]: string;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* - Your reference for this message (max 128)
|
|
638
|
+
*/
|
|
639
|
+
clientMessageId?: string;
|
|
640
|
+
/**
|
|
641
|
+
* - Your key-value data (up to 20 keys, values up to 500 characters)
|
|
642
|
+
*/
|
|
643
|
+
metadata?: {
|
|
644
|
+
[x: string]: string;
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* What an RCS send does when RCS cannot reach a recipient.
|
|
649
|
+
*/
|
|
650
|
+
export type RcsMessageFallback = {
|
|
651
|
+
/**
|
|
652
|
+
* - The fallback mode
|
|
653
|
+
*/
|
|
654
|
+
mode?: ("auto" | "rcs_only" | "sms_only");
|
|
655
|
+
/**
|
|
656
|
+
* - The fallback channel
|
|
657
|
+
*/
|
|
658
|
+
channel?: ("auto" | "sms" | "mms");
|
|
659
|
+
/**
|
|
660
|
+
* - The sender: a Ready number on the agent's linked Active campaign
|
|
661
|
+
*/
|
|
662
|
+
from?: string;
|
|
663
|
+
/**
|
|
664
|
+
* - The fallback text; omitted, the template's fallback, else a generated one, is used
|
|
665
|
+
*/
|
|
666
|
+
content?: {
|
|
667
|
+
text: string;
|
|
668
|
+
mediaUrls?: string[];
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* - How long the fallback message stays valid, in seconds
|
|
672
|
+
*/
|
|
673
|
+
validitySeconds?: number;
|
|
674
|
+
};
|
|
@@ -141,8 +141,8 @@ export class Registrations {
|
|
|
141
141
|
* @param {string|string[]} [params.status] - Filter by one registration status or a list
|
|
142
142
|
* @param {string} [params.parentRegistrationId] - Filter by the parent registration ID
|
|
143
143
|
* @param {string} [params.phoneNumber] - Filter to registrations holding this phone number
|
|
144
|
-
* @param {string} [params.brandId] - RCS agents only: filter to agents linked to this
|
|
145
|
-
* @param {string} [params.campaignId] - RCS agents only: filter to agents linked to this
|
|
144
|
+
* @param {string} [params.brandId] - RCS agents only: filter to agents linked to this brand (carrier id, provisional UUID or _id)
|
|
145
|
+
* @param {string} [params.campaignId] - RCS agents only: filter to agents linked to this campaign (campaign id or _id)
|
|
146
146
|
* @param {string} [params.sortBy] - Sort field: createdAt (default), subgroupId, registrationId, region or status
|
|
147
147
|
* @param {string} [params.sortOrder] - Sort direction: asc or desc (default)
|
|
148
148
|
* @param {number} [params.page] - Page number (default 1)
|
|
@@ -232,6 +232,7 @@ export class Registrations {
|
|
|
232
232
|
* Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
|
|
233
233
|
* carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
|
|
234
234
|
* { code: "REGISTRATION_INCOMPLETE", errors, warnings }.
|
|
235
|
+
* An RCS agent's launch request charges its launch fees: a wallet that cannot cover them gets a 402, and nothing changes.
|
|
235
236
|
* @async
|
|
236
237
|
* @roles api, admin, developer, billing, user
|
|
237
238
|
* @param {Object} params - The parameters for the launch request
|
|
@@ -60,7 +60,7 @@ export class Templates {
|
|
|
60
60
|
* @param {string} [params.tag] - Tag (1-60 characters)
|
|
61
61
|
* @param {RcsTemplateBody} params.body - The raw template body
|
|
62
62
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
63
|
-
* @returns {Promise<SdkResponse<
|
|
63
|
+
* @returns {Promise<SdkResponse<SavedTemplate>>} A promise that resolves to { head, version, validation } (201). The draft saves even when validation lists errors
|
|
64
64
|
*/
|
|
65
65
|
create({ groupId, name, tag, body, options }: {
|
|
66
66
|
groupId: string;
|
|
@@ -68,7 +68,7 @@ export class Templates {
|
|
|
68
68
|
tag?: string;
|
|
69
69
|
body: RcsTemplateBody;
|
|
70
70
|
options?: RequestOptions;
|
|
71
|
-
}): Promise<SdkResponse<
|
|
71
|
+
}): Promise<SdkResponse<SavedTemplate>>;
|
|
72
72
|
/**
|
|
73
73
|
* List a group's templates
|
|
74
74
|
* @async
|
|
@@ -126,7 +126,7 @@ export class Templates {
|
|
|
126
126
|
* @param {string|null} [params.tag] - New tag; null clears it, omitted leaves it unchanged
|
|
127
127
|
* @param {RcsTemplateBody} [params.body] - Full replacement body
|
|
128
128
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
129
|
-
* @returns {Promise<SdkResponse<
|
|
129
|
+
* @returns {Promise<SdkResponse<SavedTemplate>>} A promise that resolves to { head, version, validation }. The draft saves even when validation lists errors
|
|
130
130
|
*/
|
|
131
131
|
update({ templateId, groupId, name, tag, body, options }: {
|
|
132
132
|
templateId: string;
|
|
@@ -135,7 +135,7 @@ export class Templates {
|
|
|
135
135
|
tag?: string | null;
|
|
136
136
|
body?: RcsTemplateBody;
|
|
137
137
|
options?: RequestOptions;
|
|
138
|
-
}): Promise<SdkResponse<
|
|
138
|
+
}): Promise<SdkResponse<SavedTemplate>>;
|
|
139
139
|
/**
|
|
140
140
|
* Publish a template's current draft; no draft returns 409 NO_DRAFT, a draft changed mid-publish returns 409 DRAFT_CHANGED (publish again) and an incomplete draft returns 400 TEMPLATE_INVALID
|
|
141
141
|
* @async
|
|
@@ -144,13 +144,15 @@ export class Templates {
|
|
|
144
144
|
* @param {string} params.templateId - The template ID
|
|
145
145
|
* @param {string} params.groupId - The owning group
|
|
146
146
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
147
|
-
* @returns {Promise<SdkResponse<TemplateDetail>>} A promise that resolves to { head, version } for the published version
|
|
147
|
+
* @returns {Promise<SdkResponse<TemplateDetail & { warnings: ValidationIssue[] }>>} A promise that resolves to { head, version, warnings } for the published version
|
|
148
148
|
*/
|
|
149
149
|
publish({ templateId, groupId, options }: {
|
|
150
150
|
templateId: string;
|
|
151
151
|
groupId: string;
|
|
152
152
|
options?: RequestOptions;
|
|
153
|
-
}): Promise<SdkResponse<TemplateDetail
|
|
153
|
+
}): Promise<SdkResponse<TemplateDetail & {
|
|
154
|
+
warnings: ValidationIssue[];
|
|
155
|
+
}>>;
|
|
154
156
|
/**
|
|
155
157
|
* Archive a template
|
|
156
158
|
* @async
|
|
@@ -490,6 +492,16 @@ export type ValidationResult = {
|
|
|
490
492
|
*/
|
|
491
493
|
warnings: ValidationIssue[];
|
|
492
494
|
};
|
|
495
|
+
/**
|
|
496
|
+
* What a save returns: the template, and what would stop it publishing. `validation` is null when the checks could not run.
|
|
497
|
+
*/
|
|
498
|
+
export type SavedTemplate = TemplateDetail & {
|
|
499
|
+
validation: {
|
|
500
|
+
valid: boolean;
|
|
501
|
+
errors: ValidationIssue[];
|
|
502
|
+
warnings: ValidationIssue[];
|
|
503
|
+
} | null;
|
|
504
|
+
};
|
|
493
505
|
export type MediaAsset = {
|
|
494
506
|
/**
|
|
495
507
|
* - "MED" + 10 characters
|
|
@@ -573,11 +585,42 @@ export type Capabilities = {
|
|
|
573
585
|
*/
|
|
574
586
|
mediaHeights: string[];
|
|
575
587
|
/**
|
|
576
|
-
* - Length and count limits (maxBlocks, maxTextLength, maxCarouselCards, ...)
|
|
588
|
+
* - Length and count limits (maxBlocks, maxTextLength, maxCarouselCards, maxRecipients, ...)
|
|
577
589
|
*/
|
|
578
590
|
limits: {
|
|
579
591
|
[x: string]: number;
|
|
580
592
|
};
|
|
593
|
+
/**
|
|
594
|
+
* - Per traffic type: the default time to live and its range, in seconds
|
|
595
|
+
*/
|
|
596
|
+
ttlPresets: {
|
|
597
|
+
[x: string]: {
|
|
598
|
+
seconds: number;
|
|
599
|
+
min: number;
|
|
600
|
+
max: number;
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* - The traffic types each agent use case may send
|
|
605
|
+
*/
|
|
606
|
+
trafficByUseCase: {
|
|
607
|
+
[x: string]: string[];
|
|
608
|
+
};
|
|
609
|
+
/**
|
|
610
|
+
* - The traffic type a single-purpose agent sends when a request names none
|
|
611
|
+
*/
|
|
612
|
+
defaultTrafficByUseCase: {
|
|
613
|
+
[x: string]: string;
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* - How an iPhone lays out RCS content
|
|
617
|
+
*/
|
|
618
|
+
ios: {
|
|
619
|
+
cardButtonsInline: number;
|
|
620
|
+
suggestedActionsInline: number;
|
|
621
|
+
linesPerField: number;
|
|
622
|
+
charsPerLine: number;
|
|
623
|
+
};
|
|
581
624
|
/**
|
|
582
625
|
* - Upload constraints
|
|
583
626
|
*/
|