rcs-js 2.0.14 → 2.0.16
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/campaigns/resources/rcs/client/Client.d.ts +6 -12
- package/dist/cjs/api/resources/campaigns/resources/rcs/client/Client.js +6 -12
- package/dist/cjs/api/resources/campaigns/resources/rcs/client/requests/UpsertRcsCampaignParams.d.ts +12 -32
- package/dist/cjs/api/resources/messages/resources/rcs/client/Client.d.ts +0 -10
- package/dist/cjs/api/resources/messages/resources/rcs/client/Client.js +0 -10
- package/dist/cjs/api/resources/phoneNumbers/client/Client.d.ts +0 -3
- package/dist/cjs/api/resources/phoneNumbers/client/Client.js +0 -5
- package/dist/cjs/api/resources/phoneNumbers/resources/index.d.ts +0 -1
- package/dist/cjs/api/resources/phoneNumbers/resources/index.js +1 -2
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +43 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +157 -0
- package/dist/cjs/api/resources/webhooks/client/requests/AttachWebhookParams.d.ts +23 -0
- package/dist/cjs/api/resources/webhooks/client/requests/DetachWebhookParams.d.ts +13 -0
- package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/types/AttachWebhookResult.d.ts +22 -0
- package/dist/cjs/api/types/BaseRichMessage.d.ts +18 -1
- package/dist/cjs/api/types/DetachWebhookResult.d.ts +9 -0
- package/dist/cjs/api/types/ExtendedBrandWithVetting.d.ts +2 -2
- package/dist/cjs/api/types/ExtendedRcsCampaign.d.ts +6 -20
- package/dist/cjs/api/types/FailedSender.d.ts +6 -0
- package/dist/cjs/api/types/FailedSender.js +3 -0
- package/dist/cjs/api/types/RcsCampaign.d.ts +6 -20
- package/dist/cjs/api/types/RcsCampaignSummary.d.ts +0 -2
- package/dist/cjs/api/types/RcsCardsContent.d.ts +1 -1
- package/dist/cjs/api/types/RcsMediaContent.d.ts +1 -1
- package/dist/cjs/api/types/RcsValidateContent.d.ts +1 -1
- package/dist/cjs/api/types/RichCards.d.ts +1 -1
- package/dist/cjs/api/types/RichCardsMessage.d.ts +15 -1
- package/dist/cjs/api/types/RichMediaMessage.d.ts +1 -1
- package/dist/cjs/api/types/RichText.d.ts +1 -1
- package/dist/cjs/api/types/{SendRichMessageOptions.d.ts → SendRichMessageOptions4.d.ts} +1 -1
- package/dist/cjs/api/types/SendRichMessageOptions4.js +3 -0
- package/dist/cjs/api/types/SentRichMessageFallbackMms.d.ts +1 -1
- package/dist/cjs/api/types/SentRichMessageFallbackSms.d.ts +1 -1
- package/dist/cjs/api/types/SuccessfulConversationUpdate.d.ts +1 -1
- package/dist/cjs/api/types/VcardContent.d.ts +1 -1
- package/dist/cjs/api/types/WebhookEventEnum.d.ts +3 -2
- package/dist/cjs/api/types/WebhookEventEnum.js +3 -2
- package/dist/cjs/api/types/index.d.ts +4 -5
- package/dist/cjs/api/types/index.js +4 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/campaigns/resources/rcs/client/Client.d.mts +6 -12
- package/dist/esm/api/resources/campaigns/resources/rcs/client/Client.mjs +6 -12
- package/dist/esm/api/resources/campaigns/resources/rcs/client/requests/UpsertRcsCampaignParams.d.mts +12 -32
- package/dist/esm/api/resources/messages/resources/rcs/client/Client.d.mts +0 -10
- package/dist/esm/api/resources/messages/resources/rcs/client/Client.mjs +0 -10
- package/dist/esm/api/resources/phoneNumbers/client/Client.d.mts +0 -3
- package/dist/esm/api/resources/phoneNumbers/client/Client.mjs +0 -5
- package/dist/esm/api/resources/phoneNumbers/resources/index.d.mts +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/index.mjs +0 -1
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +43 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +157 -0
- package/dist/esm/api/resources/webhooks/client/requests/AttachWebhookParams.d.mts +23 -0
- package/dist/esm/api/resources/webhooks/client/requests/DetachWebhookParams.d.mts +13 -0
- package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +2 -0
- package/dist/esm/api/types/AttachWebhookResult.d.mts +22 -0
- package/dist/esm/api/types/BaseRichMessage.d.mts +18 -1
- package/dist/esm/api/types/DetachWebhookResult.d.mts +9 -0
- package/dist/esm/api/types/ExtendedBrandWithVetting.d.mts +2 -2
- package/dist/esm/api/types/ExtendedRcsCampaign.d.mts +6 -20
- package/dist/esm/api/types/FailedSender.d.mts +6 -0
- package/dist/esm/api/types/FailedSender.mjs +2 -0
- package/dist/esm/api/types/RcsCampaign.d.mts +6 -20
- package/dist/esm/api/types/RcsCampaignSummary.d.mts +0 -2
- package/dist/esm/api/types/RcsCardsContent.d.mts +1 -1
- package/dist/esm/api/types/RcsMediaContent.d.mts +1 -1
- package/dist/esm/api/types/RcsValidateContent.d.mts +1 -1
- package/dist/esm/api/types/RichCards.d.mts +1 -1
- package/dist/esm/api/types/RichCardsMessage.d.mts +15 -1
- package/dist/esm/api/types/RichMediaMessage.d.mts +1 -1
- package/dist/esm/api/types/RichText.d.mts +1 -1
- package/dist/esm/api/types/{SendRichMessageOptions.d.mts → SendRichMessageOptions4.d.mts} +1 -1
- package/dist/esm/api/types/SendRichMessageOptions4.mjs +2 -0
- package/dist/esm/api/types/SentRichMessageFallbackMms.d.mts +1 -1
- package/dist/esm/api/types/SentRichMessageFallbackSms.d.mts +1 -1
- package/dist/esm/api/types/SuccessfulConversationUpdate.d.mts +1 -1
- package/dist/esm/api/types/VcardContent.d.mts +1 -1
- package/dist/esm/api/types/WebhookEventEnum.d.mts +3 -2
- package/dist/esm/api/types/WebhookEventEnum.mjs +3 -2
- package/dist/esm/api/types/index.d.mts +4 -5
- package/dist/esm/api/types/index.mjs +4 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +143 -182
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/Client.d.ts +0 -63
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/Client.js +0 -231
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/client/index.js +0 -2
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/index.d.ts +0 -1
- package/dist/cjs/api/resources/phoneNumbers/resources/webhook/index.js +0 -17
- package/dist/cjs/api/types/AttachWebhookParams.d.ts +0 -19
- package/dist/cjs/api/types/ConfiguredWebhook.d.ts +0 -32
- package/dist/cjs/api/types/DetachedWebhookInfo.d.ts +0 -8
- package/dist/cjs/api/types/RcsCampaignUseCaseEnum.d.ts +0 -37
- package/dist/cjs/api/types/RcsCampaignUseCaseEnum.js +0 -40
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/Client.d.mts +0 -63
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/Client.mjs +0 -194
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/index.d.mts +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/client/index.mjs +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/index.d.mts +0 -1
- package/dist/esm/api/resources/phoneNumbers/resources/webhook/index.mjs +0 -1
- package/dist/esm/api/types/AttachWebhookParams.d.mts +0 -19
- package/dist/esm/api/types/ConfiguredWebhook.d.mts +0 -32
- package/dist/esm/api/types/DetachedWebhookInfo.d.mts +0 -8
- package/dist/esm/api/types/RcsCampaignUseCaseEnum.d.mts +0 -37
- package/dist/esm/api/types/RcsCampaignUseCaseEnum.mjs +0 -37
- /package/dist/cjs/api/{types → resources/webhooks/client/requests}/AttachWebhookParams.js +0 -0
- /package/dist/cjs/api/{types/ConfiguredWebhook.js → resources/webhooks/client/requests/DetachWebhookParams.js} +0 -0
- /package/dist/cjs/api/types/{DetachedWebhookInfo.js → AttachWebhookResult.js} +0 -0
- /package/dist/cjs/api/types/{SendRichMessageOptions.js → DetachWebhookResult.js} +0 -0
- /package/dist/esm/api/{types → resources/webhooks/client/requests}/AttachWebhookParams.mjs +0 -0
- /package/dist/esm/api/{types/ConfiguredWebhook.mjs → resources/webhooks/client/requests/DetachWebhookParams.mjs} +0 -0
- /package/dist/esm/api/types/{DetachedWebhookInfo.mjs → AttachWebhookResult.mjs} +0 -0
- /package/dist/esm/api/types/{SendRichMessageOptions.mjs → DetachWebhookResult.mjs} +0 -0
|
@@ -2,7 +2,6 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
|
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import * as Pinnacle from "../../../index.mjs";
|
|
4
4
|
import { Campaign } from "../resources/campaign/client/Client.mjs";
|
|
5
|
-
import { Webhook } from "../resources/webhook/client/Client.mjs";
|
|
6
5
|
export declare namespace PhoneNumbers {
|
|
7
6
|
interface Options extends BaseClientOptions {
|
|
8
7
|
}
|
|
@@ -11,10 +10,8 @@ export declare namespace PhoneNumbers {
|
|
|
11
10
|
}
|
|
12
11
|
export declare class PhoneNumbers {
|
|
13
12
|
protected readonly _options: PhoneNumbers.Options;
|
|
14
|
-
protected _webhook: Webhook | undefined;
|
|
15
13
|
protected _campaign: Campaign | undefined;
|
|
16
14
|
constructor(_options: PhoneNumbers.Options);
|
|
17
|
-
get webhook(): Webhook;
|
|
18
15
|
get campaign(): Campaign;
|
|
19
16
|
/**
|
|
20
17
|
* Search for available phone numbers that match your exact criteria.
|
|
@@ -14,15 +14,10 @@ import * as environments from "../../../../environments.mjs";
|
|
|
14
14
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
15
|
import * as Pinnacle from "../../../index.mjs";
|
|
16
16
|
import { Campaign } from "../resources/campaign/client/Client.mjs";
|
|
17
|
-
import { Webhook } from "../resources/webhook/client/Client.mjs";
|
|
18
17
|
export class PhoneNumbers {
|
|
19
18
|
constructor(_options) {
|
|
20
19
|
this._options = _options;
|
|
21
20
|
}
|
|
22
|
-
get webhook() {
|
|
23
|
-
var _a;
|
|
24
|
-
return ((_a = this._webhook) !== null && _a !== void 0 ? _a : (this._webhook = new Webhook(this._options)));
|
|
25
|
-
}
|
|
26
21
|
get campaign() {
|
|
27
22
|
var _a;
|
|
28
23
|
return ((_a = this._campaign) !== null && _a !== void 0 ? _a : (this._campaign = new Campaign(this._options)));
|
|
@@ -43,5 +43,48 @@ export declare class Webhooks {
|
|
|
43
43
|
*/
|
|
44
44
|
list(request?: Pinnacle.ListWebhooksParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.ListWebhooksResponse>;
|
|
45
45
|
private __list;
|
|
46
|
+
/**
|
|
47
|
+
* Attach a webhook to one or more senders (phone numbers or RCS agent IDs) to receive real-time event notifications. <br>
|
|
48
|
+
*
|
|
49
|
+
* You can attach an existing webhook by providing its ID, or create a new webhook by specifying a name and URL. Supports bulk operations with up to 50 senders per request. <br>
|
|
50
|
+
*
|
|
51
|
+
* Subscriptions are additive — attaching new senders does not remove existing ones. Re-attaching the same sender updates the event type filter without creating duplicates.
|
|
52
|
+
*
|
|
53
|
+
* @param {Pinnacle.AttachWebhookParams} request
|
|
54
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
55
|
+
*
|
|
56
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
57
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
58
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
59
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* await client.webhooks.attach({
|
|
63
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
64
|
+
* })
|
|
65
|
+
*/
|
|
66
|
+
attach(request: Pinnacle.AttachWebhookParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.AttachWebhookResult>;
|
|
67
|
+
private __attach;
|
|
68
|
+
/**
|
|
69
|
+
* Detach a webhook from one or more senders (phone numbers or RCS agent IDs) to stop receiving event notifications. <br>
|
|
70
|
+
*
|
|
71
|
+
* The webhook itself is not deleted and remains available for use with other senders. Works regardless of webhook status. Supports bulk operations with up to 50 senders per request.
|
|
72
|
+
*
|
|
73
|
+
* @param {Pinnacle.DetachWebhookParams} request
|
|
74
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
|
+
*
|
|
76
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
77
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
78
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
79
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.webhooks.detach({
|
|
83
|
+
* webhookId: "webhookId",
|
|
84
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
85
|
+
* })
|
|
86
|
+
*/
|
|
87
|
+
detach(request: Pinnacle.DetachWebhookParams, requestOptions?: Webhooks.RequestOptions): core.HttpResponsePromise<Pinnacle.DetachWebhookResult>;
|
|
88
|
+
private __detach;
|
|
46
89
|
protected _getCustomAuthorizationHeaders(): Promise<Record<string, string | undefined>>;
|
|
47
90
|
}
|
|
@@ -162,6 +162,163 @@ export class Webhooks {
|
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Attach a webhook to one or more senders (phone numbers or RCS agent IDs) to receive real-time event notifications. <br>
|
|
167
|
+
*
|
|
168
|
+
* You can attach an existing webhook by providing its ID, or create a new webhook by specifying a name and URL. Supports bulk operations with up to 50 senders per request. <br>
|
|
169
|
+
*
|
|
170
|
+
* Subscriptions are additive — attaching new senders does not remove existing ones. Re-attaching the same sender updates the event type filter without creating duplicates.
|
|
171
|
+
*
|
|
172
|
+
* @param {Pinnacle.AttachWebhookParams} request
|
|
173
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
174
|
+
*
|
|
175
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
176
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
177
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
178
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* await client.webhooks.attach({
|
|
182
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
183
|
+
* })
|
|
184
|
+
*/
|
|
185
|
+
attach(request, requestOptions) {
|
|
186
|
+
return core.HttpResponsePromise.fromPromise(this.__attach(request, requestOptions));
|
|
187
|
+
}
|
|
188
|
+
__attach(request, requestOptions) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
191
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
192
|
+
const _response = yield core.fetcher({
|
|
193
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "webhooks/attach"),
|
|
194
|
+
method: "POST",
|
|
195
|
+
headers: _headers,
|
|
196
|
+
contentType: "application/json",
|
|
197
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
198
|
+
requestType: "json",
|
|
199
|
+
body: request,
|
|
200
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
201
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
202
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
203
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
204
|
+
logging: this._options.logging,
|
|
205
|
+
});
|
|
206
|
+
if (_response.ok) {
|
|
207
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
208
|
+
}
|
|
209
|
+
if (_response.error.reason === "status-code") {
|
|
210
|
+
switch (_response.error.statusCode) {
|
|
211
|
+
case 400:
|
|
212
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
213
|
+
case 401:
|
|
214
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
215
|
+
case 404:
|
|
216
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
217
|
+
case 500:
|
|
218
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
219
|
+
default:
|
|
220
|
+
throw new errors.PinnacleError({
|
|
221
|
+
statusCode: _response.error.statusCode,
|
|
222
|
+
body: _response.error.body,
|
|
223
|
+
rawResponse: _response.rawResponse,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
switch (_response.error.reason) {
|
|
228
|
+
case "non-json":
|
|
229
|
+
throw new errors.PinnacleError({
|
|
230
|
+
statusCode: _response.error.statusCode,
|
|
231
|
+
body: _response.error.rawBody,
|
|
232
|
+
rawResponse: _response.rawResponse,
|
|
233
|
+
});
|
|
234
|
+
case "timeout":
|
|
235
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /webhooks/attach.");
|
|
236
|
+
case "unknown":
|
|
237
|
+
throw new errors.PinnacleError({
|
|
238
|
+
message: _response.error.errorMessage,
|
|
239
|
+
rawResponse: _response.rawResponse,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Detach a webhook from one or more senders (phone numbers or RCS agent IDs) to stop receiving event notifications. <br>
|
|
246
|
+
*
|
|
247
|
+
* The webhook itself is not deleted and remains available for use with other senders. Works regardless of webhook status. Supports bulk operations with up to 50 senders per request.
|
|
248
|
+
*
|
|
249
|
+
* @param {Pinnacle.DetachWebhookParams} request
|
|
250
|
+
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
251
|
+
*
|
|
252
|
+
* @throws {@link Pinnacle.BadRequestError}
|
|
253
|
+
* @throws {@link Pinnacle.UnauthorizedError}
|
|
254
|
+
* @throws {@link Pinnacle.NotFoundError}
|
|
255
|
+
* @throws {@link Pinnacle.InternalServerError}
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* await client.webhooks.detach({
|
|
259
|
+
* webhookId: "webhookId",
|
|
260
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
261
|
+
* })
|
|
262
|
+
*/
|
|
263
|
+
detach(request, requestOptions) {
|
|
264
|
+
return core.HttpResponsePromise.fromPromise(this.__detach(request, requestOptions));
|
|
265
|
+
}
|
|
266
|
+
__detach(request, requestOptions) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
269
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
270
|
+
const _response = yield core.fetcher({
|
|
271
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PinnacleEnvironment.Default, "webhooks/detach"),
|
|
272
|
+
method: "POST",
|
|
273
|
+
headers: _headers,
|
|
274
|
+
contentType: "application/json",
|
|
275
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
276
|
+
requestType: "json",
|
|
277
|
+
body: request,
|
|
278
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
279
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
280
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
281
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
282
|
+
logging: this._options.logging,
|
|
283
|
+
});
|
|
284
|
+
if (_response.ok) {
|
|
285
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
286
|
+
}
|
|
287
|
+
if (_response.error.reason === "status-code") {
|
|
288
|
+
switch (_response.error.statusCode) {
|
|
289
|
+
case 400:
|
|
290
|
+
throw new Pinnacle.BadRequestError(_response.error.body, _response.rawResponse);
|
|
291
|
+
case 401:
|
|
292
|
+
throw new Pinnacle.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
293
|
+
case 404:
|
|
294
|
+
throw new Pinnacle.NotFoundError(_response.error.body, _response.rawResponse);
|
|
295
|
+
case 500:
|
|
296
|
+
throw new Pinnacle.InternalServerError(_response.error.body, _response.rawResponse);
|
|
297
|
+
default:
|
|
298
|
+
throw new errors.PinnacleError({
|
|
299
|
+
statusCode: _response.error.statusCode,
|
|
300
|
+
body: _response.error.body,
|
|
301
|
+
rawResponse: _response.rawResponse,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
switch (_response.error.reason) {
|
|
306
|
+
case "non-json":
|
|
307
|
+
throw new errors.PinnacleError({
|
|
308
|
+
statusCode: _response.error.statusCode,
|
|
309
|
+
body: _response.error.rawBody,
|
|
310
|
+
rawResponse: _response.rawResponse,
|
|
311
|
+
});
|
|
312
|
+
case "timeout":
|
|
313
|
+
throw new errors.PinnacleTimeoutError("Timeout exceeded when calling POST /webhooks/detach.");
|
|
314
|
+
case "unknown":
|
|
315
|
+
throw new errors.PinnacleError({
|
|
316
|
+
message: _response.error.errorMessage,
|
|
317
|
+
rawResponse: _response.rawResponse,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
165
322
|
_getCustomAuthorizationHeaders() {
|
|
166
323
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
324
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as Pinnacle from "../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface AttachWebhookParams {
|
|
9
|
+
/** Array of senders to attach the webhook to. Can be phone numbers in E.164 format or RCS agent IDs. */
|
|
10
|
+
senders: string[];
|
|
11
|
+
/** Existing webhook ID (starts with `wh_`). Provide this OR `name` + `url` to create a new webhook. The webhook must be in ENABLED status. Disabled webhooks can be re-enabled from the [dashboard](https://app.pinnacle.sh/dashboard/development/webhooks). */
|
|
12
|
+
webhookId?: string;
|
|
13
|
+
/** Name for a new webhook (required if no `webhookId`). */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** HTTPS endpoint URL for a new webhook (required if no `webhookId`). */
|
|
16
|
+
url?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Event type filter for the subscription. Set to `null` to receive all events. <br>
|
|
19
|
+
*
|
|
20
|
+
* `USER.TYPING` is only supported for RCS agent senders, not phone numbers.
|
|
21
|
+
*/
|
|
22
|
+
event?: Pinnacle.WebhookEventEnum | null;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* webhookId: "webhookId",
|
|
5
|
+
* senders: ["+14155551234", "agent_abc123"]
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface DetachWebhookParams {
|
|
9
|
+
/** Webhook ID to detach (starts with `wh_`). Must be a webhook owned by your team. */
|
|
10
|
+
webhookId: string;
|
|
11
|
+
/** Array of senders to detach the webhook from. Can be phone numbers in E.164 format or RCS agent IDs. */
|
|
12
|
+
senders: string[];
|
|
13
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
export type { AttachWebhookParams } from "./AttachWebhookParams.mjs";
|
|
2
|
+
export type { DetachWebhookParams } from "./DetachWebhookParams.mjs";
|
|
1
3
|
export type { GetWebhookParams } from "./GetWebhookParams.mjs";
|
|
2
4
|
export type { ListWebhooksParams } from "./ListWebhooksParams.mjs";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.mjs";
|
|
2
|
+
export interface AttachWebhookResult {
|
|
3
|
+
webhook: AttachWebhookResult.Webhook;
|
|
4
|
+
/** The event type filter applied to these subscriptions. */
|
|
5
|
+
event: Pinnacle.WebhookEventEnum | null;
|
|
6
|
+
/** Senders that were successfully attached (phone numbers in E.164 format or RCS agent IDs). */
|
|
7
|
+
senders: string[];
|
|
8
|
+
/** Senders that could not be attached, with error details. */
|
|
9
|
+
failed: Pinnacle.FailedSender[];
|
|
10
|
+
}
|
|
11
|
+
export declare namespace AttachWebhookResult {
|
|
12
|
+
interface Webhook {
|
|
13
|
+
/** Unique webhook identifier (starts with `wh_`). */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Name of the webhook. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** HTTPS endpoint URL where events are delivered. */
|
|
18
|
+
url: string;
|
|
19
|
+
/** Signing secret sent in the `PINNACLE-SIGNING-SECRET` header for request verification. */
|
|
20
|
+
secret: string;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -4,7 +4,24 @@ export interface BaseRichMessage {
|
|
|
4
4
|
from: string;
|
|
5
5
|
fallback?: Pinnacle.FallbackMessage;
|
|
6
6
|
/** Configure how your RCS message is sent and tracked. */
|
|
7
|
-
options?:
|
|
7
|
+
options?: BaseRichMessage.Options;
|
|
8
8
|
/** Recipient's phone number in E.164 format. */
|
|
9
9
|
to: string;
|
|
10
10
|
}
|
|
11
|
+
export declare namespace BaseRichMessage {
|
|
12
|
+
/**
|
|
13
|
+
* Configure how your RCS message is sent and tracked.
|
|
14
|
+
*/
|
|
15
|
+
interface Options {
|
|
16
|
+
schedule?: Pinnacle.MessageSchedule;
|
|
17
|
+
tracking?: Pinnacle.Tracking;
|
|
18
|
+
/** Media files and card media will be transcoded to a supported RCS format. This adds a small delay to sending the message. Ignored for rich text messages. */
|
|
19
|
+
transcode?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Validate your message for any unsupported files. <br>
|
|
22
|
+
*
|
|
23
|
+
* If failed, errors will be thrown and the message will not send.
|
|
24
|
+
*/
|
|
25
|
+
validate?: boolean;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as Pinnacle from "../index.mjs";
|
|
2
|
+
export interface DetachWebhookResult {
|
|
3
|
+
/** The webhook that was detached from the senders. */
|
|
4
|
+
webhookId: string;
|
|
5
|
+
/** Senders that were successfully detached (phone numbers in E.164 format or RCS agent IDs). */
|
|
6
|
+
senders: string[];
|
|
7
|
+
/** Senders that could not be detached, with error details. */
|
|
8
|
+
failed: Pinnacle.FailedSender[];
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as Pinnacle from "../index.mjs";
|
|
2
2
|
export interface ExtendedBrandWithVetting extends Pinnacle.ExtendedBrand {
|
|
3
3
|
/** ISO 8601 formatted timestamp of the last TCR vetting. */
|
|
4
|
-
lastTcrVettingDate: string
|
|
4
|
+
lastTcrVettingDate: string;
|
|
5
5
|
/** Feedback from The Campaign Registry if TCR vetting was performed. */
|
|
6
|
-
tcrFeedback: Pinnacle.VettingFeedback[]
|
|
6
|
+
tcrFeedback: Pinnacle.VettingFeedback[];
|
|
7
7
|
/** History of all external vetting attempts for this brand. */
|
|
8
8
|
vettingHistory: Pinnacle.VettingHistory[];
|
|
9
9
|
}
|
|
@@ -13,21 +13,15 @@ export interface ExtendedRcsCampaign {
|
|
|
13
13
|
/** Legal documentation links. */
|
|
14
14
|
links?: ExtendedRcsCampaign.Links;
|
|
15
15
|
status: Pinnacle.ProfileStatusEnum;
|
|
16
|
-
/** Use case
|
|
17
|
-
|
|
18
|
-
/** Details on how opt-in is acquired. If it is done through a website or app, provide the link. See the [Opt-In Terms and Conditions](/guides/campaigns/rcs-compliance#opt-in-terms-and-conditions) section for requirements. */
|
|
19
|
-
optInTermsAndConditions?: string;
|
|
16
|
+
/** Detailed summary of what the brand is and how this agent will be used. See the [Use Case Behavior](/guides/campaigns/rcs-compliance#use-case-behavior) section for requirements. */
|
|
17
|
+
useCaseDescription?: string;
|
|
20
18
|
messagingType?: Pinnacle.RcsMessagingTypeEnum;
|
|
21
|
-
/**
|
|
22
|
-
|
|
19
|
+
/** URL to the opt-in form or a URL to a screenshot of the opt-in CTA. */
|
|
20
|
+
ctaMedia?: string;
|
|
21
|
+
/** Details on how opt-in is acquired. If it is done through a website or app, provide the link. See the [Opt-In Method](/guides/campaigns/rcs-compliance#opt-in-method) section for requirements. */
|
|
22
|
+
optInMethod?: string;
|
|
23
23
|
keywords?: ExtendedRcsCampaign.Keywords;
|
|
24
24
|
traffic?: ExtendedRcsCampaign.Traffic;
|
|
25
|
-
/** Explanation of how the agent is triggered. This includes how the first message is delivered, whether messages follow a schedule or triggered by user actions, and any external triggers. See the [Agent Triggers](/guides/campaigns/rcs-compliance#agent-triggers) section for requirements. */
|
|
26
|
-
agentTriggers?: string;
|
|
27
|
-
/** Description of all agent interactions, including primary and secondary use cases. See the [Interaction Description](/guides/campaigns/rcs-compliance#interaction-description) section for requirements. */
|
|
28
|
-
interactionDescription?: string;
|
|
29
|
-
/** Whether the agent supports conversational flows or respond to P2A messages from the users. Set to false for one-way messages from agent to user. */
|
|
30
|
-
isConversational?: boolean;
|
|
31
25
|
/** Required text that appears next to the opt-in checkbox for your opt-in form. This checkbox has to be unchecked by default. See the [CTA Language](/guides/campaigns/rcs-compliance#cta-language-opt-in-disclosure) section for requirements. */
|
|
32
26
|
ctaLanguage?: string;
|
|
33
27
|
/** Instructions on how an external reviewer can trigger messages and an example flow from the agent. This is usually an inbound text message to the agent that will start a flow of messages between the agent and the user. See the [Demo Trigger](/guides/campaigns/rcs-compliance#demo-trigger) section for requirements. */
|
|
@@ -93,14 +87,6 @@ export declare namespace ExtendedRcsCampaign {
|
|
|
93
87
|
/** Terms of service URL. */
|
|
94
88
|
termsOfService?: string;
|
|
95
89
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Use case classification for the campaign.
|
|
98
|
-
*/
|
|
99
|
-
interface UseCase {
|
|
100
|
-
/** Detailed summary of what the brand is and how this agent will be used. See the [Use Case Behavior](/guides/campaigns/rcs-compliance#use-case-behavior) section for requirements. */
|
|
101
|
-
behavior?: string;
|
|
102
|
-
value?: Pinnacle.RcsCampaignUseCaseEnum;
|
|
103
|
-
}
|
|
104
90
|
interface Keywords {
|
|
105
91
|
HELP?: Keywords.Help;
|
|
106
92
|
OPT_IN?: Keywords.OptIn;
|
|
@@ -8,21 +8,15 @@ export interface RcsCampaign {
|
|
|
8
8
|
expectedAgentResponses?: string[];
|
|
9
9
|
/** Legal documentation links. */
|
|
10
10
|
links?: RcsCampaign.Links;
|
|
11
|
-
/** Use case
|
|
12
|
-
|
|
13
|
-
/** Details on how opt-in is acquired. If it is done through a website or app, provide the link. See the [Opt-In Terms and Conditions](/guides/campaigns/rcs-compliance#opt-in-terms-and-conditions) section for requirements. */
|
|
14
|
-
optInTermsAndConditions?: string;
|
|
11
|
+
/** Detailed summary of what the brand is and how this agent will be used. See the [Use Case Behavior](/guides/campaigns/rcs-compliance#use-case-behavior) section for requirements. */
|
|
12
|
+
useCaseDescription?: string;
|
|
15
13
|
messagingType?: Pinnacle.RcsMessagingTypeEnum;
|
|
16
|
-
/**
|
|
17
|
-
|
|
14
|
+
/** URL to the opt-in form or a URL to a screenshot of the opt-in CTA. */
|
|
15
|
+
ctaMedia?: string;
|
|
16
|
+
/** Details on how opt-in is acquired. If it is done through a website or app, provide the link. See the [Opt-In Method](/guides/campaigns/rcs-compliance#opt-in-method) section for requirements. */
|
|
17
|
+
optInMethod?: string;
|
|
18
18
|
keywords?: RcsCampaign.Keywords;
|
|
19
19
|
traffic?: RcsCampaign.Traffic;
|
|
20
|
-
/** Explanation of how the agent is triggered. This includes how the first message is delivered, whether messages follow a schedule or triggered by user actions, and any external triggers. See the [Agent Triggers](/guides/campaigns/rcs-compliance#agent-triggers) section for requirements. */
|
|
21
|
-
agentTriggers?: string;
|
|
22
|
-
/** Description of all agent interactions, including primary and secondary use cases. See the [Interaction Description](/guides/campaigns/rcs-compliance#interaction-description) section for requirements. */
|
|
23
|
-
interactionDescription?: string;
|
|
24
|
-
/** Whether the agent supports conversational flows or respond to P2A messages from the users. Set to false for one-way messages from agent to user. */
|
|
25
|
-
isConversational?: boolean;
|
|
26
20
|
/** Required text that appears next to the opt-in checkbox for your opt-in form. This checkbox has to be unchecked by default. See the [CTA Language](/guides/campaigns/rcs-compliance#cta-language-opt-in-disclosure) section for requirements. */
|
|
27
21
|
ctaLanguage?: string;
|
|
28
22
|
/** Instructions on how an external reviewer can trigger messages and an example flow from the agent. This is usually an inbound text message to the agent that will start a flow of messages between the agent and the user. See the [Demo Trigger](/guides/campaigns/rcs-compliance#demo-trigger) section for requirements. */
|
|
@@ -88,14 +82,6 @@ export declare namespace RcsCampaign {
|
|
|
88
82
|
/** Terms of service URL. */
|
|
89
83
|
termsOfService?: string;
|
|
90
84
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Use case classification for the campaign.
|
|
93
|
-
*/
|
|
94
|
-
interface UseCase {
|
|
95
|
-
/** Detailed summary of what the brand is and how this agent will be used. See the [Use Case Behavior](/guides/campaigns/rcs-compliance#use-case-behavior) section for requirements. */
|
|
96
|
-
behavior?: string;
|
|
97
|
-
value?: Pinnacle.RcsCampaignUseCaseEnum;
|
|
98
|
-
}
|
|
99
85
|
interface Keywords {
|
|
100
86
|
HELP?: Keywords.Help;
|
|
101
87
|
OPT_IN?: Keywords.OptIn;
|
|
@@ -7,8 +7,6 @@ export interface RcsCampaignSummary {
|
|
|
7
7
|
status: RcsCampaignSummary.Status;
|
|
8
8
|
/** Brand ID associated with this campaign. */
|
|
9
9
|
brandId?: string;
|
|
10
|
-
/** Primary use case for this campaign. */
|
|
11
|
-
useCase?: string;
|
|
12
10
|
/** RCS agent ID associated with this campaign. */
|
|
13
11
|
agentId?: string;
|
|
14
12
|
/** ISO 8601 timestamp of when the campaign was created. */
|
|
@@ -14,7 +14,7 @@ export interface RcsCardsContent {
|
|
|
14
14
|
* List of interactive quick reply buttons in the message. <br><br>
|
|
15
15
|
* **Limit:** 10 max
|
|
16
16
|
*/
|
|
17
|
-
quickReplies
|
|
17
|
+
quickReplies?: Pinnacle.RichButton[];
|
|
18
18
|
}
|
|
19
19
|
export declare namespace RcsCardsContent {
|
|
20
20
|
type Cards = Cards.Item[];
|
|
@@ -9,7 +9,7 @@ Pinnacle.RichText
|
|
|
9
9
|
* See [supported media types](https://app.pinnacle.sh/supported-file-types?type=RCS-MEDIA). */
|
|
10
10
|
| {
|
|
11
11
|
media: string;
|
|
12
|
-
quickReplies
|
|
12
|
+
quickReplies?: Pinnacle.RichButton[] | undefined;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Message containing cards, each with its own title, subtitle, and/or buttons. Quick replies can also be added. <br>
|
|
@@ -14,7 +14,7 @@ export interface RichCards {
|
|
|
14
14
|
* List of interactive quick reply buttons in the message. <br><br>
|
|
15
15
|
* **Limit:** 10 max
|
|
16
16
|
*/
|
|
17
|
-
quickReplies
|
|
17
|
+
quickReplies?: Pinnacle.RichButton[];
|
|
18
18
|
}
|
|
19
19
|
export declare namespace RichCards {
|
|
20
20
|
type Cards = Cards.Item[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as Pinnacle from "../index.mjs";
|
|
2
2
|
export interface RichCardsMessage extends Pinnacle.RichCards {
|
|
3
|
+
/** Configure how your RCS message is sent and tracked. */
|
|
3
4
|
options?: RichCardsMessage.Options;
|
|
4
5
|
/** Your RCS agent ID which must be prefixed with 'agent_'. */
|
|
5
6
|
from: string;
|
|
@@ -8,7 +9,20 @@ export interface RichCardsMessage extends Pinnacle.RichCards {
|
|
|
8
9
|
to: string;
|
|
9
10
|
}
|
|
10
11
|
export declare namespace RichCardsMessage {
|
|
11
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Configure how your RCS message is sent and tracked.
|
|
14
|
+
*/
|
|
15
|
+
interface Options {
|
|
16
|
+
schedule?: Pinnacle.MessageSchedule;
|
|
17
|
+
tracking?: Pinnacle.Tracking;
|
|
18
|
+
/** Media files and card media will be transcoded to a supported RCS format. This adds a small delay to sending the message. Ignored for rich text messages. */
|
|
19
|
+
transcode?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Validate your message for any unsupported files. <br>
|
|
22
|
+
*
|
|
23
|
+
* If failed, errors will be thrown and the message will not send.
|
|
24
|
+
*/
|
|
25
|
+
validate?: boolean;
|
|
12
26
|
/**
|
|
13
27
|
* Configure standalone card layout options for enhanced visual presentation.
|
|
14
28
|
*
|
|
@@ -7,7 +7,7 @@ export interface RichText {
|
|
|
7
7
|
* List of interactive quick reply buttons in the message. <br><br>
|
|
8
8
|
* **Limit:** 10 max
|
|
9
9
|
*/
|
|
10
|
-
quickReplies
|
|
10
|
+
quickReplies?: Pinnacle.RichButton[];
|
|
11
11
|
/** Text content of the RCS message. */
|
|
12
12
|
text: string;
|
|
13
13
|
}
|
|
@@ -2,7 +2,7 @@ import type * as Pinnacle from "../index.mjs";
|
|
|
2
2
|
/**
|
|
3
3
|
* Configure how your RCS message is sent and tracked.
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface SendRichMessageOptions4 {
|
|
6
6
|
schedule?: Pinnacle.MessageSchedule;
|
|
7
7
|
tracking?: Pinnacle.Tracking;
|
|
8
8
|
/** Media files and card media will be transcoded to a supported RCS format. This adds a small delay to sending the message. Ignored for rich text messages. */
|
|
@@ -4,7 +4,7 @@ import type * as Pinnacle from "../index.mjs";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface SentRichMessageFallbackMms extends Pinnacle.SentMmsDetails {
|
|
6
6
|
/** Indicates that the fallback MMS was sent because the recipient does not support RCS. */
|
|
7
|
-
fallbackSent:
|
|
7
|
+
fallbackSent: true;
|
|
8
8
|
/** Unique identifier of the original RCS message that triggered this fallback. Always begins with the prefix `msg_`. This is the RCS message that could not be delivered — the `messageIds` field on this response refers to the actual MMS message(s) that were sent as the fallback. */
|
|
9
9
|
originalMessageId: string;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import type * as Pinnacle from "../index.mjs";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface SentRichMessageFallbackSms extends Pinnacle.SentSmsDetails {
|
|
6
6
|
/** Indicates that the fallback SMS was sent because the recipient does not support RCS. */
|
|
7
|
-
fallbackSent:
|
|
7
|
+
fallbackSent: true;
|
|
8
8
|
/** Unique identifier of the original RCS message that triggered this fallback. Always begins with the prefix `msg_`. This is the RCS message that could not be delivered — the `messageId` field on this response refers to the actual SMS that was sent as the fallback. */
|
|
9
9
|
originalMessageId: string;
|
|
10
10
|
}
|