@signalhousellc/sdk 1.0.67 → 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -10
- package/package.json +11 -3
- package/skills/VENDORED.json +8 -8
- package/skills/signalhouse-10dlc/SKILL.md +5 -9
- package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +5 -12
- package/skills/signalhouse-advisor/SKILL.md +3 -3
- package/skills/signalhouse-numbers/SKILL.md +1 -2
- package/skills/signalhouse-setup/SKILL.md +41 -11
- package/skills/signalhouse-sms/SKILL.md +4 -4
- package/skills/signalhouse-webhooks/SKILL.md +76 -56
- package/src/SignalHouseSDK.js +26 -13
- package/src/domains/Agents.js +204 -55
- package/src/domains/Auth.js +30 -24
- package/src/domains/Billing.js +32 -26
- package/src/domains/Brands.js +45 -34
- package/src/domains/Campaigns.js +106 -47
- package/src/domains/Dnc.js +168 -0
- package/src/domains/Groups.js +53 -16
- package/src/domains/Landings.js +36 -30
- package/src/domains/Messages.js +110 -65
- package/src/domains/Notifications.js +12 -6
- package/src/domains/Numbers.js +58 -52
- package/src/domains/Onboarding.js +14 -8
- package/src/domains/Shortlinks.js +10 -4
- package/src/domains/Subgroups.js +16 -10
- package/src/domains/Subscriptions.js +22 -16
- package/src/domains/Tickets.js +18 -12
- package/src/domains/Users.js +32 -22
- package/src/domains/Webhooks.js +45 -13
- package/src/domains/voice/Analytics.js +8 -2
- package/src/domains/voice/CallLogs.js +14 -8
- package/src/domains/voice/Calls.js +14 -8
- package/src/domains/voice/GlobalVoiceSettings.js +10 -4
- package/src/domains/voice/ProgrammableVoiceProfiles.js +22 -16
- package/src/domains/voice/SipProfiles.js +24 -18
- package/src/domains/voice/SipTrunks.js +26 -20
- package/src/domains/voice/Tokens.js +10 -4
- package/src/domains/voice/browser/Call.js +2 -0
- package/src/domains/voice/browser/Device.js +23 -11
- package/src/webhooks/verifySignature.js +66 -0
package/src/domains/Messages.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
export class Messages {
|
|
2
8
|
constructor(client, multipartClient, enableAdmin) {
|
|
3
9
|
this.client = client;
|
|
@@ -6,10 +12,11 @@ export class Messages {
|
|
|
6
12
|
}
|
|
7
13
|
|
|
8
14
|
/**
|
|
9
|
-
* Estimate Canadian SMS/MMS retail cost
|
|
15
|
+
* Estimate Canadian SMS/MMS retail cost; no charge or send. Requires a Ready Canadian sender and Canadian or US
|
|
16
|
+
* recipients, and is unavailable unless Canada is enabled for the environment.
|
|
10
17
|
* @async
|
|
11
18
|
* @param {Object} params - Sender, up to 100 recipients, messageBody and request options.
|
|
12
|
-
* @returns {Promise<
|
|
19
|
+
* @returns {Promise<SdkResponse<any>>} - Per-recipient rates and total in microdollars; unknown carriers use the upper fallback.
|
|
13
20
|
*/
|
|
14
21
|
async estimateMessage({ senderPhoneNumber, recipientPhoneNumbers, messageBody, messageType = "SMS", options = {} }) {
|
|
15
22
|
return this.client("/message/estimate", { method: "POST", body: { senderPhoneNumber, recipientPhoneNumbers, messageBody, messageType }, ...options });
|
|
@@ -32,16 +39,19 @@ export class Messages {
|
|
|
32
39
|
* @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.
|
|
33
40
|
* @param {string} [params.carrier] - Filter messages by the carrier used for sending
|
|
34
41
|
* @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.
|
|
42
|
+
* @param {string|string[]} [params.errorCode] - Filter FAILED messages by Signal House error code (single value or array). "OUT" is the campaign opt-out, displayed as RECIPIENT_OPTED_OUT. Carrier codes are not filterable here; they live inside successOrFailureReason.
|
|
43
|
+
* @param {string|string[]} [params.phoneNumber] - Filter messages by a business number on either side of the message. Accepts a single value or an array; OR'd with campaignId/brandId when matchAny is true
|
|
35
44
|
* @param {string} [params.senderPhoneNumber] - Filter messages by the sender's 5-6 digit Short Code or 10+ digit phone number
|
|
36
45
|
* @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
|
|
37
|
-
* @param {string} [params.startDate] - ISO-8601 date or timestamp;
|
|
38
|
-
* @param {string} [params.endDate] - ISO-8601 date or timestamp;
|
|
46
|
+
* @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
|
|
47
|
+
* @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
|
|
39
48
|
* @param {string} [params.sortField] - The field to sort the messages by (createdAt, segmentCount, status, sentimentScore)
|
|
40
49
|
* @param {string} [params.sortOrder] - The order to sort the messages (asc, desc)
|
|
41
50
|
* @param {number} [params.page] - The page number for pagination
|
|
42
51
|
* @param {number} [params.limit] - The number of messages per page
|
|
43
|
-
* @param {
|
|
44
|
-
* @
|
|
52
|
+
* @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".
|
|
53
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
54
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the list of messages. Inbound messages also carry
|
|
45
55
|
* sentimentScore (-100..100, null when unscored), sentimentLabel ("positive"|"neutral"|"negative", null when
|
|
46
56
|
* sentimentScore is null) and sentimentScoredAt. Outbound messages are never scored.
|
|
47
57
|
*/
|
|
@@ -61,15 +71,17 @@ export class Messages {
|
|
|
61
71
|
matchAny,
|
|
62
72
|
carrier,
|
|
63
73
|
sentimentLabel,
|
|
74
|
+
errorCode,
|
|
64
75
|
startDate,
|
|
65
76
|
endDate,
|
|
66
77
|
sortField,
|
|
67
78
|
sortOrder,
|
|
68
79
|
page,
|
|
69
80
|
limit,
|
|
81
|
+
dateBounds,
|
|
70
82
|
options = {},
|
|
71
83
|
}) {
|
|
72
|
-
const filters = { id, campaignId, brandId, subgroupId, groupId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, matchAny, carrier, sentimentLabel, startDate, endDate, sortField, sortOrder, page, limit };
|
|
84
|
+
const filters = { id, campaignId, brandId, subgroupId, groupId, phoneNumber, senderPhoneNumber, recipientPhoneNumber, status, direction, messageType, channel, matchAny, carrier, sentimentLabel, errorCode, startDate, endDate, sortField, sortOrder, page, limit, dateBounds };
|
|
73
85
|
const queryString = this.client._getQueryString(filters);
|
|
74
86
|
return this.client(`/message${queryString}`, { method: "GET", ...options });
|
|
75
87
|
}
|
|
@@ -82,8 +94,8 @@ export class Messages {
|
|
|
82
94
|
* @roles api, admin, developer, billing, user
|
|
83
95
|
* @param {Object} params - The parameters for fetching delivery reports
|
|
84
96
|
* @param {string[]} params.messageIds - The message IDs to fetch carrier delivery reports for (1-100)
|
|
85
|
-
* @param {
|
|
86
|
-
* @returns {Promise<
|
|
97
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
98
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to an array of carrier delivery reports
|
|
87
99
|
*/
|
|
88
100
|
async getDeliveryReports({ messageIds, options = {} }) {
|
|
89
101
|
this.client._require({ messageIds });
|
|
@@ -105,14 +117,15 @@ export class Messages {
|
|
|
105
117
|
* @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.
|
|
106
118
|
* @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.
|
|
107
119
|
* @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
|
|
108
|
-
* @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
109
|
-
* @param {string} [params.startDate] - ISO-8601 date or timestamp;
|
|
110
|
-
* @param {string} [params.endDate] - ISO-8601 date or timestamp;
|
|
120
|
+
* @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). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
121
|
+
* @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
|
|
122
|
+
* @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
|
|
111
123
|
* @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.
|
|
112
124
|
* @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.
|
|
113
125
|
* @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).
|
|
114
|
-
* @param {
|
|
115
|
-
* @
|
|
126
|
+
* @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".
|
|
127
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
128
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the analytics data. Also includes inbound-message
|
|
116
129
|
* sentiment for the requested scope: sentimentScore (volume-weighted average of every scored inbound message
|
|
117
130
|
* in range, -100..100, null when nothing was scored), sentimentLabel ("positive"|"neutral"|"negative", null
|
|
118
131
|
* when sentimentScore is null), sentimentScoredCount, sentimentPositive, sentimentNeutral, sentimentNegative.
|
|
@@ -121,8 +134,8 @@ export class Messages {
|
|
|
121
134
|
* summed or re-averaged across types, rows or responses. To weight a subset of message types, pass
|
|
122
135
|
* messageType and read sentimentScore.
|
|
123
136
|
*/
|
|
124
|
-
async getAnalytics({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, matchAny, options = {} }) {
|
|
125
|
-
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, matchAny };
|
|
137
|
+
async getAnalytics({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, matchAny, dateBounds, options = {} }) {
|
|
138
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, matchAny, dateBounds };
|
|
126
139
|
const queryString = this.client._getQueryString(filters);
|
|
127
140
|
return this.client(`/message/analytics${queryString}`, { method: "GET", ...options });
|
|
128
141
|
}
|
|
@@ -138,15 +151,16 @@ export class Messages {
|
|
|
138
151
|
* @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.
|
|
139
152
|
* @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.
|
|
140
153
|
* @param {string|string[]} [params.carrier] - Filter analytics by the carrier used for sending. Accepts a single value, an array, or a comma-separated string.
|
|
141
|
-
* @param {string|string[]} [params.carrierFamily] - Filter analytics by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
142
|
-
* @param {string} [params.startDate] - ISO-8601 date or timestamp.
|
|
143
|
-
* @param {string} [params.endDate] - ISO-8601 date or timestamp. At day granularity it is
|
|
154
|
+
* @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). Accepts a single value, an array, or a comma-separated string. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
155
|
+
* @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.
|
|
156
|
+
* @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.
|
|
144
157
|
* @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.
|
|
145
158
|
* @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.
|
|
146
159
|
* @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. Only accepted where the environment serves hourly analytics; elsewhere any value, including "day", is rejected with a 400 -- omit the parameter unless hour grain is wanted.
|
|
147
160
|
* @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, 10DLC only) and caps the span at 31 days. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
148
|
-
* @param {
|
|
149
|
-
* @
|
|
161
|
+
* @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".
|
|
162
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
163
|
+
* @returns {Promise<SdkResponse<Array>>} - A promise that resolves to an array of analytics snapshot records. cardTotals and
|
|
150
164
|
* every byDate/byPhoneNumber/byCarrier row also carry that row's own inbound-message sentiment: sentimentScore
|
|
151
165
|
* (volume-weighted average, -100..100, null when nothing in that row's scope was scored), sentimentLabel,
|
|
152
166
|
* sentimentScoredCount, sentimentPositive, sentimentNeutral, sentimentNegative. The fields are always present;
|
|
@@ -154,12 +168,39 @@ export class Messages {
|
|
|
154
168
|
* score is divided server-side and the raw sums are never returned: a score is an average and must never be
|
|
155
169
|
* summed or re-averaged across types, rows or responses.
|
|
156
170
|
*/
|
|
157
|
-
async getAnalyticsDetail({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, granularity, breakdown, options = {} }) {
|
|
158
|
-
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, granularity, breakdown };
|
|
171
|
+
async getAnalyticsDetail({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, granularity, breakdown, dateBounds, options = {} }) {
|
|
172
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, channel, messageType, granularity, breakdown, dateBounds };
|
|
159
173
|
const queryString = this.client._getQueryString(filters);
|
|
160
174
|
return this.client(`/message/analytics/detail${queryString}`, { method: "GET", ...options });
|
|
161
175
|
}
|
|
162
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Get per-minute send throughput (peak segments per minute, sending minutes, minutes at a ceiling) for a
|
|
179
|
+
* campaign, brand, or group, per time bucket and per carrier family. Measured from SENT transitions at
|
|
180
|
+
* campaign × carrier-family grain -- the grain carrier ceilings are enforced at -- so a peak here is the
|
|
181
|
+
* figure a ceiling is compared against. Only accepted where the environment serves hourly analytics;
|
|
182
|
+
* elsewhere the request is rejected with a 400.
|
|
183
|
+
* @async
|
|
184
|
+
* @roles api, admin, developer, billing, user
|
|
185
|
+
* @param {Object} params - The parameters for the throughput read
|
|
186
|
+
* @param {string} params.groupId - The group to scope the read to (required)
|
|
187
|
+
* @param {string|string[]} [params.brandId] - Brand scope. Accepts a single value, an array, or a comma-separated string.
|
|
188
|
+
* @param {string|string[]} [params.campaignId] - Campaign scope; wins over brandId. Accepts a single value, an array, or a comma-separated string.
|
|
189
|
+
* @param {string|string[]} [params.carrierFamily] - Carrier-family filter (ATT, TMobile, Verizon, USCellular, ...). Accepts a single value, an array, or a comma-separated string.
|
|
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 hour granularity and of its minute at day granularity (the cube is keyed by minute).
|
|
191
|
+
* @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).
|
|
192
|
+
* @param {("hour"|"day")} [params.granularity] - Bucket grain of the byDate and byBreakdown rows. Omit for hour (each row's _id is a "YYYY-MM-DD HH:MM:SS" UTC hour, span capped at 7 days); "day" buckets by calendar day on the end bound's offset.
|
|
193
|
+
* @param {number} [params.ceiling] - Segments-per-minute ceiling. When given, every row also reports minutesAtCeiling (sending minutes at or above it); otherwise minutesAtCeiling is null.
|
|
194
|
+
* @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".
|
|
195
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
196
|
+
* @returns {Promise<SdkResponse<any>>} - `{ totals, byDate, byCarrierFamily, byBreakdown: { dimension: "carrierFamily", rows } }`. Every row carries segments, messages, peakSegmentsPerMinute, peakMessagesPerMinute, peakMinute (UTC "YYYY-MM-DD HH:MM:SS", null when no traffic), sendingMinutes, averageSegmentsPerSendingMinute and minutesAtCeiling.
|
|
197
|
+
*/
|
|
198
|
+
async getAnalyticsThroughput({ groupId, brandId, campaignId, carrierFamily, startDate, endDate, granularity, ceiling, dateBounds, options = {} }) {
|
|
199
|
+
const filters = { groupId, brandId, campaignId, carrierFamily, startDate, endDate, granularity, ceiling, dateBounds };
|
|
200
|
+
const queryString = this.client._getQueryString(filters);
|
|
201
|
+
return this.client(`/message/analytics/throughput${queryString}`, { method: "GET", ...options });
|
|
202
|
+
}
|
|
203
|
+
|
|
163
204
|
/**
|
|
164
205
|
* Get filter dropdown options (subgroups, brands, campaigns, phone numbers) for the Analytics page,
|
|
165
206
|
* scoped to a single group. Sourced from ClickHouse — only items with at least one message are returned.
|
|
@@ -167,8 +208,8 @@ export class Messages {
|
|
|
167
208
|
* @roles api, admin, developer, billing, user
|
|
168
209
|
* @param {Object} params - The parameters for getting analytics filter options
|
|
169
210
|
* @param {string} params.groupId - The ID of the group whose filter options to load
|
|
170
|
-
* @param {
|
|
171
|
-
* @returns {Promise<
|
|
211
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
212
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to { subgroups, brands, campaigns, phoneNumbers }
|
|
172
213
|
*/
|
|
173
214
|
async getAnalyticsFilterOptions({ groupId, options = {} }) {
|
|
174
215
|
const filters = { groupId };
|
|
@@ -188,19 +229,20 @@ export class Messages {
|
|
|
188
229
|
* @param {string|string[]} [params.campaignId]
|
|
189
230
|
* @param {string|string[]} [params.phoneNumber]
|
|
190
231
|
* @param {string|string[]} [params.carrier]
|
|
191
|
-
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
232
|
+
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
192
233
|
* @param {string} [params.startDate]
|
|
193
234
|
* @param {string} [params.endDate]
|
|
194
235
|
* @param {number} [params.page=1]
|
|
195
236
|
* @param {number} [params.limit=50] - max 50 per page
|
|
196
237
|
* @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).
|
|
197
238
|
* @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.
|
|
198
|
-
* @param {
|
|
199
|
-
* @
|
|
239
|
+
* @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".
|
|
240
|
+
* @param {RequestOptions} [params.options]
|
|
241
|
+
* @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).
|
|
200
242
|
* 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.
|
|
201
243
|
*/
|
|
202
|
-
async getAnalyticsBySubgroup({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel, messageType, options = {} }) {
|
|
203
|
-
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel, messageType };
|
|
244
|
+
async getAnalyticsBySubgroup({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel, messageType, dateBounds, options = {} }) {
|
|
245
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel, messageType, dateBounds };
|
|
204
246
|
const queryString = this.client._getQueryString(filters);
|
|
205
247
|
return this.client(`/message/analytics/by-subgroup${queryString}`, { method: "GET", ...options });
|
|
206
248
|
}
|
|
@@ -217,17 +259,18 @@ export class Messages {
|
|
|
217
259
|
* @param {string|string[]} [params.campaignId]
|
|
218
260
|
* @param {string|string[]} [params.phoneNumber]
|
|
219
261
|
* @param {string|string[]} [params.carrier]
|
|
220
|
-
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
262
|
+
* @param {string|string[]} [params.carrierFamily] - Resolved carrier family of the recipient (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Standard, IceWireless); single value, array, or comma-separated. Only accepted where the environment serves hourly analytics; elsewhere any value is rejected with a 400 -- omit the parameter unless it is wanted.
|
|
221
263
|
* @param {string} [params.startDate]
|
|
222
264
|
* @param {string} [params.endDate]
|
|
223
265
|
* @param {number} [params.page=1]
|
|
224
266
|
* @param {number} [params.limit=50] - max 50 per page
|
|
225
267
|
* @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.
|
|
226
|
-
* @param {
|
|
227
|
-
* @
|
|
268
|
+
* @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".
|
|
269
|
+
* @param {RequestOptions} [params.options]
|
|
270
|
+
* @returns {Promise<SdkResponse<any>>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
|
|
228
271
|
*/
|
|
229
|
-
async getAnalyticsByErrorCode({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel, options = {} }) {
|
|
230
|
-
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel };
|
|
272
|
+
async getAnalyticsByErrorCode({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel, dateBounds, options = {} }) {
|
|
273
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, carrierFamily, startDate, endDate, page, limit, channel, dateBounds };
|
|
231
274
|
const queryString = this.client._getQueryString(filters);
|
|
232
275
|
return this.client(`/message/analytics/by-error-code${queryString}`, { method: "GET", ...options });
|
|
233
276
|
}
|
|
@@ -243,14 +286,15 @@ export class Messages {
|
|
|
243
286
|
* @param {string} [params.campaignId] - Filter by the ID of the associated campaign
|
|
244
287
|
* @param {string} [params.phoneNumber] - Filter by the phone number
|
|
245
288
|
* @param {string} [params.carrier] - Filter by the carrier
|
|
246
|
-
* @param {string} [params.startDate] - ISO-8601 date or timestamp;
|
|
247
|
-
* @param {string} [params.endDate] - ISO-8601 date or timestamp;
|
|
289
|
+
* @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
|
|
290
|
+
* @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
|
|
248
291
|
* @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.
|
|
249
|
-
* @param {
|
|
250
|
-
* @
|
|
292
|
+
* @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".
|
|
293
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
294
|
+
* @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.
|
|
251
295
|
*/
|
|
252
|
-
async getDncAnalytics({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, channel, options = {} }) {
|
|
253
|
-
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, channel };
|
|
296
|
+
async getDncAnalytics({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, channel, dateBounds, options = {} }) {
|
|
297
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, channel, dateBounds };
|
|
254
298
|
const queryString = this.client._getQueryString(filters);
|
|
255
299
|
return this.client(`/message/dnc/analytics${queryString}`, { method: "GET", ...options });
|
|
256
300
|
}
|
|
@@ -266,18 +310,19 @@ export class Messages {
|
|
|
266
310
|
* @param {string} [params.campaignId] - Filter by the ID of the associated campaign
|
|
267
311
|
* @param {string} [params.phoneNumber] - Filter by the phone number
|
|
268
312
|
* @param {string} [params.carrier] - Filter by the carrier
|
|
269
|
-
* @param {string} [params.startDate] - ISO-8601 date or timestamp;
|
|
270
|
-
* @param {string} [params.endDate] - ISO-8601 date or timestamp;
|
|
313
|
+
* @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
|
|
314
|
+
* @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
|
|
271
315
|
* @param {number} [params.page] - Page number for pagination
|
|
272
316
|
* @param {number} [params.limit] - Number of records per page
|
|
273
317
|
* @param {string} [params.sortField] - Field to sort by
|
|
274
318
|
* @param {string} [params.sortOrder] - Sort direction (asc, desc)
|
|
275
319
|
* @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.
|
|
276
|
-
* @param {
|
|
277
|
-
* @
|
|
320
|
+
* @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".
|
|
321
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
322
|
+
* @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), copied from the inbound message that triggered the opt-out. campaignId is null on subgroup-scoped records (non-US recipients).
|
|
278
323
|
*/
|
|
279
|
-
async getDncRecords({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, options = {} }) {
|
|
280
|
-
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel };
|
|
324
|
+
async getDncRecords({ groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, dateBounds, options = {} }) {
|
|
325
|
+
const filters = { groupId, subgroupId, brandId, campaignId, phoneNumber, carrier, startDate, endDate, page, limit, sortField, sortOrder, channel, dateBounds };
|
|
281
326
|
const queryString = this.client._getQueryString(filters);
|
|
282
327
|
return this.client(`/message/dnc${queryString}`, { method: "GET", ...options });
|
|
283
328
|
}
|
|
@@ -303,8 +348,8 @@ export class Messages {
|
|
|
303
348
|
* @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
|
|
304
349
|
* @param {boolean} [params.enableShortlink=false] - Whether to enable shortlink in the message
|
|
305
350
|
* @param {boolean} [params.filterLandlinesAndInactiveNumbers=false] - Whether to filter out landline and inactive numbers before sending
|
|
306
|
-
* @param {
|
|
307
|
-
* @returns {Promise<
|
|
351
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
352
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the response data from the server
|
|
308
353
|
*/
|
|
309
354
|
async sendSMS({ senderPhoneNumber, recipientPhoneNumbers, messageBody, statusCallbackUrl, enableShortlink = false, filterLandlinesAndInactiveNumbers = false, options = {} }) {
|
|
310
355
|
this.client._require({ senderPhoneNumber, recipientPhoneNumbers, messageBody });
|
|
@@ -330,8 +375,8 @@ export class Messages {
|
|
|
330
375
|
* @param {boolean} [params.useSignalHouseShortlinks] - When false, SignalHouse applies no link-shortening
|
|
331
376
|
* or text-spin and your pre-spun links/content are sent verbatim (bring-your-own spinner). Defaults to
|
|
332
377
|
* true server-side (the SignalHouse shortlink system, which mints unique per-recipient links).
|
|
333
|
-
* @param {
|
|
334
|
-
* @returns {Promise<
|
|
378
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
379
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the response data from the server
|
|
335
380
|
*/
|
|
336
381
|
async sendP2P({ recipientPhoneNumbers, messageBody, statusCallbackUrl, groupId, subgroupId, useSignalHouseShortlinks, options = {} }) {
|
|
337
382
|
this.client._require({ recipientPhoneNumbers, messageBody });
|
|
@@ -353,9 +398,9 @@ export class Messages {
|
|
|
353
398
|
* @roles api, admin, developer, billing, user
|
|
354
399
|
* @param {Object} params - The parameters for getting a P2P batch
|
|
355
400
|
* @param {string} params.batchId - The ID of the P2P batch to retrieve
|
|
356
|
-
* @param {
|
|
401
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
357
402
|
* @throws {Error} Throws an error if the batchId parameter is missing
|
|
358
|
-
* @returns {Promise<
|
|
403
|
+
* @returns {Promise<SdkResponse<any>>} - The P2P batch object returned from the server
|
|
359
404
|
*/
|
|
360
405
|
async getP2PBatch({ batchId, options = {} }) {
|
|
361
406
|
this.client._require({ batchId });
|
|
@@ -387,8 +432,8 @@ export class Messages {
|
|
|
387
432
|
* @param {boolean} [params.enableCompression=true] - Whether to enable image compression for the image attachments
|
|
388
433
|
* @param {boolean} [params.filterLandlinesAndInactiveNumbers=false] - Whether to filter out landline and inactive numbers before sending
|
|
389
434
|
* @param {File[]} [params.images] - The images to attach to the MMS message
|
|
390
|
-
* @param {
|
|
391
|
-
* @returns {Promise<
|
|
435
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
436
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the response data from the server
|
|
392
437
|
*/
|
|
393
438
|
async sendMMS({
|
|
394
439
|
senderPhoneNumber,
|
|
@@ -425,9 +470,9 @@ export class Messages {
|
|
|
425
470
|
formData.append("statusCallbackUrl", statusCallbackUrl);
|
|
426
471
|
}
|
|
427
472
|
|
|
428
|
-
formData.append("enableShortlink", enableShortlink);
|
|
429
|
-
formData.append("enableCompression", enableCompression);
|
|
430
|
-
if (filterLandlinesAndInactiveNumbers) formData.append("filterLandlinesAndInactiveNumbers", filterLandlinesAndInactiveNumbers);
|
|
473
|
+
formData.append("enableShortlink", String(enableShortlink));
|
|
474
|
+
formData.append("enableCompression", String(enableCompression));
|
|
475
|
+
if (filterLandlinesAndInactiveNumbers) formData.append("filterLandlinesAndInactiveNumbers", String(filterLandlinesAndInactiveNumbers));
|
|
431
476
|
|
|
432
477
|
return this.multipartClient(`/message/mms`, { method: "POST", body: formData, ...options });
|
|
433
478
|
}
|
|
@@ -456,8 +501,8 @@ export class Messages {
|
|
|
456
501
|
* @param {boolean} [params.enableCompression=true] - Whether to enable image compression for the image attachments
|
|
457
502
|
* @param {boolean} [params.filterLandlinesAndInactiveNumbers=false] - Whether to filter out landline and inactive numbers before sending
|
|
458
503
|
* @param {File[]} [params.images] - The images to attach to the MMS message
|
|
459
|
-
* @param {
|
|
460
|
-
* @returns {Promise<
|
|
504
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
505
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to the response data from the server
|
|
461
506
|
*/
|
|
462
507
|
async sendGroupMessage({
|
|
463
508
|
senderPhoneNumber,
|
|
@@ -494,9 +539,9 @@ export class Messages {
|
|
|
494
539
|
formData.append("statusCallbackUrl", statusCallbackUrl);
|
|
495
540
|
}
|
|
496
541
|
|
|
497
|
-
formData.append("enableShortlink", enableShortlink);
|
|
498
|
-
formData.append("enableCompression", enableCompression);
|
|
499
|
-
if (filterLandlinesAndInactiveNumbers) formData.append("filterLandlinesAndInactiveNumbers", filterLandlinesAndInactiveNumbers);
|
|
542
|
+
formData.append("enableShortlink", String(enableShortlink));
|
|
543
|
+
formData.append("enableCompression", String(enableCompression));
|
|
544
|
+
if (filterLandlinesAndInactiveNumbers) formData.append("filterLandlinesAndInactiveNumbers", String(filterLandlinesAndInactiveNumbers));
|
|
500
545
|
|
|
501
546
|
return this.multipartClient(`/message/groupMessage`, { method: "POST", body: formData, ...options });
|
|
502
547
|
}
|
|
@@ -507,8 +552,8 @@ export class Messages {
|
|
|
507
552
|
* @roles api, admin, developer, billing, user
|
|
508
553
|
* @param {Object} params - The parameters for looking up a carrier
|
|
509
554
|
* @param {string} params.phoneNumber - The phone number to look up (10+ digits, no + prefix)
|
|
510
|
-
* @param {
|
|
511
|
-
* @returns {Promise<
|
|
555
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
556
|
+
* @returns {Promise<SdkResponse<any>>} - A promise that resolves to carrier information
|
|
512
557
|
*/
|
|
513
558
|
async carrierIdLookup({ phoneNumber, options = {} }) {
|
|
514
559
|
this.client._require({ phoneNumber });
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
export class Notifications {
|
|
2
8
|
constructor(client, enableAdmin) {
|
|
3
9
|
this.client = client;
|
|
@@ -15,8 +21,8 @@ export class Notifications {
|
|
|
15
21
|
* @param {number} [params.limit] - Results per page (min 1, max 100, default 10)
|
|
16
22
|
* @param {string} [params.status] - Filter by status: "READ" or "UNREAD"
|
|
17
23
|
* @param {string|string[]} [params.eventTypes] - Event types to filter by (comma-separated string or array)
|
|
18
|
-
* @param {
|
|
19
|
-
* @returns {Promise<
|
|
24
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
25
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
20
26
|
*/
|
|
21
27
|
async getNotifications({ id, groupId, page, limit, status, eventTypes, options = {} }) {
|
|
22
28
|
this.client._require({ "id or groupId": id ?? groupId });
|
|
@@ -31,8 +37,8 @@ export class Notifications {
|
|
|
31
37
|
* @param {Object} params
|
|
32
38
|
* @param {string|string[]} params.ids - Notification id or array of notification ids
|
|
33
39
|
* @param {string} params.status - New status: "READ" or "UNREAD"
|
|
34
|
-
* @param {
|
|
35
|
-
* @returns {Promise<
|
|
40
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
41
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
36
42
|
*/
|
|
37
43
|
async updateNotificationStatus({ ids, status, options = {} }) {
|
|
38
44
|
this.client._require({ ids, status });
|
|
@@ -45,8 +51,8 @@ export class Notifications {
|
|
|
45
51
|
* @roles signalhouse_api, signalhouse_admin, signalhouse_user, api, admin, developer, billing, user
|
|
46
52
|
* @param {Object} params
|
|
47
53
|
* @param {string} params.id - The notification id to delete
|
|
48
|
-
* @param {
|
|
49
|
-
* @returns {Promise<
|
|
54
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
55
|
+
* @returns {Promise<SdkResponse<any>>} The response from the server
|
|
50
56
|
*/
|
|
51
57
|
async deleteNotification({ id, options = {} }) {
|
|
52
58
|
this.client._require({ id });
|