@signalhouse-sms/sdk 1.8.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/SignalHouseSDK.js +2 -0
- package/src/domains/Brands.js +43 -119
- package/src/domains/Messages.js +61 -33
- package/src/domains/Rcs.js +466 -0
- package/src/domains/Registrations.js +77 -3
- package/src/domains/Templates.js +47 -7
- package/types/SignalHouseSDK.d.ts +2 -0
- package/types/domains/Brands.d.ts +96 -241
- package/types/domains/Messages.d.ts +60 -33
- package/types/domains/Rcs.d.ts +674 -0
- package/types/domains/Registrations.d.ts +71 -2
- package/types/domains/Templates.d.ts +106 -13
|
@@ -0,0 +1,674 @@
|
|
|
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
|
+
* 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
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* Build the multipart form for an agent image upload.
|
|
65
|
+
* @param {Object} params - Form fields
|
|
66
|
+
* @param {("logo"|"hero")} params.kind - Which image
|
|
67
|
+
* @param {Blob|File} params.file - The PNG or JPEG bytes
|
|
68
|
+
* @param {string} [params.fileName] - Optional file name
|
|
69
|
+
* @returns {FormData} - The form with kind and file fields
|
|
70
|
+
*/
|
|
71
|
+
export function agentAssetForm({ kind, file, fileName }: {
|
|
72
|
+
kind: ("logo" | "hero");
|
|
73
|
+
file: Blob | File;
|
|
74
|
+
fileName?: string;
|
|
75
|
+
}): FormData;
|
|
76
|
+
/**
|
|
77
|
+
* RCS agents under /rcs/agent. An agent links one brand and one campaign, of any registration type: the campaign's numbers are the
|
|
78
|
+
* SMS fallback, and the brand and campaign supply the company identity and consent text for the carrier launch.
|
|
79
|
+
* One brand or campaign can serve many agents. An agent is a registration (type RCS_AGENT, id RCSA…), so the
|
|
80
|
+
* registrations methods read and edit the same record. 404 while the environment's RCS switch is off; 400 while the
|
|
81
|
+
* group's rcsEnabled flag is off.
|
|
82
|
+
*/
|
|
83
|
+
export class RcsAgents {
|
|
84
|
+
constructor(client: any, multipartClient: any);
|
|
85
|
+
client: any;
|
|
86
|
+
multipartClient: any;
|
|
87
|
+
/**
|
|
88
|
+
* Create an agent draft on a brand, optionally with its campaign. The agent's subgroup is the brand's.
|
|
89
|
+
* Blank consent fields fill from the linked campaign. Pass options.idempotencyKey to make a retry safe.
|
|
90
|
+
* @async
|
|
91
|
+
* @roles api, admin, developer, billing, user
|
|
92
|
+
* @param {Object} params - The agent
|
|
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
|
|
95
|
+
* @param {RcsAgentProfile} [params.agent] - The agent profile
|
|
96
|
+
* @param {RcsAgentConsent} [params.consent] - The launch text; required in full before the launch request
|
|
97
|
+
* @param {RcsAgentContact} [params.contact] - The launch contact; required in full before the launch request
|
|
98
|
+
* @param {("OTP"|"TRANSACTIONAL"|"PROMOTIONAL"|"MULTI_USE")} [params.useCase] - The agent's use case; required before submit
|
|
99
|
+
* @param {("NON_CONVERSATIONAL"|"CONVERSATIONAL")} [params.billingCategory] - Default NON_CONVERSATIONAL; submit refuses CONVERSATIONAL
|
|
100
|
+
* @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
|
|
101
|
+
* @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
|
|
102
|
+
* @param {string[]} [params.testers] - Tester numbers (up to 200), invited once the agent exists at the carrier
|
|
103
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
104
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status DRAFT)
|
|
105
|
+
*/
|
|
106
|
+
create({ brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options }: {
|
|
107
|
+
brandId: string;
|
|
108
|
+
campaignId?: string | null;
|
|
109
|
+
agent?: RcsAgentProfile;
|
|
110
|
+
consent?: RcsAgentConsent;
|
|
111
|
+
contact?: RcsAgentContact;
|
|
112
|
+
useCase?: ("OTP" | "TRANSACTIONAL" | "PROMOTIONAL" | "MULTI_USE");
|
|
113
|
+
billingCategory?: ("NON_CONVERSATIONAL" | "CONVERSATIONAL");
|
|
114
|
+
defaultFallback?: {
|
|
115
|
+
mode?: string;
|
|
116
|
+
channel?: string;
|
|
117
|
+
from?: string;
|
|
118
|
+
} | null;
|
|
119
|
+
excludedCarriers?: string[];
|
|
120
|
+
testers?: string[];
|
|
121
|
+
options?: RequestOptions;
|
|
122
|
+
}): Promise<SdkResponse<any>>;
|
|
123
|
+
/**
|
|
124
|
+
* List agents, newest first
|
|
125
|
+
* @async
|
|
126
|
+
* @roles api, admin, developer, billing, user
|
|
127
|
+
* @param {Object} [params] - Filters
|
|
128
|
+
* @param {string} [params.groupId] - Filter by group ID
|
|
129
|
+
* @param {string} [params.subgroupId] - Filter by subgroup ID
|
|
130
|
+
* @param {string|string[]} [params.status] - DRAFT, PENDING_REVIEW, REJECTED, AGENT_CREATING or ARCHIVED, one or a list
|
|
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)
|
|
133
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
134
|
+
* @param {number} [params.limit] - Agents per page (default 25, max 100)
|
|
135
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
136
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { data: [agents], total, page, limit }
|
|
137
|
+
*/
|
|
138
|
+
list({ groupId, subgroupId, status, brandId, campaignId, page, limit, options }?: {
|
|
139
|
+
groupId?: string;
|
|
140
|
+
subgroupId?: string;
|
|
141
|
+
status?: string | string[];
|
|
142
|
+
brandId?: string;
|
|
143
|
+
campaignId?: string;
|
|
144
|
+
page?: number;
|
|
145
|
+
limit?: number;
|
|
146
|
+
options?: RequestOptions;
|
|
147
|
+
}): Promise<SdkResponse<any>>;
|
|
148
|
+
/**
|
|
149
|
+
* Get one agent with the live state of its brand and campaign links
|
|
150
|
+
* @async
|
|
151
|
+
* @roles api, admin, developer, billing, user
|
|
152
|
+
* @param {Object} params - The lookup
|
|
153
|
+
* @param {string} params.agentId - The agent ID (e.g. RCSA7K2M1QZ8RP)
|
|
154
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
155
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
156
|
+
*/
|
|
157
|
+
get({ agentId, options }: {
|
|
158
|
+
agentId: string;
|
|
159
|
+
options?: RequestOptions;
|
|
160
|
+
}): Promise<SdkResponse<any>>;
|
|
161
|
+
/**
|
|
162
|
+
* Edit an agent while it may change: a draft, a Signal House rejection, a request for changes, or an agent in
|
|
163
|
+
* testing (the change is pushed to the carrier partner). `agent`, `consent` and `contact` merge field by field;
|
|
164
|
+
* every other key replaces; campaignId: null unlinks the campaign. 409 in any other status; brandId is locked once
|
|
165
|
+
* the agent exists at the partner and billingCategory once a launch was requested.
|
|
166
|
+
* @async
|
|
167
|
+
* @roles api, admin, developer, billing, user
|
|
168
|
+
* @param {Object} params - The edit
|
|
169
|
+
* @param {string} params.agentId - The agent ID
|
|
170
|
+
* @param {string} [params.brandId] - Relink to another brand of the same subgroup
|
|
171
|
+
* @param {string|null} [params.campaignId] - Link, relink or (null) unlink the campaign
|
|
172
|
+
* @param {RcsAgentProfile} [params.agent] - Profile fields to change
|
|
173
|
+
* @param {RcsAgentConsent} [params.consent] - Consent fields to change
|
|
174
|
+
* @param {RcsAgentContact} [params.contact] - Contact fields to change
|
|
175
|
+
* @param {string|null} [params.useCase] - The use case
|
|
176
|
+
* @param {string} [params.billingCategory] - The billing category
|
|
177
|
+
* @param {Object|null} [params.defaultFallback] - The fallback
|
|
178
|
+
* @param {string[]} [params.excludedCarriers] - [] or ["T_MOBILE"] (the carrier partner's carrier name)
|
|
179
|
+
* @param {string[]} [params.testers] - Tester numbers
|
|
180
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
181
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
182
|
+
*/
|
|
183
|
+
update({ agentId, brandId, campaignId, agent, consent, contact, useCase, billingCategory, defaultFallback, excludedCarriers, testers, options }: {
|
|
184
|
+
agentId: string;
|
|
185
|
+
brandId?: string;
|
|
186
|
+
campaignId?: string | null;
|
|
187
|
+
agent?: RcsAgentProfile;
|
|
188
|
+
consent?: RcsAgentConsent;
|
|
189
|
+
contact?: RcsAgentContact;
|
|
190
|
+
useCase?: string | null;
|
|
191
|
+
billingCategory?: string;
|
|
192
|
+
defaultFallback?: any | null;
|
|
193
|
+
excludedCarriers?: string[];
|
|
194
|
+
testers?: string[];
|
|
195
|
+
options?: RequestOptions;
|
|
196
|
+
}): Promise<SdkResponse<any>>;
|
|
197
|
+
/**
|
|
198
|
+
* Check an agent against the next gate on its path without writing: before it exists at the carrier partner, what
|
|
199
|
+
* creating it needs (the full profile, useCase, NON_CONVERSATIONAL billing); after that, what the launch request needs
|
|
200
|
+
* (a VERIFIED brand, the campaign, the full consent with the video, the contact)
|
|
201
|
+
* @async
|
|
202
|
+
* @roles api, admin, developer, billing, user
|
|
203
|
+
* @param {Object} params - The lookup
|
|
204
|
+
* @param {string} params.agentId - The agent ID
|
|
205
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
206
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { valid, errors: [{ field, reason }], warnings: [{ field, reason }] }
|
|
207
|
+
*/
|
|
208
|
+
validate({ agentId, options }: {
|
|
209
|
+
agentId: string;
|
|
210
|
+
options?: RequestOptions;
|
|
211
|
+
}): Promise<SdkResponse<any>>;
|
|
212
|
+
/**
|
|
213
|
+
* Submit a draft: create the agent at the carrier partner, with no review first. It needs the full profile, a
|
|
214
|
+
* useCase and NON_CONVERSATIONAL billing; otherwise a 400 whose details carry { code: "REGISTRATION_INCOMPLETE",
|
|
215
|
+
* errors, warnings }. The agent moves to AGENT_CREATING, then IN_TESTING once the partner reports it ready.
|
|
216
|
+
* @async
|
|
217
|
+
* @roles api, admin, developer, billing, user
|
|
218
|
+
* @param {Object} params - The submission
|
|
219
|
+
* @param {string} params.agentId - The agent ID
|
|
220
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
221
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status AGENT_CREATING)
|
|
222
|
+
*/
|
|
223
|
+
submit({ agentId, options }: {
|
|
224
|
+
agentId: string;
|
|
225
|
+
options?: RequestOptions;
|
|
226
|
+
}): Promise<SdkResponse<any>>;
|
|
227
|
+
/**
|
|
228
|
+
* Request the agent's launch: the launch requirements are checked and the agent goes to Signal House review (status
|
|
229
|
+
* PENDING_REVIEW), whose approval files the launch with the carrier partner. Allowed from IN_TESTING, REJECTED and
|
|
230
|
+
* CARRIER_REJECTED (409 otherwise); a failed requirement is a 400 whose details carry { code:
|
|
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.
|
|
233
|
+
* @async
|
|
234
|
+
* @roles api, admin, developer, billing, user
|
|
235
|
+
* @param {Object} params - The launch request
|
|
236
|
+
* @param {string} params.agentId - The agent ID
|
|
237
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
238
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status PENDING_REVIEW)
|
|
239
|
+
*/
|
|
240
|
+
launch({ agentId, options }: {
|
|
241
|
+
agentId: string;
|
|
242
|
+
options?: RequestOptions;
|
|
243
|
+
}): Promise<SdkResponse<any>>;
|
|
244
|
+
/**
|
|
245
|
+
* Archive an agent
|
|
246
|
+
* @async
|
|
247
|
+
* @roles api, admin, developer, user
|
|
248
|
+
* @param {Object} params - The archive request
|
|
249
|
+
* @param {string} params.agentId - The agent ID
|
|
250
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
251
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent (status ARCHIVED)
|
|
252
|
+
*/
|
|
253
|
+
archive({ agentId, options }: {
|
|
254
|
+
agentId: string;
|
|
255
|
+
options?: RequestOptions;
|
|
256
|
+
}): Promise<SdkResponse<any>>;
|
|
257
|
+
/**
|
|
258
|
+
* Resend a tester's expired invitation, which starts a new 24 hours for the tester to accept it. The number must be
|
|
259
|
+
* a tester on the agent (404) and its invitation must be EXPIRED (409); up to 20 invitations go out a day (429).
|
|
260
|
+
* @async
|
|
261
|
+
* @roles api, admin, developer, billing, user
|
|
262
|
+
* @param {Object} params - The resend request
|
|
263
|
+
* @param {string} params.agentId - The agent ID
|
|
264
|
+
* @param {string} params.phoneNumber - The tester's US number, with or without the +
|
|
265
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
266
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent
|
|
267
|
+
*/
|
|
268
|
+
resendTesterInvite({ agentId, phoneNumber, options }: {
|
|
269
|
+
agentId: string;
|
|
270
|
+
phoneNumber: string;
|
|
271
|
+
options?: RequestOptions;
|
|
272
|
+
}): Promise<SdkResponse<any>>;
|
|
273
|
+
/**
|
|
274
|
+
* 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
|
|
275
|
+
* it on the draft. Images of any other size are refused.
|
|
276
|
+
* @async
|
|
277
|
+
* @roles api, admin, developer, billing, user
|
|
278
|
+
* @param {Object} params - The upload
|
|
279
|
+
* @param {string} params.agentId - The agent ID
|
|
280
|
+
* @param {("logo"|"hero")} params.kind - Which image
|
|
281
|
+
* @param {Blob|File} params.file - The image bytes
|
|
282
|
+
* @param {string} [params.fileName] - Optional file name
|
|
283
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
284
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to the agent with the new URL
|
|
285
|
+
*/
|
|
286
|
+
uploadAsset({ agentId, kind, file, fileName, options }: {
|
|
287
|
+
agentId: string;
|
|
288
|
+
kind: ("logo" | "hero");
|
|
289
|
+
file: Blob | File;
|
|
290
|
+
fileName?: string;
|
|
291
|
+
options?: RequestOptions;
|
|
292
|
+
}): Promise<SdkResponse<any>>;
|
|
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
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* RCS (Google RBM) resources. Templates for RCS live under `templates`.
|
|
489
|
+
*/
|
|
490
|
+
export class Rcs {
|
|
491
|
+
constructor(client: any, multipartClient: any);
|
|
492
|
+
agents: RcsAgents;
|
|
493
|
+
messages: RcsMessages;
|
|
494
|
+
}
|
|
495
|
+
export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
|
|
496
|
+
export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|
|
497
|
+
export type RcsAgentProfile = {
|
|
498
|
+
/**
|
|
499
|
+
* - Agent name shown on the handset (max 40)
|
|
500
|
+
*/
|
|
501
|
+
name?: string;
|
|
502
|
+
/**
|
|
503
|
+
* - Agent description (max 100)
|
|
504
|
+
*/
|
|
505
|
+
description?: string;
|
|
506
|
+
/**
|
|
507
|
+
* - Brand color, hex (default #6868ab)
|
|
508
|
+
*/
|
|
509
|
+
color?: string;
|
|
510
|
+
/**
|
|
511
|
+
* - HTTPS URL of a 224 × 224 px logo (use uploadAsset to host one)
|
|
512
|
+
*/
|
|
513
|
+
logoUrl?: string;
|
|
514
|
+
/**
|
|
515
|
+
* - HTTPS URL of a 1440 × 448 px hero image
|
|
516
|
+
*/
|
|
517
|
+
heroUrl?: string;
|
|
518
|
+
/**
|
|
519
|
+
* - Contact phone, E.164 (e.g. +18005550142)
|
|
520
|
+
*/
|
|
521
|
+
phone?: string;
|
|
522
|
+
/**
|
|
523
|
+
* - HTTPS website
|
|
524
|
+
*/
|
|
525
|
+
website?: string;
|
|
526
|
+
/**
|
|
527
|
+
* - Contact email
|
|
528
|
+
*/
|
|
529
|
+
email?: string;
|
|
530
|
+
/**
|
|
531
|
+
* - Caption on the Call action (max 40; submit defaults it to "Call")
|
|
532
|
+
*/
|
|
533
|
+
phoneLabel?: string;
|
|
534
|
+
/**
|
|
535
|
+
* - Caption on the Website action (max 40; submit defaults it to "Website")
|
|
536
|
+
*/
|
|
537
|
+
websiteLabel?: string;
|
|
538
|
+
/**
|
|
539
|
+
* - Caption on the Email action (max 40; submit defaults it to "Email")
|
|
540
|
+
*/
|
|
541
|
+
emailLabel?: string;
|
|
542
|
+
/**
|
|
543
|
+
* - HTTPS privacy policy URL
|
|
544
|
+
*/
|
|
545
|
+
privacyPolicyUrl?: string;
|
|
546
|
+
/**
|
|
547
|
+
* - HTTPS terms of service URL
|
|
548
|
+
*/
|
|
549
|
+
termsUrl?: string;
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* The agent's launch text. Every field is required before submit, the opt-in URL and the launch video included.
|
|
553
|
+
*/
|
|
554
|
+
export type RcsAgentConsent = {
|
|
555
|
+
/**
|
|
556
|
+
* - How recipients opt in (filled from the campaign's messageFlow when blank)
|
|
557
|
+
*/
|
|
558
|
+
optInDetails?: string;
|
|
559
|
+
/**
|
|
560
|
+
* - HTTPS page that shows the opt-in
|
|
561
|
+
*/
|
|
562
|
+
optInUrl?: string;
|
|
563
|
+
/**
|
|
564
|
+
* - The opt-in confirmation (filled from the campaign's optinMessage)
|
|
565
|
+
*/
|
|
566
|
+
optInResponse?: string;
|
|
567
|
+
/**
|
|
568
|
+
* - How recipients opt out
|
|
569
|
+
*/
|
|
570
|
+
optOutDetails?: string;
|
|
571
|
+
/**
|
|
572
|
+
* - The opt-out confirmation (filled from the campaign's optoutMessage)
|
|
573
|
+
*/
|
|
574
|
+
optOutResponse?: string;
|
|
575
|
+
/**
|
|
576
|
+
* - The HELP reply (filled from the campaign's helpMessage)
|
|
577
|
+
*/
|
|
578
|
+
helpResponse?: string;
|
|
579
|
+
/**
|
|
580
|
+
* - What the agent sends (filled from the campaign's description)
|
|
581
|
+
*/
|
|
582
|
+
campaignDescription?: string;
|
|
583
|
+
/**
|
|
584
|
+
* - 1-6 example messages (filled from the campaign's samples)
|
|
585
|
+
*/
|
|
586
|
+
messageExamples?: string[];
|
|
587
|
+
/**
|
|
588
|
+
* - Expected monthly volume
|
|
589
|
+
*/
|
|
590
|
+
estimatedMonthlyVolume?: ("UP_TO_10K" | "10K_100K" | "100K_500K" | "500K_1M" | "1M_PLUS");
|
|
591
|
+
/**
|
|
592
|
+
* - HTTPS video of the opt-in flow
|
|
593
|
+
*/
|
|
594
|
+
launchVideoUrl?: string;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* The individual at the brand the carrier partner's reviewers may contact about the launch. Every field is required
|
|
598
|
+
* before the launch request; a shared mailbox (support@, info@) is refused.
|
|
599
|
+
*/
|
|
600
|
+
export type RcsAgentContact = {
|
|
601
|
+
/**
|
|
602
|
+
* - First name (max 100)
|
|
603
|
+
*/
|
|
604
|
+
firstName?: string;
|
|
605
|
+
/**
|
|
606
|
+
* - Last name (max 100)
|
|
607
|
+
*/
|
|
608
|
+
lastName?: string;
|
|
609
|
+
/**
|
|
610
|
+
* - Role at the brand (3-75)
|
|
611
|
+
*/
|
|
612
|
+
role?: string;
|
|
613
|
+
/**
|
|
614
|
+
* - An individual's business email
|
|
615
|
+
*/
|
|
616
|
+
email?: string;
|
|
617
|
+
/**
|
|
618
|
+
* - Mobile number, E.164
|
|
619
|
+
*/
|
|
620
|
+
mobile?: string;
|
|
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
|
+
};
|