twilio 5.4.2 → 5.4.3
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/lib/rest/content/v1/content.d.ts +9 -0
- package/lib/rest/content/v1/content.js +7 -1
- package/lib/rest/conversations/v1/addressConfiguration.d.ts +1 -1
- package/lib/rest/events/v1/subscription.d.ts +10 -0
- package/lib/rest/events/v1/subscription.js +6 -0
- package/lib/rest/iam/V1.d.ts +5 -5
- package/lib/rest/iam/V1.js +5 -5
- package/lib/rest/iam/v1/{key.d.ts → newApiKey.d.ts} +14 -14
- package/lib/rest/iam/v1/{key.js → newApiKey.js} +6 -6
- package/lib/rest/insights/v1/conference.d.ts +1 -1
- package/lib/rest/lookups/v2/phoneNumber.d.ts +2 -0
- package/lib/rest/lookups/v2/phoneNumber.js +2 -0
- package/lib/rest/numbers/V1.d.ts +5 -5
- package/lib/rest/numbers/V1.js +8 -6
- package/lib/rest/numbers/v1/{webhook.d.ts → portingWebhookConfigurationFetch.d.ts} +10 -10
- package/lib/rest/numbers/v1/{webhook.js → portingWebhookConfigurationFetch.js} +6 -6
- package/lib/webhooks/webhooks.js +30 -7
- package/package.json +1 -1
|
@@ -166,6 +166,14 @@ export declare class TwilioQuickReply {
|
|
|
166
166
|
"body": string;
|
|
167
167
|
"actions": Array<QuickReplyAction>;
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* twilio/schedule templates allow us to send a message with a schedule with different time slots
|
|
171
|
+
*/
|
|
172
|
+
export declare class TwilioSchedule {
|
|
173
|
+
"id": string;
|
|
174
|
+
"title": string;
|
|
175
|
+
"timeSlots": string;
|
|
176
|
+
}
|
|
169
177
|
/**
|
|
170
178
|
* Type containing only plain text-based content
|
|
171
179
|
*/
|
|
@@ -186,6 +194,7 @@ export declare class Types {
|
|
|
186
194
|
"twilio/catalog"?: TwilioCatalog | null;
|
|
187
195
|
"twilio/carousel"?: TwilioCarousel | null;
|
|
188
196
|
"twilio/flows"?: TwilioFlows | null;
|
|
197
|
+
"twilio/schedule"?: TwilioSchedule | null;
|
|
189
198
|
"whatsapp/card"?: WhatsappCard | null;
|
|
190
199
|
"whatsapp/authentication"?: WhatsappAuthentication | null;
|
|
191
200
|
}
|
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.ContentPage = exports.ContentListInstance = exports.ContentInstance = exports.ContentContextImpl = exports.WhatsappCard = exports.WhatsappAuthentication = exports.Types = exports.TwilioText = exports.TwilioQuickReply = exports.TwilioMedia = exports.TwilioLocation = exports.TwilioListPicker = exports.TwilioFlows = exports.TwilioCatalog = exports.TwilioCarousel = exports.TwilioCard = exports.TwilioCallToAction = exports.QuickReplyAction = exports.ListItem = exports.FlowsPageComponent = exports.FlowsPage = exports.ContentCreateRequest = exports.CatalogItem = exports.CarouselCard = exports.CarouselAction = exports.CardAction = exports.CallToActionAction = exports.AuthenticationAction = void 0;
|
|
19
|
+
exports.ContentPage = exports.ContentListInstance = exports.ContentInstance = exports.ContentContextImpl = exports.WhatsappCard = exports.WhatsappAuthentication = exports.Types = exports.TwilioText = exports.TwilioSchedule = exports.TwilioQuickReply = exports.TwilioMedia = exports.TwilioLocation = exports.TwilioListPicker = exports.TwilioFlows = exports.TwilioCatalog = exports.TwilioCarousel = exports.TwilioCard = exports.TwilioCallToAction = exports.QuickReplyAction = exports.ListItem = exports.FlowsPageComponent = exports.FlowsPage = exports.ContentCreateRequest = exports.CatalogItem = exports.CarouselCard = exports.CarouselAction = exports.CardAction = exports.CallToActionAction = exports.AuthenticationAction = void 0;
|
|
20
20
|
const util_1 = require("util");
|
|
21
21
|
const Page_1 = __importDefault(require("../../../base/Page"));
|
|
22
22
|
const deserialize = require("../../../base/deserialize");
|
|
@@ -114,6 +114,12 @@ exports.TwilioMedia = TwilioMedia;
|
|
|
114
114
|
class TwilioQuickReply {
|
|
115
115
|
}
|
|
116
116
|
exports.TwilioQuickReply = TwilioQuickReply;
|
|
117
|
+
/**
|
|
118
|
+
* twilio/schedule templates allow us to send a message with a schedule with different time slots
|
|
119
|
+
*/
|
|
120
|
+
class TwilioSchedule {
|
|
121
|
+
}
|
|
122
|
+
exports.TwilioSchedule = TwilioSchedule;
|
|
117
123
|
/**
|
|
118
124
|
* Type containing only plain text-based content
|
|
119
125
|
*/
|
|
@@ -5,7 +5,7 @@ import Response from "../../../http/response";
|
|
|
5
5
|
import V1 from "../V1";
|
|
6
6
|
export type AddressConfigurationAutoCreationType = "webhook" | "studio" | "default";
|
|
7
7
|
export type AddressConfigurationMethod = "GET" | "POST";
|
|
8
|
-
export type AddressConfigurationType = "sms" | "whatsapp" | "messenger" | "gbm" | "email" | "rcs";
|
|
8
|
+
export type AddressConfigurationType = "sms" | "whatsapp" | "messenger" | "gbm" | "email" | "rcs" | "apple";
|
|
9
9
|
/**
|
|
10
10
|
* Options to pass to update a AddressConfigurationInstance
|
|
11
11
|
*/
|
|
@@ -12,6 +12,8 @@ export interface SubscriptionContextUpdateOptions {
|
|
|
12
12
|
description?: string;
|
|
13
13
|
/** The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. */
|
|
14
14
|
sinkSid?: string;
|
|
15
|
+
/** Receive events from all children accounts in the parent account subscription. */
|
|
16
|
+
receiveEventsFromSubaccounts?: boolean;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Options to pass to create a SubscriptionInstance
|
|
@@ -23,6 +25,8 @@ export interface SubscriptionListInstanceCreateOptions {
|
|
|
23
25
|
sinkSid: string;
|
|
24
26
|
/** An array of objects containing the subscribed Event Types */
|
|
25
27
|
types: Array<any>;
|
|
28
|
+
/** Receive events from all children accounts in the parent account subscription. */
|
|
29
|
+
receiveEventsFromSubaccounts?: boolean;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Options to pass to each
|
|
@@ -137,6 +141,7 @@ interface SubscriptionResource {
|
|
|
137
141
|
sink_sid: string;
|
|
138
142
|
url: string;
|
|
139
143
|
links: Record<string, string>;
|
|
144
|
+
receive_events_from_subaccounts: boolean;
|
|
140
145
|
}
|
|
141
146
|
export declare class SubscriptionInstance {
|
|
142
147
|
protected _version: V1;
|
|
@@ -175,6 +180,10 @@ export declare class SubscriptionInstance {
|
|
|
175
180
|
* Contains a dictionary of URL links to nested resources of this Subscription.
|
|
176
181
|
*/
|
|
177
182
|
links: Record<string, string>;
|
|
183
|
+
/**
|
|
184
|
+
* Receive events from all children accounts in the parent account subscription.
|
|
185
|
+
*/
|
|
186
|
+
receiveEventsFromSubaccounts: boolean;
|
|
178
187
|
private get _proxy();
|
|
179
188
|
/**
|
|
180
189
|
* Remove a SubscriptionInstance
|
|
@@ -227,6 +236,7 @@ export declare class SubscriptionInstance {
|
|
|
227
236
|
sinkSid: string;
|
|
228
237
|
url: string;
|
|
229
238
|
links: Record<string, string>;
|
|
239
|
+
receiveEventsFromSubaccounts: boolean;
|
|
230
240
|
};
|
|
231
241
|
[inspect.custom](_depth: any, options: InspectOptions): string;
|
|
232
242
|
}
|
|
@@ -75,6 +75,8 @@ class SubscriptionContextImpl {
|
|
|
75
75
|
data["Description"] = params["description"];
|
|
76
76
|
if (params["sinkSid"] !== undefined)
|
|
77
77
|
data["SinkSid"] = params["sinkSid"];
|
|
78
|
+
if (params["receiveEventsFromSubaccounts"] !== undefined)
|
|
79
|
+
data["ReceiveEventsFromSubaccounts"] = serialize.bool(params["receiveEventsFromSubaccounts"]);
|
|
78
80
|
const headers = {};
|
|
79
81
|
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
80
82
|
headers["Accept"] = "application/json";
|
|
@@ -113,6 +115,7 @@ class SubscriptionInstance {
|
|
|
113
115
|
this.sinkSid = payload.sink_sid;
|
|
114
116
|
this.url = payload.url;
|
|
115
117
|
this.links = payload.links;
|
|
118
|
+
this.receiveEventsFromSubaccounts = payload.receive_events_from_subaccounts;
|
|
116
119
|
this._solution = { sid: sid || this.sid };
|
|
117
120
|
}
|
|
118
121
|
get _proxy() {
|
|
@@ -165,6 +168,7 @@ class SubscriptionInstance {
|
|
|
165
168
|
sinkSid: this.sinkSid,
|
|
166
169
|
url: this.url,
|
|
167
170
|
links: this.links,
|
|
171
|
+
receiveEventsFromSubaccounts: this.receiveEventsFromSubaccounts,
|
|
168
172
|
};
|
|
169
173
|
}
|
|
170
174
|
[util_1.inspect.custom](_depth, options) {
|
|
@@ -197,6 +201,8 @@ function SubscriptionListInstance(version) {
|
|
|
197
201
|
data["Description"] = params["description"];
|
|
198
202
|
data["SinkSid"] = params["sinkSid"];
|
|
199
203
|
data["Types"] = serialize.map(params["types"], (e) => serialize.object(e));
|
|
204
|
+
if (params["receiveEventsFromSubaccounts"] !== undefined)
|
|
205
|
+
data["ReceiveEventsFromSubaccounts"] = serialize.bool(params["receiveEventsFromSubaccounts"]);
|
|
200
206
|
const headers = {};
|
|
201
207
|
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
202
208
|
headers["Accept"] = "application/json";
|
package/lib/rest/iam/V1.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import IamBase from "../IamBase";
|
|
|
2
2
|
import Version from "../../base/Version";
|
|
3
3
|
import { ApiKeyListInstance } from "./v1/apiKey";
|
|
4
4
|
import { GetApiKeysListInstance } from "./v1/getApiKeys";
|
|
5
|
-
import {
|
|
5
|
+
import { NewApiKeyListInstance } from "./v1/newApiKey";
|
|
6
6
|
export default class V1 extends Version {
|
|
7
7
|
/**
|
|
8
8
|
* Initialize the V1 version of Iam
|
|
@@ -14,12 +14,12 @@ export default class V1 extends Version {
|
|
|
14
14
|
protected _apiKey?: ApiKeyListInstance;
|
|
15
15
|
/** getApiKeys - { Twilio.Iam.V1.GetApiKeysListInstance } resource */
|
|
16
16
|
protected _getApiKeys?: GetApiKeysListInstance;
|
|
17
|
-
/**
|
|
18
|
-
protected
|
|
17
|
+
/** newApiKey - { Twilio.Iam.V1.NewApiKeyListInstance } resource */
|
|
18
|
+
protected _newApiKey?: NewApiKeyListInstance;
|
|
19
19
|
/** Getter for apiKey resource */
|
|
20
20
|
get apiKey(): ApiKeyListInstance;
|
|
21
21
|
/** Getter for getApiKeys resource */
|
|
22
22
|
get getApiKeys(): GetApiKeysListInstance;
|
|
23
|
-
/** Getter for
|
|
24
|
-
get
|
|
23
|
+
/** Getter for newApiKey resource */
|
|
24
|
+
get newApiKey(): NewApiKeyListInstance;
|
|
25
25
|
}
|
package/lib/rest/iam/V1.js
CHANGED
|
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
const Version_1 = __importDefault(require("../../base/Version"));
|
|
20
20
|
const apiKey_1 = require("./v1/apiKey");
|
|
21
21
|
const getApiKeys_1 = require("./v1/getApiKeys");
|
|
22
|
-
const
|
|
22
|
+
const newApiKey_1 = require("./v1/newApiKey");
|
|
23
23
|
class V1 extends Version_1.default {
|
|
24
24
|
/**
|
|
25
25
|
* Initialize the V1 version of Iam
|
|
@@ -39,10 +39,10 @@ class V1 extends Version_1.default {
|
|
|
39
39
|
this._getApiKeys = this._getApiKeys || (0, getApiKeys_1.GetApiKeysListInstance)(this);
|
|
40
40
|
return this._getApiKeys;
|
|
41
41
|
}
|
|
42
|
-
/** Getter for
|
|
43
|
-
get
|
|
44
|
-
this.
|
|
45
|
-
return this.
|
|
42
|
+
/** Getter for newApiKey resource */
|
|
43
|
+
get newApiKey() {
|
|
44
|
+
this._newApiKey = this._newApiKey || (0, newApiKey_1.NewApiKeyListInstance)(this);
|
|
45
|
+
return this._newApiKey;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
exports.default = V1;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { inspect, InspectOptions } from "util";
|
|
3
3
|
import V1 from "../V1";
|
|
4
|
-
export type
|
|
4
|
+
export type NewApiKeyKeytype = "restricted";
|
|
5
5
|
/**
|
|
6
|
-
* Options to pass to create a
|
|
6
|
+
* Options to pass to create a NewApiKeyInstance
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface NewApiKeyListInstanceCreateOptions {
|
|
9
9
|
/** The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. */
|
|
10
10
|
accountSid: string;
|
|
11
11
|
/** A descriptive string that you create to describe the resource. It can be up to 64 characters long. */
|
|
12
12
|
friendlyName?: string;
|
|
13
13
|
/** */
|
|
14
|
-
keyType?:
|
|
14
|
+
keyType?: NewApiKeyKeytype;
|
|
15
15
|
/** The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). */
|
|
16
16
|
policy?: any;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface NewApiKeySolution {
|
|
19
19
|
}
|
|
20
|
-
export interface
|
|
20
|
+
export interface NewApiKeyListInstance {
|
|
21
21
|
_version: V1;
|
|
22
|
-
_solution:
|
|
22
|
+
_solution: NewApiKeySolution;
|
|
23
23
|
_uri: string;
|
|
24
24
|
/**
|
|
25
|
-
* Create a
|
|
25
|
+
* Create a NewApiKeyInstance
|
|
26
26
|
*
|
|
27
27
|
* @param params - Parameter for request
|
|
28
28
|
* @param callback - Callback to handle processed record
|
|
29
29
|
*
|
|
30
|
-
* @returns Resolves to processed
|
|
30
|
+
* @returns Resolves to processed NewApiKeyInstance
|
|
31
31
|
*/
|
|
32
|
-
create(params:
|
|
32
|
+
create(params: NewApiKeyListInstanceCreateOptions, callback?: (error: Error | null, item?: NewApiKeyInstance) => any): Promise<NewApiKeyInstance>;
|
|
33
33
|
/**
|
|
34
34
|
* Provide a user-friendly representation
|
|
35
35
|
*/
|
|
36
36
|
toJSON(): any;
|
|
37
37
|
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
38
38
|
}
|
|
39
|
-
export declare function
|
|
40
|
-
interface
|
|
39
|
+
export declare function NewApiKeyListInstance(version: V1): NewApiKeyListInstance;
|
|
40
|
+
interface NewApiKeyResource {
|
|
41
41
|
sid: string;
|
|
42
42
|
friendly_name: string;
|
|
43
43
|
date_created: Date;
|
|
@@ -45,9 +45,9 @@ interface KeyResource {
|
|
|
45
45
|
secret: string;
|
|
46
46
|
policy: any;
|
|
47
47
|
}
|
|
48
|
-
export declare class
|
|
48
|
+
export declare class NewApiKeyInstance {
|
|
49
49
|
protected _version: V1;
|
|
50
|
-
constructor(_version: V1, payload:
|
|
50
|
+
constructor(_version: V1, payload: NewApiKeyResource);
|
|
51
51
|
/**
|
|
52
52
|
* The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API.
|
|
53
53
|
*/
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* Do not edit the class manually.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.NewApiKeyInstance = exports.NewApiKeyListInstance = void 0;
|
|
17
17
|
const util_1 = require("util");
|
|
18
18
|
const deserialize = require("../../../base/deserialize");
|
|
19
19
|
const serialize = require("../../../base/serialize");
|
|
20
|
-
function
|
|
20
|
+
function NewApiKeyListInstance(version) {
|
|
21
21
|
const instance = {};
|
|
22
22
|
instance._version = version;
|
|
23
23
|
instance._solution = {};
|
|
@@ -46,7 +46,7 @@ function KeyListInstance(version) {
|
|
|
46
46
|
data,
|
|
47
47
|
headers,
|
|
48
48
|
});
|
|
49
|
-
operationPromise = operationPromise.then((payload) => new
|
|
49
|
+
operationPromise = operationPromise.then((payload) => new NewApiKeyInstance(operationVersion, payload));
|
|
50
50
|
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
51
51
|
return operationPromise;
|
|
52
52
|
};
|
|
@@ -58,8 +58,8 @@ function KeyListInstance(version) {
|
|
|
58
58
|
};
|
|
59
59
|
return instance;
|
|
60
60
|
}
|
|
61
|
-
exports.
|
|
62
|
-
class
|
|
61
|
+
exports.NewApiKeyListInstance = NewApiKeyListInstance;
|
|
62
|
+
class NewApiKeyInstance {
|
|
63
63
|
constructor(_version, payload) {
|
|
64
64
|
this._version = _version;
|
|
65
65
|
this.sid = payload.sid;
|
|
@@ -88,4 +88,4 @@ class KeyInstance {
|
|
|
88
88
|
return (0, util_1.inspect)(this.toJSON(), options);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
exports.
|
|
91
|
+
exports.NewApiKeyInstance = NewApiKeyInstance;
|
|
@@ -7,7 +7,7 @@ import { ConferenceParticipantListInstance } from "./conference/conferencePartic
|
|
|
7
7
|
export type ConferenceConferenceEndReason = "last_participant_left" | "conference_ended_via_api" | "participant_with_end_conference_on_exit_left" | "last_participant_kicked" | "participant_with_end_conference_on_exit_kicked";
|
|
8
8
|
export type ConferenceConferenceStatus = "in_progress" | "not_started" | "completed" | "summary_timeout";
|
|
9
9
|
export type ConferenceProcessingState = "complete" | "in_progress" | "timeout";
|
|
10
|
-
export type ConferenceRegion = "us1" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1";
|
|
10
|
+
export type ConferenceRegion = "us1" | "us2" | "au1" | "br1" | "ie1" | "jp1" | "sg1" | "de1";
|
|
11
11
|
export type ConferenceTag = "invalid_requested_region" | "duplicate_identity" | "start_failure" | "region_configuration_issues" | "quality_warnings" | "participant_behavior_issues" | "high_packet_loss" | "high_jitter" | "high_latency" | "low_mos" | "detected_silence" | "no_concurrent_participants";
|
|
12
12
|
/**
|
|
13
13
|
* Options to pass to each
|
|
@@ -34,6 +34,8 @@ export interface PhoneNumberContextFetchOptions {
|
|
|
34
34
|
lastVerifiedDate?: string;
|
|
35
35
|
/** The unique identifier associated with a verification process through verify API. This query parameter is only used (optionally) for pre_fill package requests. */
|
|
36
36
|
verificationSid?: string;
|
|
37
|
+
/** The optional partnerSubId parameter to provide context for your sub-accounts, tenantIDs, sender IDs or other segmentation, enhancing the accuracy of the risk analysis. */
|
|
38
|
+
partnerSubId?: string;
|
|
37
39
|
}
|
|
38
40
|
export interface PhoneNumberContext {
|
|
39
41
|
/**
|
|
@@ -64,6 +64,8 @@ class PhoneNumberContextImpl {
|
|
|
64
64
|
data["LastVerifiedDate"] = params["lastVerifiedDate"];
|
|
65
65
|
if (params["verificationSid"] !== undefined)
|
|
66
66
|
data["VerificationSid"] = params["verificationSid"];
|
|
67
|
+
if (params["partnerSubId"] !== undefined)
|
|
68
|
+
data["PartnerSubId"] = params["partnerSubId"];
|
|
67
69
|
const headers = {};
|
|
68
70
|
headers["Accept"] = "application/json";
|
|
69
71
|
const instance = this;
|
package/lib/rest/numbers/V1.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { PortingPortInPhoneNumberListInstance } from "./v1/portingPortInPhoneNum
|
|
|
7
7
|
import { PortingPortabilityListInstance } from "./v1/portingPortability";
|
|
8
8
|
import { PortingWebhookConfigurationListInstance } from "./v1/portingWebhookConfiguration";
|
|
9
9
|
import { PortingWebhookConfigurationDeleteListInstance } from "./v1/portingWebhookConfigurationDelete";
|
|
10
|
+
import { PortingWebhookConfigurationFetchListInstance } from "./v1/portingWebhookConfigurationFetch";
|
|
10
11
|
import { SigningRequestConfigurationListInstance } from "./v1/signingRequestConfiguration";
|
|
11
|
-
import { WebhookListInstance } from "./v1/webhook";
|
|
12
12
|
export default class V1 extends Version {
|
|
13
13
|
/**
|
|
14
14
|
* Initialize the V1 version of Numbers
|
|
@@ -30,10 +30,10 @@ export default class V1 extends Version {
|
|
|
30
30
|
protected _portingWebhookConfigurations?: PortingWebhookConfigurationListInstance;
|
|
31
31
|
/** portingWebhookConfigurationsDelete - { Twilio.Numbers.V1.PortingWebhookConfigurationDeleteListInstance } resource */
|
|
32
32
|
protected _portingWebhookConfigurationsDelete?: PortingWebhookConfigurationDeleteListInstance;
|
|
33
|
+
/** portingWebhookConfigurationFetch - { Twilio.Numbers.V1.PortingWebhookConfigurationFetchListInstance } resource */
|
|
34
|
+
protected _portingWebhookConfigurationFetch?: PortingWebhookConfigurationFetchListInstance;
|
|
33
35
|
/** signingRequestConfigurations - { Twilio.Numbers.V1.SigningRequestConfigurationListInstance } resource */
|
|
34
36
|
protected _signingRequestConfigurations?: SigningRequestConfigurationListInstance;
|
|
35
|
-
/** webhook - { Twilio.Numbers.V1.WebhookListInstance } resource */
|
|
36
|
-
protected _webhook?: WebhookListInstance;
|
|
37
37
|
/** Getter for bulkEligibilities resource */
|
|
38
38
|
get bulkEligibilities(): BulkEligibilityListInstance;
|
|
39
39
|
/** Getter for eligibilities resource */
|
|
@@ -48,8 +48,8 @@ export default class V1 extends Version {
|
|
|
48
48
|
get portingWebhookConfigurations(): PortingWebhookConfigurationListInstance;
|
|
49
49
|
/** Getter for portingWebhookConfigurationsDelete resource */
|
|
50
50
|
get portingWebhookConfigurationsDelete(): PortingWebhookConfigurationDeleteListInstance;
|
|
51
|
+
/** Getter for portingWebhookConfigurationFetch resource */
|
|
52
|
+
get portingWebhookConfigurationFetch(): PortingWebhookConfigurationFetchListInstance;
|
|
51
53
|
/** Getter for signingRequestConfigurations resource */
|
|
52
54
|
get signingRequestConfigurations(): SigningRequestConfigurationListInstance;
|
|
53
|
-
/** Getter for webhook resource */
|
|
54
|
-
get webhook(): WebhookListInstance;
|
|
55
55
|
}
|
package/lib/rest/numbers/V1.js
CHANGED
|
@@ -24,8 +24,8 @@ const portingPortInPhoneNumber_1 = require("./v1/portingPortInPhoneNumber");
|
|
|
24
24
|
const portingPortability_1 = require("./v1/portingPortability");
|
|
25
25
|
const portingWebhookConfiguration_1 = require("./v1/portingWebhookConfiguration");
|
|
26
26
|
const portingWebhookConfigurationDelete_1 = require("./v1/portingWebhookConfigurationDelete");
|
|
27
|
+
const portingWebhookConfigurationFetch_1 = require("./v1/portingWebhookConfigurationFetch");
|
|
27
28
|
const signingRequestConfiguration_1 = require("./v1/signingRequestConfiguration");
|
|
28
|
-
const webhook_1 = require("./v1/webhook");
|
|
29
29
|
class V1 extends Version_1.default {
|
|
30
30
|
/**
|
|
31
31
|
* Initialize the V1 version of Numbers
|
|
@@ -79,6 +79,13 @@ class V1 extends Version_1.default {
|
|
|
79
79
|
(0, portingWebhookConfigurationDelete_1.PortingWebhookConfigurationDeleteListInstance)(this);
|
|
80
80
|
return this._portingWebhookConfigurationsDelete;
|
|
81
81
|
}
|
|
82
|
+
/** Getter for portingWebhookConfigurationFetch resource */
|
|
83
|
+
get portingWebhookConfigurationFetch() {
|
|
84
|
+
this._portingWebhookConfigurationFetch =
|
|
85
|
+
this._portingWebhookConfigurationFetch ||
|
|
86
|
+
(0, portingWebhookConfigurationFetch_1.PortingWebhookConfigurationFetchListInstance)(this);
|
|
87
|
+
return this._portingWebhookConfigurationFetch;
|
|
88
|
+
}
|
|
82
89
|
/** Getter for signingRequestConfigurations resource */
|
|
83
90
|
get signingRequestConfigurations() {
|
|
84
91
|
this._signingRequestConfigurations =
|
|
@@ -86,10 +93,5 @@ class V1 extends Version_1.default {
|
|
|
86
93
|
(0, signingRequestConfiguration_1.SigningRequestConfigurationListInstance)(this);
|
|
87
94
|
return this._signingRequestConfigurations;
|
|
88
95
|
}
|
|
89
|
-
/** Getter for webhook resource */
|
|
90
|
-
get webhook() {
|
|
91
|
-
this._webhook = this._webhook || (0, webhook_1.WebhookListInstance)(this);
|
|
92
|
-
return this._webhook;
|
|
93
|
-
}
|
|
94
96
|
}
|
|
95
97
|
exports.default = V1;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { inspect, InspectOptions } from "util";
|
|
3
3
|
import V1 from "../V1";
|
|
4
|
-
export interface
|
|
4
|
+
export interface PortingWebhookConfigurationFetchSolution {
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface PortingWebhookConfigurationFetchListInstance {
|
|
7
7
|
_version: V1;
|
|
8
|
-
_solution:
|
|
8
|
+
_solution: PortingWebhookConfigurationFetchSolution;
|
|
9
9
|
_uri: string;
|
|
10
10
|
/**
|
|
11
|
-
* Fetch a
|
|
11
|
+
* Fetch a PortingWebhookConfigurationFetchInstance
|
|
12
12
|
*
|
|
13
13
|
* @param callback - Callback to handle processed record
|
|
14
14
|
*
|
|
15
|
-
* @returns Resolves to processed
|
|
15
|
+
* @returns Resolves to processed PortingWebhookConfigurationFetchInstance
|
|
16
16
|
*/
|
|
17
|
-
fetch(callback?: (error: Error | null, item?:
|
|
17
|
+
fetch(callback?: (error: Error | null, item?: PortingWebhookConfigurationFetchInstance) => any): Promise<PortingWebhookConfigurationFetchInstance>;
|
|
18
18
|
/**
|
|
19
19
|
* Provide a user-friendly representation
|
|
20
20
|
*/
|
|
21
21
|
toJSON(): any;
|
|
22
22
|
[inspect.custom](_depth: any, options: InspectOptions): any;
|
|
23
23
|
}
|
|
24
|
-
export declare function
|
|
25
|
-
interface
|
|
24
|
+
export declare function PortingWebhookConfigurationFetchListInstance(version: V1): PortingWebhookConfigurationFetchListInstance;
|
|
25
|
+
interface PortingWebhookConfigurationFetchResource {
|
|
26
26
|
url: string;
|
|
27
27
|
port_in_target_url: string;
|
|
28
28
|
port_out_target_url: string;
|
|
@@ -30,9 +30,9 @@ interface WebhookResource {
|
|
|
30
30
|
port_in_target_date_created: Date;
|
|
31
31
|
port_out_target_date_created: Date;
|
|
32
32
|
}
|
|
33
|
-
export declare class
|
|
33
|
+
export declare class PortingWebhookConfigurationFetchInstance {
|
|
34
34
|
protected _version: V1;
|
|
35
|
-
constructor(_version: V1, payload:
|
|
35
|
+
constructor(_version: V1, payload: PortingWebhookConfigurationFetchResource);
|
|
36
36
|
/**
|
|
37
37
|
* The URL of the webhook configuration request
|
|
38
38
|
*/
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* Do not edit the class manually.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.PortingWebhookConfigurationFetchInstance = exports.PortingWebhookConfigurationFetchListInstance = void 0;
|
|
17
17
|
const util_1 = require("util");
|
|
18
18
|
const deserialize = require("../../../base/deserialize");
|
|
19
19
|
const serialize = require("../../../base/serialize");
|
|
20
|
-
function
|
|
20
|
+
function PortingWebhookConfigurationFetchListInstance(version) {
|
|
21
21
|
const instance = {};
|
|
22
22
|
instance._version = version;
|
|
23
23
|
instance._solution = {};
|
|
@@ -30,7 +30,7 @@ function WebhookListInstance(version) {
|
|
|
30
30
|
method: "get",
|
|
31
31
|
headers,
|
|
32
32
|
});
|
|
33
|
-
operationPromise = operationPromise.then((payload) => new
|
|
33
|
+
operationPromise = operationPromise.then((payload) => new PortingWebhookConfigurationFetchInstance(operationVersion, payload));
|
|
34
34
|
operationPromise = instance._version.setPromiseCallback(operationPromise, callback);
|
|
35
35
|
return operationPromise;
|
|
36
36
|
};
|
|
@@ -42,8 +42,8 @@ function WebhookListInstance(version) {
|
|
|
42
42
|
};
|
|
43
43
|
return instance;
|
|
44
44
|
}
|
|
45
|
-
exports.
|
|
46
|
-
class
|
|
45
|
+
exports.PortingWebhookConfigurationFetchListInstance = PortingWebhookConfigurationFetchListInstance;
|
|
46
|
+
class PortingWebhookConfigurationFetchInstance {
|
|
47
47
|
constructor(_version, payload) {
|
|
48
48
|
this._version = _version;
|
|
49
49
|
this.url = payload.url;
|
|
@@ -72,4 +72,4 @@ class WebhookInstance {
|
|
|
72
72
|
return (0, util_1.inspect)(this.toJSON(), options);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
exports.
|
|
75
|
+
exports.PortingWebhookConfigurationFetchInstance = PortingWebhookConfigurationFetchInstance;
|
package/lib/webhooks/webhooks.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.webhook = exports.validateExpressRequest = exports.validateIncomingReque
|
|
|
7
7
|
const scmp = require("scmp");
|
|
8
8
|
const crypto_1 = __importDefault(require("crypto"));
|
|
9
9
|
const url_1 = __importDefault(require("url"));
|
|
10
|
+
const querystring_1 = require("querystring");
|
|
10
11
|
/**
|
|
11
12
|
* Utility function to construct the URL string, since Node.js url library won't include standard port numbers
|
|
12
13
|
*
|
|
@@ -43,9 +44,19 @@ function addPort(parsedUrl) {
|
|
|
43
44
|
@returns URL without port
|
|
44
45
|
*/
|
|
45
46
|
function removePort(parsedUrl) {
|
|
47
|
+
parsedUrl = new URL(parsedUrl); // prevent mutation of original URL object
|
|
46
48
|
parsedUrl.port = "";
|
|
47
49
|
return parsedUrl.toString();
|
|
48
50
|
}
|
|
51
|
+
function withLegacyQuerystring(url) {
|
|
52
|
+
const parsedUrl = new URL(url);
|
|
53
|
+
if (parsedUrl.search) {
|
|
54
|
+
const qs = (0, querystring_1.parse)(parsedUrl.search.slice(1));
|
|
55
|
+
parsedUrl.search = "";
|
|
56
|
+
return parsedUrl.toString() + "?" + (0, querystring_1.stringify)(qs);
|
|
57
|
+
}
|
|
58
|
+
return url;
|
|
59
|
+
}
|
|
49
60
|
/**
|
|
50
61
|
Utility function to convert request parameter to a string format
|
|
51
62
|
|
|
@@ -108,19 +119,31 @@ exports.getExpectedBodyHash = getExpectedBodyHash;
|
|
|
108
119
|
function validateRequest(authToken, twilioHeader, url, params) {
|
|
109
120
|
twilioHeader = twilioHeader || "";
|
|
110
121
|
const urlObject = new URL(url);
|
|
111
|
-
const urlWithPort = addPort(urlObject);
|
|
112
|
-
const urlWithoutPort = removePort(urlObject);
|
|
113
122
|
/*
|
|
114
123
|
* Check signature of the url with and without the port number
|
|
124
|
+
* and with and without the legacy querystring (special chars are encoded when using `new URL()`)
|
|
115
125
|
* since signature generation on the back end is inconsistent
|
|
116
126
|
*/
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
const isValidSignatureWithoutPort = validateSignatureWithUrl(authToken, twilioHeader, removePort(urlObject), params);
|
|
128
|
+
if (isValidSignatureWithoutPort) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
const isValidSignatureWithPort = validateSignatureWithUrl(authToken, twilioHeader, addPort(urlObject), params);
|
|
132
|
+
if (isValidSignatureWithPort) {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
const isValidSignatureWithLegacyQuerystringWithoutPort = validateSignatureWithUrl(authToken, twilioHeader, withLegacyQuerystring(removePort(urlObject)), params);
|
|
136
|
+
if (isValidSignatureWithLegacyQuerystringWithoutPort) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
const isValidSignatureWithLegacyQuerystringWithPort = validateSignatureWithUrl(authToken, twilioHeader, withLegacyQuerystring(addPort(urlObject)), params);
|
|
140
|
+
return isValidSignatureWithLegacyQuerystringWithPort;
|
|
122
141
|
}
|
|
123
142
|
exports.validateRequest = validateRequest;
|
|
143
|
+
function validateSignatureWithUrl(authToken, twilioHeader, url, params) {
|
|
144
|
+
const signatureWithoutPort = getExpectedTwilioSignature(authToken, url, params);
|
|
145
|
+
return scmp(Buffer.from(twilioHeader), Buffer.from(signatureWithoutPort));
|
|
146
|
+
}
|
|
124
147
|
function validateBody(body, bodyHash) {
|
|
125
148
|
var expectedHash = getExpectedBodyHash(body);
|
|
126
149
|
return scmp(Buffer.from(bodyHash), Buffer.from(expectedHash));
|