@signalhouse-sms/sdk 1.9.0 → 1.10.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/Messages.js +61 -33
- package/src/domains/Rcs.js +192 -7
- package/src/domains/Registrations.js +3 -2
- package/src/domains/Templates.js +13 -4
- package/types/domains/Messages.d.ts +60 -33
- package/types/domains/Rcs.d.ts +272 -7
- package/types/domains/Registrations.d.ts +3 -2
- package/types/domains/Templates.d.ts +50 -7
|
@@ -25,12 +25,12 @@ export class Messages {
|
|
|
25
25
|
* @param {string} [params.subgroupId] - Filter messages by the ID of the associated subgroup
|
|
26
26
|
* @param {string} [params.groupId] - Filter messages by the ID of the associated group
|
|
27
27
|
* @param {string|string[]} [params.registrationId] - Filter to messages attributed to these registrations. Cannot be combined with campaignId; each id must belong to the group. Accepts a single value or an array.
|
|
28
|
-
* @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED)
|
|
28
|
+
* @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED; RCS messages also READ, EXPIRED, FALLBACK, BLOCKED)
|
|
29
29
|
* @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
|
|
30
30
|
* @param {string|string[]} [params.messageType] - Filter messages by their type. Accepts a single value or an array (e.g. ["SMS", "MMS"]). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types.
|
|
31
|
-
* @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, virtualLongCode, tollFree, shortCode, p2p. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
|
|
32
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
33
|
-
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
31
|
+
* @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, virtualLongCode, tollFree, shortCode, p2p, rcs. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
|
|
32
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
33
|
+
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
34
34
|
* @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (a message matches ANY of them) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
|
|
35
35
|
* @param {string} [params.carrier] - Filter messages by the carrier used for sending
|
|
36
36
|
* @param {string|string[]} [params.sentimentLabel] - Filter messages by sentiment bucket. Accepts a single value or an array (e.g. ["positive", "negative"]). Allowed values: positive, neutral, negative. Applied as the sentimentScore range the ±25 label threshold produces, so unscored messages match no bucket and outbound messages (never scored) are excluded.
|
|
@@ -45,12 +45,19 @@ export class Messages {
|
|
|
45
45
|
* @param {number} [params.page] - The page number for pagination
|
|
46
46
|
* @param {number} [params.limit] - The number of messages per page
|
|
47
47
|
* @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
|
|
48
|
+
* @param {string} [params.templateId] - RCS messages sent from this template
|
|
49
|
+
* @param {number} [params.templateVersion] - RCS messages sent from this template version
|
|
50
|
+
* @param {string} [params.bulkId] - The RCS messages of one send
|
|
51
|
+
* @param {string} [params.fallbackReason] - Why an RCS message ran its fallback (NOT_CAPABLE, CARRIER_NOT_LAUNCHED, TTL_EXPIRED, RCS_ERROR, PROVIDER_ERROR, SMS_ONLY)
|
|
52
|
+
* @param {string} [params.billingClass] - Filter by RCS billing class (RICH, RICH_MEDIA)
|
|
53
|
+
* @param {string} [params.deliveredChannel] - Filter by the channel that delivered an RCS message (rcs, sms, mms)
|
|
54
|
+
* @param {boolean} [params.isTest] - true for RCS test messages only, false to leave them out
|
|
48
55
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
49
56
|
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages. Inbound messages also carry
|
|
50
57
|
* sentimentScore (-100..100, null when unscored), sentimentLabel ("positive"|"neutral"|"negative", null when
|
|
51
58
|
* sentimentScore is null) and sentimentScoredAt. Outbound messages are never scored.
|
|
52
59
|
*/
|
|
53
|
-
getMessages({ id, campaignId, brandId, subgroupId, groupId, registrationId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, region, regionScopes, matchAny, carrier, sentimentLabel, errorCode, startDate, endDate, sortField, sortOrder, page, limit, dateBounds, options, }: {
|
|
60
|
+
getMessages({ id, campaignId, brandId, subgroupId, groupId, registrationId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, region, regionScopes, matchAny, carrier, sentimentLabel, errorCode, startDate, endDate, sortField, sortOrder, page, limit, dateBounds, templateId, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel, isTest, options, }: {
|
|
54
61
|
id?: string;
|
|
55
62
|
campaignId?: string;
|
|
56
63
|
brandId?: string;
|
|
@@ -77,6 +84,27 @@ export class Messages {
|
|
|
77
84
|
page?: number;
|
|
78
85
|
limit?: number;
|
|
79
86
|
dateBounds?: ("day" | "exact");
|
|
87
|
+
templateId?: string;
|
|
88
|
+
templateVersion?: number;
|
|
89
|
+
bulkId?: string;
|
|
90
|
+
fallbackReason?: string;
|
|
91
|
+
billingClass?: string;
|
|
92
|
+
deliveredChannel?: string;
|
|
93
|
+
isTest?: boolean;
|
|
94
|
+
options?: RequestOptions;
|
|
95
|
+
}): Promise<SdkResponse<any>>;
|
|
96
|
+
/**
|
|
97
|
+
* Get one message of any type by its ID
|
|
98
|
+
* @async
|
|
99
|
+
* @roles api, admin, developer, billing, user
|
|
100
|
+
* @param {Object} params - The parameters for getting a message
|
|
101
|
+
* @param {string} params.id - The message ID
|
|
102
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
103
|
+
* @throws {Error} Throws an error if the id parameter is missing
|
|
104
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the message; an unknown ID is a 404
|
|
105
|
+
*/
|
|
106
|
+
getMessage({ id, options }: {
|
|
107
|
+
id: string;
|
|
80
108
|
options?: RequestOptions;
|
|
81
109
|
}): Promise<SdkResponse<any>>;
|
|
82
110
|
/**
|
|
@@ -105,17 +133,17 @@ export class Messages {
|
|
|
105
133
|
* @param {string|string[]} [params.subgroupId] - Filter analytics by the ID of the associated subgroup. Accepts a single value, an array, or a comma-separated string.
|
|
106
134
|
* @param {string|string[]} [params.brandId] - Filter analytics by the ID of the associated brand. Accepts a single value, an array, or a comma-separated string.
|
|
107
135
|
* @param {string|string[]} [params.campaignId] - Filter analytics by the ID of the associated campaign. Accepts a single value, an array, or a comma-separated string.
|
|
108
|
-
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations
|
|
136
|
+
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
|
|
109
137
|
* @param {string|string[]} [params.phoneNumber] - Filter analytics by the phone number involved in the messages. Accepts a single value, an array, or a comma-separated string.
|
|
110
138
|
* @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
|
|
111
|
-
* @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string.
|
|
139
|
+
* @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string.
|
|
112
140
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode
|
|
113
141
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back
|
|
114
142
|
* @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (match ANY) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
|
|
115
143
|
* @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
|
|
116
144
|
* @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, virtualLongCode, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here (matched by carrier). Accepts a single value or an array. Ignored when matchAny is true (matchAny takes precedence).
|
|
117
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
118
|
-
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
145
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
146
|
+
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
119
147
|
* @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
|
|
120
148
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
121
149
|
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the analytics data. Also includes inbound-message
|
|
@@ -155,18 +183,18 @@ export class Messages {
|
|
|
155
183
|
* @param {string|string[]} [params.subgroupId] - Filter analytics by the ID of the associated subgroup. Accepts a single value, an array, or a comma-separated string.
|
|
156
184
|
* @param {string|string[]} [params.brandId] - Filter analytics by the ID of the associated brand. Accepts a single value, an array, or a comma-separated string.
|
|
157
185
|
* @param {string|string[]} [params.campaignId] - Filter analytics by the ID of the associated campaign. Accepts a single value, an array, or a comma-separated string.
|
|
158
|
-
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations
|
|
186
|
+
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
|
|
159
187
|
* @param {string|string[]} [params.phoneNumber] - Filter analytics by the phone number involved in the messages. Accepts a single value, an array, or a comma-separated string.
|
|
160
188
|
* @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
|
|
161
|
-
* @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string.
|
|
189
|
+
* @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics). Accepts a single value, an array, or a comma-separated string.
|
|
162
190
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp. It is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode, then floored to the start of its hour at either granularity, because the hourly cube is keyed by hour and a mid-hour start would drop that hour's bucket.
|
|
163
191
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp. At day granularity it is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back; at hour granularity it is honoured as given.
|
|
164
192
|
* @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
|
|
165
193
|
* @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, virtualLongCode, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here. Accepts a single value or an array.
|
|
166
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
167
|
-
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
168
|
-
* @param {("day"|"hour")} [params.granularity] - Time-bucket grain of the byDate rows. Omit for day (each row's _id is a "YYYY-MM-DD" date). "hour" buckets by hour (each row's _id is a "YYYY-MM-DD HH:MM:SS" UTC hour) and is capped to a 7-day span.
|
|
169
|
-
* @param {("carrier"|"carrierFamily")} [params.breakdown] - Adds a byBreakdown time × dimension series to the response ({ dimension, rows }: each row is one byDate bucket (_id) for one carrier or carrier family (key), over the top 50 keys by volume, excluding P2P) and caps the span at 31 days.
|
|
194
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
195
|
+
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
196
|
+
* @param {("day"|"hour")} [params.granularity] - Time-bucket grain of the byDate rows. Omit for day (each row's _id is a "YYYY-MM-DD" date). "hour" buckets by hour (each row's _id is a "YYYY-MM-DD HH:MM:SS" UTC hour) and is capped to a 7-day span.
|
|
197
|
+
* @param {("carrier"|"carrierFamily")} [params.breakdown] - Adds a byBreakdown time × dimension series to the response ({ dimension, rows }: each row is one byDate bucket (_id) for one carrier or carrier family (key), over the top 50 keys by volume, excluding P2P) and caps the span at 31 days.
|
|
170
198
|
* @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
|
|
171
199
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
172
200
|
* @returns {Promise<SdkResponse<Array>>} - A promise that resolves to an array of analytics snapshot records. cardTotals and
|
|
@@ -201,15 +229,14 @@ export class Messages {
|
|
|
201
229
|
* Get per-minute send throughput (peak segments per minute, sending minutes, minutes at a ceiling) for a
|
|
202
230
|
* campaign, brand, or group, per time bucket and per carrier family. Measured from SENT transitions at
|
|
203
231
|
* campaign × carrier-family grain -- the grain carrier ceilings are enforced at -- so a peak here is the
|
|
204
|
-
* figure a ceiling is compared against.
|
|
205
|
-
* elsewhere the request is rejected with a 400.
|
|
232
|
+
* figure a ceiling is compared against.
|
|
206
233
|
* @async
|
|
207
234
|
* @roles api, admin, developer, billing, user
|
|
208
235
|
* @param {Object} params - The parameters for the throughput read
|
|
209
236
|
* @param {string} params.groupId - The group to scope the read to (required)
|
|
210
237
|
* @param {string|string[]} [params.brandId] - Brand scope. Accepts a single value, an array, or a comma-separated string.
|
|
211
238
|
* @param {string|string[]} [params.campaignId] - Campaign scope; wins over brandId. Accepts a single value, an array, or a comma-separated string.
|
|
212
|
-
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations
|
|
239
|
+
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. Accepts a single value or an array.
|
|
213
240
|
* @param {string|string[]} [params.carrierFamily] - Carrier-family filter (ATT, TMobile, Verizon, USCellular, ...). Accepts a single value, an array, or a comma-separated string.
|
|
214
241
|
* @param {string} params.startDate - ISO-8601 date or timestamp. It is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode, then floored to the start of its hour at hour granularity and of its minute at day granularity (the cube is keyed by minute).
|
|
215
242
|
* @param {string} params.endDate - ISO-8601 date or timestamp. At hour granularity it is honoured as given; at day granularity it is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back. The span is capped at 35 days (the retention of the per-minute data).
|
|
@@ -239,7 +266,7 @@ export class Messages {
|
|
|
239
266
|
* @roles api, admin, developer, billing, user
|
|
240
267
|
* @param {Object} params - The parameters for getting analytics filter options
|
|
241
268
|
* @param {string} params.groupId - The ID of the group whose filter options to load
|
|
242
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
269
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
243
270
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
244
271
|
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to { subgroups, brands, campaigns, phoneNumbers, carriers }. Each phone number carries type (TOLL_FREE, SHORT_CODE, ALPHANUMERIC, VIRTUAL_LONG_NUMBER, ...) and country (ISO-2), null when unknown: TOLL_FREE, SHORT_CODE and ALPHANUMERIC are channels by type; any other US number is 10DLC and a non-US one is a Virtual Long Code. `carriers` is a plain array of carrier name strings.
|
|
245
272
|
*/
|
|
@@ -258,10 +285,10 @@ export class Messages {
|
|
|
258
285
|
* @param {string|string[]} [params.subgroupId]
|
|
259
286
|
* @param {string|string[]} [params.brandId]
|
|
260
287
|
* @param {string|string[]} [params.campaignId]
|
|
261
|
-
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations
|
|
288
|
+
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
|
|
262
289
|
* @param {string|string[]} [params.phoneNumber]
|
|
263
290
|
* @param {string|string[]} [params.carrier]
|
|
264
|
-
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated.
|
|
291
|
+
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated.
|
|
265
292
|
* @param {string} [params.startDate]
|
|
266
293
|
* @param {string} [params.endDate]
|
|
267
294
|
* @param {number} [params.page=1]
|
|
@@ -269,8 +296,8 @@ export class Messages {
|
|
|
269
296
|
* @param {("tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means all activity. tenDLC/virtualLongCode/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s).
|
|
270
297
|
* @param {(string|string[])} [params.messageType] - Message type(s) the SENTIMENT figures are scoped to: SMS, MMS or P2P (single value, array, or comma-separated string). Omit for all scored types. Does NOT narrow the message counts, which are always returned split per type (smsInbound/mmsInbound/p2pInbound) and have no filterable type dimension.
|
|
271
298
|
* @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
|
|
272
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
273
|
-
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
299
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
300
|
+
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
274
301
|
* @param {RequestOptions} [params.options]
|
|
275
302
|
* @returns {Promise<SdkResponse<any>>} - { rows, totalCount, page, limit }. Each row carries sms/mms/p2p metric columns plus `smsOptOuts` and `mmsOptOuts` from the DNC analytics MV (P2P has no opt-outs).
|
|
276
303
|
* Each row also carries that subgroup's inbound-message sentiment: `sentimentScore` (volume-weighted average of every scored inbound message in that subgroup, -100..100, null when nothing was scored), `sentimentLabel`, `sentimentScoredCount`, `sentimentPositive`, `sentimentNeutral`, `sentimentNegative`, plus the same six per message type under `smsSentiment*`, `mmsSentiment*` and `p2pSentiment*` prefixes. The score is derived server-side and must never be re-averaged across rows — combine the counts, not the scores.
|
|
@@ -305,18 +332,18 @@ export class Messages {
|
|
|
305
332
|
* @param {string|string[]} [params.subgroupId]
|
|
306
333
|
* @param {string|string[]} [params.brandId]
|
|
307
334
|
* @param {string|string[]} [params.campaignId]
|
|
308
|
-
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations
|
|
335
|
+
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
|
|
309
336
|
* @param {string|string[]} [params.phoneNumber]
|
|
310
337
|
* @param {string|string[]} [params.carrier]
|
|
311
|
-
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated.
|
|
338
|
+
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics); single value, array, or comma-separated.
|
|
312
339
|
* @param {string} [params.startDate]
|
|
313
340
|
* @param {string} [params.endDate]
|
|
314
341
|
* @param {number} [params.page=1]
|
|
315
342
|
* @param {number} [params.limit=50] - max 50 per page
|
|
316
343
|
* @param {("tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"virtualLongCode"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means every code. tenDLC/virtualLongCode/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s); when one channel is selected, totalErrors reflects only that channel.
|
|
317
344
|
* @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
|
|
318
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
319
|
-
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
345
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
346
|
+
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
320
347
|
* @param {string} [params.errorCode] - Narrow the breakdown to a single failure reason: a numeric Infobip carrier code (as a string, e.g. "607"), the Signal House campaign-opt-out code "OUT", or a no-code failure class (other, moderation, att_limit, p2p_stop, campaign_opt_out, dnc_blocked, bind_hold_expired). Omitted = every reason.
|
|
321
348
|
* @param {RequestOptions} [params.options]
|
|
322
349
|
* @returns {Promise<SdkResponse<any>>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
|
|
@@ -350,15 +377,15 @@ export class Messages {
|
|
|
350
377
|
* @param {string} [params.subgroupId] - Filter by the ID of the associated subgroup
|
|
351
378
|
* @param {string} [params.brandId] - Filter by the ID of the associated brand
|
|
352
379
|
* @param {string} [params.campaignId] - Filter by the ID of the associated campaign
|
|
353
|
-
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations
|
|
380
|
+
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
|
|
354
381
|
* @param {string} [params.phoneNumber] - Filter by the phone number
|
|
355
382
|
* @param {string} [params.carrier] - Filter by the carrier
|
|
356
383
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode
|
|
357
384
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode. In "exact" mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back
|
|
358
385
|
* @param {string|string[]} [params.channel] - Filter by channel (tenDLC, virtualLongCode, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
|
|
359
386
|
* @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
|
|
360
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
361
|
-
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
387
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
388
|
+
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
362
389
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
363
390
|
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the DNC analytics data (totals, byDate, byPhoneNumber, bySenderNumber, byCampaign, bySubgroup, byType, byCarrier, byKeyword). bySenderNumber ({ senderPhoneNumber, total, sms, mms }) attributes each opt-out to the first business number that received it, so it is unchanged by later campaign moves and START replies. byCampaign ({ campaignId, ... }) counts campaign-scoped opt-outs only, by the campaign at the time of the STOP; subgroup-scoped opt-outs (non-US recipients) are never attributed to a campaign and appear under bySubgroup ({ subgroupId, ... }) instead. byType ({ messageType, total }) splits SMS/MMS. byKeyword breaks opt-outs down by the normalized keyword that revoked consent ({ optOutKeyword, total, sms, mms }); opt-outs recorded before keyword capture shipped appear as a single optOutKeyword: null bucket ("not recorded"). The distinct keyword set is open-ended (campaigns register their own keywords beyond the mandatory floor) — render top-N plus Other, never a fixed list.
|
|
364
391
|
*/
|
|
@@ -387,7 +414,7 @@ export class Messages {
|
|
|
387
414
|
* @param {string} [params.subgroupId] - Filter by the ID of the associated subgroup
|
|
388
415
|
* @param {string} [params.brandId] - Filter by the ID of the associated brand
|
|
389
416
|
* @param {string} [params.campaignId] - Filter by the ID of the associated campaign
|
|
390
|
-
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations
|
|
417
|
+
* @param {string|string[]} [params.registrationId] - Filter to traffic attributed to these registrations. A phoneNumber filter takes precedence. Accepts a single value or an array.
|
|
391
418
|
* @param {string} [params.phoneNumber] - Filter by the phone number
|
|
392
419
|
* @param {string} [params.carrier] - Filter by the carrier
|
|
393
420
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in "day" mode and bound as the instant it names, in whatever offset it was written, in "exact" mode
|
|
@@ -398,8 +425,8 @@ export class Messages {
|
|
|
398
425
|
* @param {string} [params.sortOrder] - Sort direction (asc, desc)
|
|
399
426
|
* @param {string|string[]} [params.channel] - Filter by channel (tenDLC, virtualLongCode, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
|
|
400
427
|
* @param {("day"|"exact")} [params.dateBounds] - Which contract binds startDate/endDate. "day": each bound is widened to its whole UTC day. "exact": a timestamp is bound as the instant it names and a bare date is its whole UTC day. Omitted: "day".
|
|
401
|
-
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
402
|
-
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
428
|
+
* @param {string|string[]} [params.region] - ISO-2 country filter: US, GB or CA (any case of UK/GB/GBR/United Kingdom is accepted for GB); one value, an array, or a comma-separated string; omitted = every region.
|
|
429
|
+
* @param {Object[]|string} [params.regionScopes] - Array of OR-ed branches `{ region, channels, brandId?, campaignId?, phoneNumber? }` (channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p); `[]` matches nothing. Sent as JSON unless already a string.
|
|
403
430
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
404
431
|
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the paginated DNC records. Each record carries senderPhoneNumber — the first business number that received the opt-out (set once, never changed by a later STOP or a campaign move; the same value as phoneNumber) — optOutKeyword — the normalized keyword that revoked consent (e.g. "stop", "opt out"; a repeat opt-out records the most recent word), null for opt-outs recorded before keyword capture shipped — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Standard, IceWireless, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
|
|
405
432
|
*/
|
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
|