@signalhouse-sms/sdk 1.8.0 → 1.9.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/SignalHouseSDK.js +2 -0
- package/src/domains/Brands.js +43 -119
- package/src/domains/Rcs.js +281 -0
- package/src/domains/Registrations.js +76 -3
- package/src/domains/Templates.js +34 -3
- package/types/SignalHouseSDK.d.ts +2 -0
- package/types/domains/Brands.d.ts +96 -241
- package/types/domains/Rcs.d.ts +409 -0
- package/types/domains/Registrations.d.ts +70 -2
- package/types/domains/Templates.d.ts +56 -6
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} RcsAgentProfile
|
|
8
|
+
* @property {string} [name] - Agent name shown on the handset (max 40)
|
|
9
|
+
* @property {string} [description] - Agent description (max 100)
|
|
10
|
+
* @property {string} [color] - Brand color, hex (default #6868ab)
|
|
11
|
+
* @property {string} [logoUrl] - HTTPS URL of a 224 × 224 px logo (use uploadAsset to host one)
|
|
12
|
+
* @property {string} [heroUrl] - HTTPS URL of a 1440 × 448 px hero image
|
|
13
|
+
* @property {string} [phone] - Contact phone, E.164 (e.g. +18005550142)
|
|
14
|
+
* @property {string} [website] - HTTPS website
|
|
15
|
+
* @property {string} [email] - Contact email
|
|
16
|
+
* @property {string} [phoneLabel] - Caption on the Call action (max 40; submit defaults it to "Call")
|
|
17
|
+
* @property {string} [websiteLabel] - Caption on the Website action (max 40; submit defaults it to "Website")
|
|
18
|
+
* @property {string} [emailLabel] - Caption on the Email action (max 40; submit defaults it to "Email")
|
|
19
|
+
* @property {string} [privacyPolicyUrl] - HTTPS privacy policy URL
|
|
20
|
+
* @property {string} [termsUrl] - HTTPS terms of service URL
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The agent's launch text. Every field is required before submit, the opt-in URL and the launch video included.
|
|
24
|
+
* @typedef {Object} RcsAgentConsent
|
|
25
|
+
* @property {string} [optInDetails] - How recipients opt in (filled from the campaign's messageFlow when blank)
|
|
26
|
+
* @property {string} [optInUrl] - HTTPS page that shows the opt-in
|
|
27
|
+
* @property {string} [optInResponse] - The opt-in confirmation (filled from the campaign's optinMessage)
|
|
28
|
+
* @property {string} [optOutDetails] - How recipients opt out
|
|
29
|
+
* @property {string} [optOutResponse] - The opt-out confirmation (filled from the campaign's optoutMessage)
|
|
30
|
+
* @property {string} [helpResponse] - The HELP reply (filled from the campaign's helpMessage)
|
|
31
|
+
* @property {string} [campaignDescription] - What the agent sends (filled from the campaign's description)
|
|
32
|
+
* @property {string[]} [messageExamples] - 1-6 example messages (filled from the campaign's samples)
|
|
33
|
+
* @property {("UP_TO_10K"|"10K_100K"|"100K_500K"|"500K_1M"|"1M_PLUS")} [estimatedMonthlyVolume] - Expected monthly volume
|
|
34
|
+
* @property {string} [launchVideoUrl] - HTTPS video of the opt-in flow
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* The individual at the brand the carrier partner's reviewers may contact about the launch. Every field is required
|
|
38
|
+
* before the launch request; a shared mailbox (support@, info@) is refused.
|
|
39
|
+
* @typedef {Object} RcsAgentContact
|
|
40
|
+
* @property {string} [firstName] - First name (max 100)
|
|
41
|
+
* @property {string} [lastName] - Last name (max 100)
|
|
42
|
+
* @property {string} [role] - Role at the brand (3-75)
|
|
43
|
+
* @property {string} [email] - An individual's business email
|
|
44
|
+
* @property {string} [mobile] - Mobile number, E.164
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Build the multipart form for an agent image upload.
|
|
48
|
+
* @param {Object} params - Form fields
|
|
49
|
+
* @param {("logo"|"hero")} params.kind - Which image
|
|
50
|
+
* @param {Blob|File} params.file - The PNG or JPEG bytes
|
|
51
|
+
* @param {string} [params.fileName] - Optional file name
|
|
52
|
+
* @returns {FormData} - The form with kind and file fields
|
|
53
|
+
*/
|
|
54
|
+
export function agentAssetForm({ kind, file, fileName }: {
|
|
55
|
+
kind: ("logo" | "hero");
|
|
56
|
+
file: Blob | File;
|
|
57
|
+
fileName?: string;
|
|
58
|
+
}): FormData;
|
|
59
|
+
/**
|
|
60
|
+
* RCS agents under /rcs/agent. An agent links one 10DLC brand and one 10DLC campaign: the campaign's numbers are the
|
|
61
|
+
* SMS fallback, and the brand and campaign supply the company identity and consent text for the carrier launch.
|
|
62
|
+
* One brand or campaign can serve many agents. An agent is a registration (type RCS_AGENT, id RCSA…), so the
|
|
63
|
+
* registrations methods read and edit the same record. 404 while the environment's RCS switch is off; 400 while the
|
|
64
|
+
* group's rcsEnabled flag is off.
|
|
65
|
+
*/
|
|
66
|
+
export class RcsAgents {
|
|
67
|
+
constructor(client: any, multipartClient: any);
|
|
68
|
+
client: any;
|
|
69
|
+
multipartClient: any;
|
|
70
|
+
/**
|
|
71
|
+
* Create an agent draft on a 10DLC brand, optionally with its campaign. The agent's subgroup is the brand's.
|
|
72
|
+
* Blank consent fields fill from the linked campaign. Pass options.idempotencyKey to make a retry safe.
|
|
73
|
+
* @async
|
|
74
|
+
* @roles api, admin, developer, billing, user
|
|
75
|
+
* @param {Object} params - The agent
|
|
76
|
+
* @param {string} params.brandId - The 10DLC brand: carrier brand ID, provisional UUID or _id
|
|
77
|
+
* @param {string|null} [params.campaignId] - A 10DLC campaign of that brand: campaign ID or _id; required before submit
|
|
78
|
+
* @param {RcsAgentProfile} [params.agent] - The agent profile
|
|
79
|
+
* @param {RcsAgentConsent} [params.consent] - The launch text; required in full before the launch request
|
|
80
|
+
* @param {RcsAgentContact} [params.contact] - The launch contact; required in full before the launch request
|
|
81
|
+
* @param {("OTP"|"TRANSACTIONAL"|"PROMOTIONAL"|"MULTI_USE")} [params.useCase] - The agent's use case; required before submit
|
|
82
|
+
* @param {("NON_CONVERSATIONAL"|"CONVERSATIONAL")} [params.billingCategory] - Default NON_CONVERSATIONAL; submit refuses CONVERSATIONAL
|
|
83
|
+
* @param {{ mode?: string, channel?: string, from?: string }|null} [params.defaultFallback] - Fallback mode (auto, rcs_only, sms_only, none), channel (auto, sms, mms) and from, a number on the linked campaign
|
|
84
|
+
* @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
|
|
85
|
+
* @param {string[]} [params.testers] - Tester numbers (up to 200), invited once the agent exists at the carrier
|
|
86
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
87
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status DRAFT)
|
|
88
|
+
*/
|
|
89
|
+
create({ brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options }: {
|
|
90
|
+
brandId: string;
|
|
91
|
+
campaignId?: string | null;
|
|
92
|
+
agent?: RcsAgentProfile;
|
|
93
|
+
consent?: RcsAgentConsent;
|
|
94
|
+
contact?: RcsAgentContact;
|
|
95
|
+
useCase?: ("OTP" | "TRANSACTIONAL" | "PROMOTIONAL" | "MULTI_USE");
|
|
96
|
+
billingCategory?: ("NON_CONVERSATIONAL" | "CONVERSATIONAL");
|
|
97
|
+
defaultFallback?: {
|
|
98
|
+
mode?: string;
|
|
99
|
+
channel?: string;
|
|
100
|
+
from?: string;
|
|
101
|
+
} | null;
|
|
102
|
+
excludedCarriers?: string[];
|
|
103
|
+
testers?: string[];
|
|
104
|
+
options?: RequestOptions;
|
|
105
|
+
}): Promise<SdkResponse<any>>;
|
|
106
|
+
/**
|
|
107
|
+
* List agents, newest first
|
|
108
|
+
* @async
|
|
109
|
+
* @roles api, admin, developer, billing, user
|
|
110
|
+
* @param {Object} [params] - Filters
|
|
111
|
+
* @param {string} [params.groupId] - Filter by group ID
|
|
112
|
+
* @param {string} [params.subgroupId] - Filter by subgroup ID
|
|
113
|
+
* @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 10DLC brand (carrier brand ID, provisional UUID or _id)
|
|
115
|
+
* @param {string} [params.campaignId] - Agents linked to this 10DLC campaign (campaign ID or _id)
|
|
116
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
117
|
+
* @param {number} [params.limit] - Agents per page (default 25, max 100)
|
|
118
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
119
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { data: [agents], total, page, limit }
|
|
120
|
+
*/
|
|
121
|
+
list({ groupId, subgroupId, status, brandId, campaignId, page, limit, options }?: {
|
|
122
|
+
groupId?: string;
|
|
123
|
+
subgroupId?: string;
|
|
124
|
+
status?: string | string[];
|
|
125
|
+
brandId?: string;
|
|
126
|
+
campaignId?: string;
|
|
127
|
+
page?: number;
|
|
128
|
+
limit?: number;
|
|
129
|
+
options?: RequestOptions;
|
|
130
|
+
}): Promise<SdkResponse<any>>;
|
|
131
|
+
/**
|
|
132
|
+
* Get one agent with the live state of its brand and campaign links
|
|
133
|
+
* @async
|
|
134
|
+
* @roles api, admin, developer, billing, user
|
|
135
|
+
* @param {Object} params - The lookup
|
|
136
|
+
* @param {string} params.agentId - The agent ID (e.g. RCSA7K2M1QZ8RP)
|
|
137
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
138
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
139
|
+
*/
|
|
140
|
+
get({ agentId, options }: {
|
|
141
|
+
agentId: string;
|
|
142
|
+
options?: RequestOptions;
|
|
143
|
+
}): Promise<SdkResponse<any>>;
|
|
144
|
+
/**
|
|
145
|
+
* Edit an agent while it may change: a draft, a Signal House rejection, a request for changes, or an agent in
|
|
146
|
+
* testing (the change is pushed to the carrier partner). `agent`, `consent` and `contact` merge field by field;
|
|
147
|
+
* every other key replaces; campaignId: null unlinks the campaign. 409 in any other status; brandId is locked once
|
|
148
|
+
* the agent exists at the partner and billingCategory once a launch was requested.
|
|
149
|
+
* @async
|
|
150
|
+
* @roles api, admin, developer, billing, user
|
|
151
|
+
* @param {Object} params - The edit
|
|
152
|
+
* @param {string} params.agentId - The agent ID
|
|
153
|
+
* @param {string} [params.brandId] - Relink to another 10DLC brand of the same subgroup
|
|
154
|
+
* @param {string|null} [params.campaignId] - Link, relink or (null) unlink the campaign
|
|
155
|
+
* @param {RcsAgentProfile} [params.agent] - Profile fields to change
|
|
156
|
+
* @param {RcsAgentConsent} [params.consent] - Consent fields to change
|
|
157
|
+
* @param {RcsAgentContact} [params.contact] - Contact fields to change
|
|
158
|
+
* @param {string|null} [params.useCase] - The use case
|
|
159
|
+
* @param {string} [params.billingCategory] - The billing category
|
|
160
|
+
* @param {Object|null} [params.defaultFallback] - The fallback
|
|
161
|
+
* @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
|
|
162
|
+
* @param {string[]} [params.testers] - Tester numbers
|
|
163
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
164
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
165
|
+
*/
|
|
166
|
+
update({ agentId, brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options }: {
|
|
167
|
+
agentId: string;
|
|
168
|
+
brandId?: string;
|
|
169
|
+
campaignId?: string | null;
|
|
170
|
+
agent?: RcsAgentProfile;
|
|
171
|
+
consent?: RcsAgentConsent;
|
|
172
|
+
contact?: RcsAgentContact;
|
|
173
|
+
useCase?: string | null;
|
|
174
|
+
billingCategory?: string;
|
|
175
|
+
defaultFallback?: any | null;
|
|
176
|
+
excludedCarriers?: string[];
|
|
177
|
+
testers?: string[];
|
|
178
|
+
options?: RequestOptions;
|
|
179
|
+
}): Promise<SdkResponse<any>>;
|
|
180
|
+
/**
|
|
181
|
+
* Check an agent against the next gate on its path without writing: before it exists at the carrier partner, what
|
|
182
|
+
* creating it needs (the full profile, useCase, NON_CONVERSATIONAL billing); after that, what the launch request needs
|
|
183
|
+
* (a VERIFIED brand, the campaign, the full consent with the video, the contact)
|
|
184
|
+
* @async
|
|
185
|
+
* @roles api, admin, developer, billing, user
|
|
186
|
+
* @param {Object} params - The lookup
|
|
187
|
+
* @param {string} params.agentId - The agent ID
|
|
188
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
189
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { valid, errors: [{ field, reason }], warnings: [{ field, reason }] }
|
|
190
|
+
*/
|
|
191
|
+
validate({ agentId, options }: {
|
|
192
|
+
agentId: string;
|
|
193
|
+
options?: RequestOptions;
|
|
194
|
+
}): Promise<SdkResponse<any>>;
|
|
195
|
+
/**
|
|
196
|
+
* Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a
|
|
197
|
+
* useCase and NON_CONVERSATIONAL billing; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
|
|
198
|
+
* errors, warnings }. The agent moves to AGENT_CREATING, then IN_TESTING once the partner reports it ready.
|
|
199
|
+
* @async
|
|
200
|
+
* @roles api, admin, developer, billing, user
|
|
201
|
+
* @param {Object} params - The submission
|
|
202
|
+
* @param {string} params.agentId - The agent ID
|
|
203
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
204
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status AGENT_CREATING)
|
|
205
|
+
*/
|
|
206
|
+
submit({ agentId, options }: {
|
|
207
|
+
agentId: string;
|
|
208
|
+
options?: RequestOptions;
|
|
209
|
+
}): Promise<SdkResponse<any>>;
|
|
210
|
+
/**
|
|
211
|
+
* Request the agent's launch: the launch requirements are checked and the agent goes to Signal House review (status
|
|
212
|
+
* PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
|
|
213
|
+
* CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
|
|
214
|
+
* "REGISTRATION_INCOMPLETE", errors, warnings }. Sends POST /registration/:agentId/launch: the agent is a registration.
|
|
215
|
+
* @async
|
|
216
|
+
* @roles api, admin, developer, billing, user
|
|
217
|
+
* @param {Object} params - The launch request
|
|
218
|
+
* @param {string} params.agentId - The agent ID
|
|
219
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
220
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status PENDING_REVIEW)
|
|
221
|
+
*/
|
|
222
|
+
launch({ agentId, options }: {
|
|
223
|
+
agentId: string;
|
|
224
|
+
options?: RequestOptions;
|
|
225
|
+
}): Promise<SdkResponse<any>>;
|
|
226
|
+
/**
|
|
227
|
+
* Archive an agent
|
|
228
|
+
* @async
|
|
229
|
+
* @roles api, admin, developer, user
|
|
230
|
+
* @param {Object} params - The archive request
|
|
231
|
+
* @param {string} params.agentId - The agent ID
|
|
232
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
233
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status ARCHIVED)
|
|
234
|
+
*/
|
|
235
|
+
archive({ agentId, options }: {
|
|
236
|
+
agentId: string;
|
|
237
|
+
options?: RequestOptions;
|
|
238
|
+
}): Promise<SdkResponse<any>>;
|
|
239
|
+
/**
|
|
240
|
+
* Resend a tester's expired invitation, which starts a new 24 hours for the tester to accept it. The number must be
|
|
241
|
+
* a tester on the agent (404) and its invitation must be EXPIRED (409); up to 20 invitations go out a day (429).
|
|
242
|
+
* @async
|
|
243
|
+
* @roles api, admin, developer, billing, user
|
|
244
|
+
* @param {Object} params - The resend request
|
|
245
|
+
* @param {string} params.agentId - The agent ID
|
|
246
|
+
* @param {string} params.phoneNumber - The tester's US number, with or without the +
|
|
247
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
248
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
249
|
+
*/
|
|
250
|
+
resendTesterInvite({ agentId, phoneNumber, options }: {
|
|
251
|
+
agentId: string;
|
|
252
|
+
phoneNumber: string;
|
|
253
|
+
options?: RequestOptions;
|
|
254
|
+
}): Promise<SdkResponse<any>>;
|
|
255
|
+
/**
|
|
256
|
+
* Host the agent's logo (224 × 224 px, 50 KB max) or hero image (1440 × 448 px, 200 KB max), PNG or JPEG, and set
|
|
257
|
+
* it on the draft. Images of any other size are refused.
|
|
258
|
+
* @async
|
|
259
|
+
* @roles api, admin, developer, billing, user
|
|
260
|
+
* @param {Object} params - The upload
|
|
261
|
+
* @param {string} params.agentId - The agent ID
|
|
262
|
+
* @param {("logo"|"hero")} params.kind - Which image
|
|
263
|
+
* @param {Blob|File} params.file - The image bytes
|
|
264
|
+
* @param {string} [params.fileName] - Optional file name
|
|
265
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
266
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent with the new URL
|
|
267
|
+
*/
|
|
268
|
+
uploadAsset({ agentId, kind, file, fileName, options }: {
|
|
269
|
+
agentId: string;
|
|
270
|
+
kind: ("logo" | "hero");
|
|
271
|
+
file: Blob | File;
|
|
272
|
+
fileName?: string;
|
|
273
|
+
options?: RequestOptions;
|
|
274
|
+
}): Promise<SdkResponse<any>>;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* RCS (Google RBM) resources. Templates for RCS live under `templates`.
|
|
278
|
+
*/
|
|
279
|
+
export class Rcs {
|
|
280
|
+
constructor(client: any, multipartClient: any);
|
|
281
|
+
agents: RcsAgents;
|
|
282
|
+
}
|
|
283
|
+
export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
|
|
284
|
+
export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|
|
285
|
+
export type RcsAgentProfile = {
|
|
286
|
+
/**
|
|
287
|
+
* - Agent name shown on the handset (max 40)
|
|
288
|
+
*/
|
|
289
|
+
name?: string;
|
|
290
|
+
/**
|
|
291
|
+
* - Agent description (max 100)
|
|
292
|
+
*/
|
|
293
|
+
description?: string;
|
|
294
|
+
/**
|
|
295
|
+
* - Brand color, hex (default #6868ab)
|
|
296
|
+
*/
|
|
297
|
+
color?: string;
|
|
298
|
+
/**
|
|
299
|
+
* - HTTPS URL of a 224 × 224 px logo (use uploadAsset to host one)
|
|
300
|
+
*/
|
|
301
|
+
logoUrl?: string;
|
|
302
|
+
/**
|
|
303
|
+
* - HTTPS URL of a 1440 × 448 px hero image
|
|
304
|
+
*/
|
|
305
|
+
heroUrl?: string;
|
|
306
|
+
/**
|
|
307
|
+
* - Contact phone, E.164 (e.g. +18005550142)
|
|
308
|
+
*/
|
|
309
|
+
phone?: string;
|
|
310
|
+
/**
|
|
311
|
+
* - HTTPS website
|
|
312
|
+
*/
|
|
313
|
+
website?: string;
|
|
314
|
+
/**
|
|
315
|
+
* - Contact email
|
|
316
|
+
*/
|
|
317
|
+
email?: string;
|
|
318
|
+
/**
|
|
319
|
+
* - Caption on the Call action (max 40; submit defaults it to "Call")
|
|
320
|
+
*/
|
|
321
|
+
phoneLabel?: string;
|
|
322
|
+
/**
|
|
323
|
+
* - Caption on the Website action (max 40; submit defaults it to "Website")
|
|
324
|
+
*/
|
|
325
|
+
websiteLabel?: string;
|
|
326
|
+
/**
|
|
327
|
+
* - Caption on the Email action (max 40; submit defaults it to "Email")
|
|
328
|
+
*/
|
|
329
|
+
emailLabel?: string;
|
|
330
|
+
/**
|
|
331
|
+
* - HTTPS privacy policy URL
|
|
332
|
+
*/
|
|
333
|
+
privacyPolicyUrl?: string;
|
|
334
|
+
/**
|
|
335
|
+
* - HTTPS terms of service URL
|
|
336
|
+
*/
|
|
337
|
+
termsUrl?: string;
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* The agent's launch text. Every field is required before submit, the opt-in URL and the launch video included.
|
|
341
|
+
*/
|
|
342
|
+
export type RcsAgentConsent = {
|
|
343
|
+
/**
|
|
344
|
+
* - How recipients opt in (filled from the campaign's messageFlow when blank)
|
|
345
|
+
*/
|
|
346
|
+
optInDetails?: string;
|
|
347
|
+
/**
|
|
348
|
+
* - HTTPS page that shows the opt-in
|
|
349
|
+
*/
|
|
350
|
+
optInUrl?: string;
|
|
351
|
+
/**
|
|
352
|
+
* - The opt-in confirmation (filled from the campaign's optinMessage)
|
|
353
|
+
*/
|
|
354
|
+
optInResponse?: string;
|
|
355
|
+
/**
|
|
356
|
+
* - How recipients opt out
|
|
357
|
+
*/
|
|
358
|
+
optOutDetails?: string;
|
|
359
|
+
/**
|
|
360
|
+
* - The opt-out confirmation (filled from the campaign's optoutMessage)
|
|
361
|
+
*/
|
|
362
|
+
optOutResponse?: string;
|
|
363
|
+
/**
|
|
364
|
+
* - The HELP reply (filled from the campaign's helpMessage)
|
|
365
|
+
*/
|
|
366
|
+
helpResponse?: string;
|
|
367
|
+
/**
|
|
368
|
+
* - What the agent sends (filled from the campaign's description)
|
|
369
|
+
*/
|
|
370
|
+
campaignDescription?: string;
|
|
371
|
+
/**
|
|
372
|
+
* - 1-6 example messages (filled from the campaign's samples)
|
|
373
|
+
*/
|
|
374
|
+
messageExamples?: string[];
|
|
375
|
+
/**
|
|
376
|
+
* - Expected monthly volume
|
|
377
|
+
*/
|
|
378
|
+
estimatedMonthlyVolume?: ("UP_TO_10K" | "10K_100K" | "100K_500K" | "500K_1M" | "1M_PLUS");
|
|
379
|
+
/**
|
|
380
|
+
* - HTTPS video of the opt-in flow
|
|
381
|
+
*/
|
|
382
|
+
launchVideoUrl?: string;
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* The individual at the brand the carrier partner's reviewers may contact about the launch. Every field is required
|
|
386
|
+
* before the launch request; a shared mailbox (support@, info@) is refused.
|
|
387
|
+
*/
|
|
388
|
+
export type RcsAgentContact = {
|
|
389
|
+
/**
|
|
390
|
+
* - First name (max 100)
|
|
391
|
+
*/
|
|
392
|
+
firstName?: string;
|
|
393
|
+
/**
|
|
394
|
+
* - Last name (max 100)
|
|
395
|
+
*/
|
|
396
|
+
lastName?: string;
|
|
397
|
+
/**
|
|
398
|
+
* - Role at the brand (3-75)
|
|
399
|
+
*/
|
|
400
|
+
role?: string;
|
|
401
|
+
/**
|
|
402
|
+
* - An individual's business email
|
|
403
|
+
*/
|
|
404
|
+
email?: string;
|
|
405
|
+
/**
|
|
406
|
+
* - Mobile number, E.164
|
|
407
|
+
*/
|
|
408
|
+
mobile?: string;
|
|
409
|
+
};
|
|
@@ -141,6 +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 10DLC brand (carrier id, provisional UUID or _id)
|
|
145
|
+
* @param {string} [params.campaignId] - RCS agents only: filter to agents linked to this 10DLC campaign (campaign id or _id)
|
|
144
146
|
* @param {string} [params.sortBy] - Sort field: createdAt (default), subgroupId, registrationId, region or status
|
|
145
147
|
* @param {string} [params.sortOrder] - Sort direction: asc or desc (default)
|
|
146
148
|
* @param {number} [params.page] - Page number (default 1)
|
|
@@ -148,7 +150,7 @@ export class Registrations {
|
|
|
148
150
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
149
151
|
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { data: [registrations], totalCount, page, limit }
|
|
150
152
|
*/
|
|
151
|
-
getRegistrations({ groupId, subgroupId, region, type, kind, status, parentRegistrationId, phoneNumber, sortBy, sortOrder, page, limit, options }?: {
|
|
153
|
+
getRegistrations({ groupId, subgroupId, region, type, kind, status, parentRegistrationId, phoneNumber, brandId, campaignId, sortBy, sortOrder, page, limit, options }?: {
|
|
152
154
|
groupId?: string;
|
|
153
155
|
subgroupId?: string;
|
|
154
156
|
region?: string | string[];
|
|
@@ -157,6 +159,8 @@ export class Registrations {
|
|
|
157
159
|
status?: string | string[];
|
|
158
160
|
parentRegistrationId?: string;
|
|
159
161
|
phoneNumber?: string;
|
|
162
|
+
brandId?: string;
|
|
163
|
+
campaignId?: string;
|
|
160
164
|
sortBy?: string;
|
|
161
165
|
sortOrder?: string;
|
|
162
166
|
page?: number;
|
|
@@ -176,9 +180,73 @@ export class Registrations {
|
|
|
176
180
|
registrationId: string;
|
|
177
181
|
options?: RequestOptions;
|
|
178
182
|
}): Promise<SdkResponse<any>>;
|
|
183
|
+
/**
|
|
184
|
+
* Edit a draft, or a registration Signal House rejected, before submitting it (types that keep drafts, such as
|
|
185
|
+
* RCS_AGENT). `data` is a partial of the type's create fields: for RCS_AGENT `agent` and `consent` merge field by
|
|
186
|
+
* field, every other key replaces, and `campaignId: null` unlinks the campaign. 409 once submitted.
|
|
187
|
+
* @async
|
|
188
|
+
* @roles api, admin, developer, billing, user
|
|
189
|
+
* @param {Object} params - The parameters for the edit
|
|
190
|
+
* @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
191
|
+
* @param {Object} params.data - The fields to change
|
|
192
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
193
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the updated registration
|
|
194
|
+
*/
|
|
195
|
+
updateRegistration({ registrationId, data, options }: {
|
|
196
|
+
registrationId: string;
|
|
197
|
+
data: any;
|
|
198
|
+
options?: RequestOptions;
|
|
199
|
+
}): Promise<SdkResponse<any>>;
|
|
200
|
+
/**
|
|
201
|
+
* Check a draft against every submit requirement and the live state of its links, without writing
|
|
202
|
+
* @async
|
|
203
|
+
* @roles api, admin, developer, billing, user
|
|
204
|
+
* @param {Object} params - The parameters for the check
|
|
205
|
+
* @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
206
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
207
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { valid, errors: [{ field, reason }], warnings: [{ field, reason }] }
|
|
208
|
+
*/
|
|
209
|
+
validateRegistration({ registrationId, options }: {
|
|
210
|
+
registrationId: string;
|
|
211
|
+
options?: RequestOptions;
|
|
212
|
+
}): Promise<SdkResponse<any>>;
|
|
213
|
+
/**
|
|
214
|
+
* Submit a draft. A type Signal House reviews goes to SIGNAL_HOUSE_REVIEW; a type it does not (RCS_AGENT) goes to
|
|
215
|
+
* SUBMITTING and is filed with the provider at once. A draft that fails a requirement gets a 400 whose details carry
|
|
216
|
+
* { code: "REGISTRATION_INCOMPLETE", errors, warnings }; a second submit, or one of a registration the provider
|
|
217
|
+
* already holds, gets a 409.
|
|
218
|
+
* @async
|
|
219
|
+
* @roles api, admin, developer, billing, user
|
|
220
|
+
* @param {Object} params - The parameters for the submission
|
|
221
|
+
* @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
222
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
223
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, now SIGNAL_HOUSE_REVIEW or SUBMITTING
|
|
224
|
+
*/
|
|
225
|
+
submitRegistration({ registrationId, options }: {
|
|
226
|
+
registrationId: string;
|
|
227
|
+
options?: RequestOptions;
|
|
228
|
+
}): Promise<SdkResponse<any>>;
|
|
229
|
+
/**
|
|
230
|
+
* Request the launch of a registration the provider already holds (an RCS agent in testing): the launch requirements
|
|
231
|
+
* are checked and the registration goes to SIGNAL_HOUSE_REVIEW, whose approval files the provider's launch request.
|
|
232
|
+
* Allowed while the provider reports the agent ready for testing, after a Signal House rejection, or after every
|
|
233
|
+
* carrier refused an earlier launch (409 otherwise); a failed requirement is a 400 whose details carry
|
|
234
|
+
* { code: "REGISTRATION_INCOMPLETE", errors, warnings }.
|
|
235
|
+
* @async
|
|
236
|
+
* @roles api, admin, developer, billing, user
|
|
237
|
+
* @param {Object} params - The parameters for the launch request
|
|
238
|
+
* @param {string} params.registrationId - The registration ID (e.g. RCSA7K2M1QZ8RP)
|
|
239
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
240
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the registration, now SIGNAL_HOUSE_REVIEW
|
|
241
|
+
*/
|
|
242
|
+
launchRegistration({ registrationId, options }: {
|
|
243
|
+
registrationId: string;
|
|
244
|
+
options?: RequestOptions;
|
|
245
|
+
}): Promise<SdkResponse<any>>;
|
|
179
246
|
/**
|
|
180
247
|
* Cancel a registration. Allowed from SIGNAL_HOUSE_REVIEW, SIGNAL_HOUSE_APPROVED, PENDING_PROVIDER, NEEDS_INFORMATION,
|
|
181
|
-
* PAYMENT_REQUIRED and APPROVED (409 otherwise)
|
|
248
|
+
* PAYMENT_REQUIRED and APPROVED (409 otherwise), and for types that keep drafts also from DRAFT and SIGNAL_HOUSE_REJECTED.
|
|
249
|
+
* Numbers already allocated stay on the account and stop sending.
|
|
182
250
|
* @async
|
|
183
251
|
* @roles api, admin, developer, user
|
|
184
252
|
* @param {Object} params - The parameters for cancelling the registration
|
|
@@ -222,6 +222,21 @@ export class Templates {
|
|
|
222
222
|
provider?: ("infobip" | "sinch");
|
|
223
223
|
options?: RequestOptions;
|
|
224
224
|
}): Promise<SdkResponse<Capabilities>>;
|
|
225
|
+
/**
|
|
226
|
+
* Resolve an address to coordinates for a VIEW_LOCATION suggestion. 400 with code LOCATION_NOT_FOUND when nothing matches; 429 past the group's lookup window; 503 when the server has no geocoding provider
|
|
227
|
+
* @async
|
|
228
|
+
* @roles api, admin, developer
|
|
229
|
+
* @param {Object} params - The parameters for the lookup
|
|
230
|
+
* @param {string} params.groupId - The owning group
|
|
231
|
+
* @param {string} params.address - The address to resolve (1-512 characters)
|
|
232
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
233
|
+
* @returns {Promise<SdkResponse<GeocodeResult>>} A promise that resolves to the best match
|
|
234
|
+
*/
|
|
235
|
+
geocodeAddress({ groupId, address, options }: {
|
|
236
|
+
groupId: string;
|
|
237
|
+
address: string;
|
|
238
|
+
options?: RequestOptions;
|
|
239
|
+
}): Promise<SdkResponse<GeocodeResult>>;
|
|
225
240
|
/**
|
|
226
241
|
* Upload a media file for use in template bodies; returns its public URL. 503 when media storage is not configured
|
|
227
242
|
* @async
|
|
@@ -283,15 +298,19 @@ export type RcsTemplateBody = {
|
|
|
283
298
|
*/
|
|
284
299
|
channel: "rcs";
|
|
285
300
|
/**
|
|
286
|
-
* -
|
|
301
|
+
* - The format of `content`. Omitted means "content.v1", the block
|
|
302
|
+
* contract, which is the only format the API stores and returns. "google.rcs" sends Google's RBM AgentContentMessage
|
|
303
|
+
* as `content`; the API converts it to "content.v1" before validating or storing it
|
|
287
304
|
*/
|
|
288
|
-
contentFormat
|
|
305
|
+
contentFormat?: "content.v1" | "google.rcs";
|
|
289
306
|
/**
|
|
290
|
-
* -
|
|
307
|
+
* - For "content.v1", ordered blocks of kind text, richCard, video, carousel,
|
|
308
|
+
* suggestions or attachment (a VIEW_LOCATION suggestion takes latitude and longitude, or an address the API geocodes).
|
|
309
|
+
* For "google.rcs", the AgentContentMessage: one of text, richCard or contentInfo, plus suggestions
|
|
291
310
|
*/
|
|
292
311
|
content: {
|
|
293
312
|
blocks: any[];
|
|
294
|
-
};
|
|
313
|
+
} | any;
|
|
295
314
|
/**
|
|
296
315
|
* - Declared placeholders; omitted means []
|
|
297
316
|
*/
|
|
@@ -518,9 +537,13 @@ export type Capabilities = {
|
|
|
518
537
|
*/
|
|
519
538
|
channel: "rcs";
|
|
520
539
|
/**
|
|
521
|
-
* - The body
|
|
540
|
+
* - The format every body is stored and returned in
|
|
541
|
+
*/
|
|
542
|
+
contentFormat: "content.v1";
|
|
543
|
+
/**
|
|
544
|
+
* - Every format a body may be sent in ("content.v1", "google.rcs")
|
|
522
545
|
*/
|
|
523
|
-
|
|
546
|
+
contentFormats: string[];
|
|
524
547
|
/**
|
|
525
548
|
* - The validator version
|
|
526
549
|
*/
|
|
@@ -562,6 +585,12 @@ export type Capabilities = {
|
|
|
562
585
|
maxUploadBytes: number;
|
|
563
586
|
mimeTypes: string[];
|
|
564
587
|
};
|
|
588
|
+
/**
|
|
589
|
+
* - Whether this server resolves VIEW_LOCATION addresses (geocodeAddress answers 503 when false)
|
|
590
|
+
*/
|
|
591
|
+
geocoding: {
|
|
592
|
+
available: boolean;
|
|
593
|
+
};
|
|
565
594
|
/**
|
|
566
595
|
* - Provider-specific limits when a provider was requested
|
|
567
596
|
*/
|
|
@@ -578,3 +607,24 @@ export type Capabilities = {
|
|
|
578
607
|
}>;
|
|
579
608
|
} | null;
|
|
580
609
|
};
|
|
610
|
+
/**
|
|
611
|
+
* The best match for an address.
|
|
612
|
+
*/
|
|
613
|
+
export type GeocodeResult = {
|
|
614
|
+
/**
|
|
615
|
+
* - The provider's formatted address
|
|
616
|
+
*/
|
|
617
|
+
address: string;
|
|
618
|
+
/**
|
|
619
|
+
* - Latitude
|
|
620
|
+
*/
|
|
621
|
+
latitude: number;
|
|
622
|
+
/**
|
|
623
|
+
* - Longitude
|
|
624
|
+
*/
|
|
625
|
+
longitude: number;
|
|
626
|
+
/**
|
|
627
|
+
* - True when the provider matched only part of the address
|
|
628
|
+
*/
|
|
629
|
+
partialMatch: boolean;
|
|
630
|
+
};
|