@divyacon/piece-twilio 0.0.0-stage → 0.1.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/LICENSE.MIT-AP +24 -0
- package/README.md +8 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/action/download-recording-media.d.ts +6 -0
- package/dist/lib/action/download-recording-media.d.ts.map +1 -0
- package/dist/lib/action/download-recording-media.js +77 -0
- package/dist/lib/action/download-recording-media.js.map +1 -0
- package/dist/lib/action/get-message.d.ts +4 -0
- package/dist/lib/action/get-message.d.ts.map +1 -0
- package/dist/lib/action/get-message.js +36 -0
- package/dist/lib/action/get-message.js.map +1 -0
- package/dist/lib/action/make-call.d.ts +10 -0
- package/dist/lib/action/make-call.d.ts.map +1 -0
- package/dist/lib/action/make-call.js +98 -0
- package/dist/lib/action/make-call.js.map +1 -0
- package/dist/lib/action/phone-number-lookup.d.ts +4 -0
- package/dist/lib/action/phone-number-lookup.d.ts.map +1 -0
- package/dist/lib/action/phone-number-lookup.js +44 -0
- package/dist/lib/action/phone-number-lookup.js.map +1 -0
- package/dist/lib/action/send-sms.d.ts +6 -0
- package/dist/lib/action/send-sms.d.ts.map +1 -0
- package/dist/lib/action/send-sms.js +44 -0
- package/dist/lib/action/send-sms.js.map +1 -0
- package/dist/lib/common/index.d.ts +9 -0
- package/dist/lib/common/index.d.ts.map +1 -0
- package/dist/lib/common/index.js +56 -0
- package/dist/lib/common/index.js.map +1 -0
- package/dist/lib/trigger/new-call.d.ts +3 -0
- package/dist/lib/trigger/new-call.d.ts.map +1 -0
- package/dist/lib/trigger/new-call.js +135 -0
- package/dist/lib/trigger/new-call.js.map +1 -0
- package/dist/lib/trigger/new-incoming-sms.d.ts +11 -0
- package/dist/lib/trigger/new-incoming-sms.d.ts.map +1 -0
- package/dist/lib/trigger/new-incoming-sms.js +108 -0
- package/dist/lib/trigger/new-incoming-sms.js.map +1 -0
- package/dist/lib/trigger/new-phone-number.d.ts +3 -0
- package/dist/lib/trigger/new-phone-number.d.ts.map +1 -0
- package/dist/lib/trigger/new-phone-number.js +113 -0
- package/dist/lib/trigger/new-phone-number.js.map +1 -0
- package/dist/lib/trigger/new-recording.d.ts +3 -0
- package/dist/lib/trigger/new-recording.d.ts.map +1 -0
- package/dist/lib/trigger/new-recording.js +123 -0
- package/dist/lib/trigger/new-recording.js.map +1 -0
- package/dist/lib/trigger/new-transcription.d.ts +3 -0
- package/dist/lib/trigger/new-transcription.d.ts.map +1 -0
- package/dist/lib/trigger/new-transcription.js +112 -0
- package/dist/lib/trigger/new-transcription.js.map +1 -0
- package/package.json +43 -3
- package/src/index.ts +63 -0
- package/src/lib/action/download-recording-media.ts +74 -0
- package/src/lib/action/get-message.ts +35 -0
- package/src/lib/action/make-call.ts +101 -0
- package/src/lib/action/phone-number-lookup.ts +39 -0
- package/src/lib/action/send-sms.ts +41 -0
- package/src/lib/common/index.ts +69 -0
- package/src/lib/trigger/new-call.ts +156 -0
- package/src/lib/trigger/new-incoming-sms.ts +123 -0
- package/src/lib/trigger/new-phone-number.ts +149 -0
- package/src/lib/trigger/new-recording.ts +140 -0
- package/src/lib/trigger/new-transcription.ts +140 -0
package/LICENSE.MIT-AP
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Activepieces AB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Derived helpers in this folder are adapted from Activepieces (MIT) for use
|
|
24
|
+
inside CX without depending on @activepieces/* packages at runtime.
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @divyacon/piece-twilio
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DivyaCon connector for workflows and automations.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
`ash
|
|
8
|
+
npm install @divyacon/piece-twilio
|
|
9
|
+
`
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,UAAU,uDAYrB,CAAC;AAEH,eAAO,MAAM,MAAM,kGAkCjB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.twilio = exports.twilioAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/twilio/src/index.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const pieces_framework_2 = require("@agnocon/pieces-framework");
|
|
10
|
+
const send_sms_1 = require("./lib/action/send-sms");
|
|
11
|
+
const new_incoming_sms_1 = require("./lib/trigger/new-incoming-sms");
|
|
12
|
+
const phone_number_lookup_1 = require("./lib/action/phone-number-lookup");
|
|
13
|
+
const make_call_1 = require("./lib/action/make-call");
|
|
14
|
+
const get_message_1 = require("./lib/action/get-message");
|
|
15
|
+
const download_recording_media_1 = require("./lib/action/download-recording-media");
|
|
16
|
+
const new_phone_number_1 = require("./lib/trigger/new-phone-number");
|
|
17
|
+
const new_recording_1 = require("./lib/trigger/new-recording");
|
|
18
|
+
const new_transcription_1 = require("./lib/trigger/new-transcription");
|
|
19
|
+
const new_call_1 = require("./lib/trigger/new-call");
|
|
20
|
+
exports.twilioAuth = pieces_framework_1.PieceAuth.BasicAuth({
|
|
21
|
+
description: 'The authentication to use to connect to Twilio',
|
|
22
|
+
required: true,
|
|
23
|
+
username: {
|
|
24
|
+
displayName: 'Account SID',
|
|
25
|
+
description: 'The account SID to use to connect to Twilio',
|
|
26
|
+
},
|
|
27
|
+
password: {
|
|
28
|
+
displayName: 'Auth token',
|
|
29
|
+
description: 'The auth token to use to connect to Twilio',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
exports.twilio = (0, pieces_framework_1.createPiece)({
|
|
33
|
+
displayName: 'Twilio',
|
|
34
|
+
description: 'Cloud communications platform for building SMS, Voice & Messaging applications',
|
|
35
|
+
minimumSupportedRelease: '0.30.0',
|
|
36
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/twilio.png',
|
|
37
|
+
auth: exports.twilioAuth,
|
|
38
|
+
categories: [pieces_framework_2.PieceCategory.COMMUNICATION],
|
|
39
|
+
actions: [
|
|
40
|
+
send_sms_1.twilioSendSms,
|
|
41
|
+
phone_number_lookup_1.twilioPhoneNumberLookup,
|
|
42
|
+
make_call_1.twilioMakeCall,
|
|
43
|
+
get_message_1.twilioGetMessage,
|
|
44
|
+
download_recording_media_1.twilioDownloadRecordingMedia,
|
|
45
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
46
|
+
baseUrl: () => 'https://api.twilio.com/2010-04-01',
|
|
47
|
+
auth: exports.twilioAuth,
|
|
48
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
return ({
|
|
50
|
+
Authorization: `Basic ${Buffer.from(`${auth.username}:${auth.password}`).toString('base64')}`,
|
|
51
|
+
});
|
|
52
|
+
}),
|
|
53
|
+
}),
|
|
54
|
+
],
|
|
55
|
+
authors: ["kishanprmr", "MoShizzle", "khaledmashaly", "abuaboud"],
|
|
56
|
+
triggers: [new_incoming_sms_1.twilioNewIncomingSms,
|
|
57
|
+
new_phone_number_1.twilioNewPhoneNumber,
|
|
58
|
+
new_recording_1.twilioNewRecording,
|
|
59
|
+
new_transcription_1.twilioNewTranscription,
|
|
60
|
+
new_call_1.twilioNewCall
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,kFAAkF;AAClF,qEAAqE;AACrE,0DAAmE;AACnE,gEAAmE;AACnE,gEAA0D;AAC1D,oDAAsD;AACtD,qEAAsE;AACtE,0EAA2E;AAC3E,sDAAwD;AACxD,0DAA4D;AAC5D,oFAAqF;AACrF,qEAAsE;AACtE,+DAAiE;AACjE,uEAAyE;AACzE,qDAAuD;AAE1C,QAAA,UAAU,GAAG,4BAAS,CAAC,SAAS,CAAC;IAC5C,WAAW,EAAE,gDAAgD;IAE7D,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE;QACR,WAAW,EAAE,aAAa;QAC1B,WAAW,EAAE,6CAA6C;KAC3D;IACD,QAAQ,EAAE;QACR,WAAW,EAAE,YAAY;QACzB,WAAW,EAAE,4CAA4C;KAC1D;CACF,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,QAAQ;IACrB,WAAW,EACT,gFAAgF;IAElF,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,gDAAgD;IACzD,IAAI,EAAE,kBAAU;IAChB,UAAU,EAAE,CAAC,gCAAa,CAAC,aAAa,CAAC;IACzC,OAAO,EAAE;QACP,wBAAa;QACb,6CAAuB;QACvB,0BAAc;QACd,8BAAgB;QAChB,uDAA4B;QAC5B,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,mCAAmC;YAClD,IAAI,EAAE,kBAAU;YAChB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CACjC,GAAG,IAAI,CAAC,QAAQ,IACd,IAAI,CAAC,QACP,EAAE,CACH,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;iBACvB,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,OAAO,EAAE,CAAC,YAAY,EAAC,WAAW,EAAC,eAAe,EAAC,UAAU,CAAC;IAC9D,QAAQ,EAAE,CAAC,uCAAoB;QAC7B,uCAAoB;QACpB,kCAAkB;QAClB,0CAAsB;QACtB,wBAAa;KACd;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const twilioDownloadRecordingMedia: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").BasicAuthProperty, {
|
|
2
|
+
recording_sid: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
format: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
4
|
+
channels: import("@agnocon/pieces-framework").StaticDropdownProperty<number, false>;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=download-recording-media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-recording-media.d.ts","sourceRoot":"","sources":["../../../src/lib/action/download-recording-media.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B;;;;EAqEvC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.twilioDownloadRecordingMedia = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/twilio/src/lib/action/download-recording-media.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const __1 = require("../..");
|
|
10
|
+
exports.twilioDownloadRecordingMedia = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.twilioAuth,
|
|
12
|
+
name: 'download_recording_media',
|
|
13
|
+
displayName: 'Download Recording Media',
|
|
14
|
+
description: 'Download the media file for a specific recording.',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Downloads the audio file for a specific Twilio call recording by its SID, returning it as a file (MP3 or WAV). Use to retrieve recorded call audio for storage or further processing; requires the recording SID (starting with "RE"). Read-only and idempotent.', idempotent: true },
|
|
17
|
+
props: {
|
|
18
|
+
recording_sid: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Recording SID',
|
|
20
|
+
description: 'The unique identifier (SID) of the recording to download. It starts with "RE".',
|
|
21
|
+
required: true,
|
|
22
|
+
}),
|
|
23
|
+
format: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
+
displayName: 'Format',
|
|
25
|
+
description: 'The desired audio format for the download file.',
|
|
26
|
+
required: false,
|
|
27
|
+
defaultValue: 'mp3',
|
|
28
|
+
options: {
|
|
29
|
+
options: [
|
|
30
|
+
{ label: 'MP3', value: 'mp3' },
|
|
31
|
+
{ label: 'WAV', value: 'wav' },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
channels: pieces_framework_1.Property.StaticDropdown({
|
|
36
|
+
displayName: 'Channels',
|
|
37
|
+
description: 'Specify whether to download a mono or dual-channel file. Note: Dual-channel may not be available for all recordings.',
|
|
38
|
+
required: false,
|
|
39
|
+
options: {
|
|
40
|
+
options: [
|
|
41
|
+
{ label: 'Mono', value: 1 },
|
|
42
|
+
{ label: 'Dual', value: 2 },
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
},
|
|
47
|
+
run(context) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { recording_sid, format, channels } = context.propsValue;
|
|
50
|
+
const account_sid = context.auth.username;
|
|
51
|
+
const auth_token = context.auth.password;
|
|
52
|
+
const fileFormat = format !== null && format !== void 0 ? format : 'mp3';
|
|
53
|
+
const path = `Recordings/${recording_sid}.${fileFormat}`;
|
|
54
|
+
const queryParams = {};
|
|
55
|
+
if (channels) {
|
|
56
|
+
queryParams['RequestedChannels'] = channels.toString();
|
|
57
|
+
}
|
|
58
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
59
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
60
|
+
url: `https://api.twilio.com/2010-04-01/Accounts/${account_sid}/${path}`,
|
|
61
|
+
queryParams: queryParams,
|
|
62
|
+
authentication: {
|
|
63
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
64
|
+
username: account_sid,
|
|
65
|
+
password: auth_token,
|
|
66
|
+
},
|
|
67
|
+
responseType: 'arraybuffer',
|
|
68
|
+
});
|
|
69
|
+
const fileData = Buffer.from(response.body);
|
|
70
|
+
return yield context.files.write({
|
|
71
|
+
fileName: `${recording_sid}.${fileFormat}`,
|
|
72
|
+
data: fileData,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=download-recording-media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-recording-media.js","sourceRoot":"","sources":["../../../src/lib/action/download-recording-media.ts"],"names":[],"mappings":";;;;AAAA,gHAAgH;AAChH,qEAAqE;AACrE,gEAAmE;AACnE,0DAAiG;AACjG,6BAAmC;AAEtB,QAAA,4BAA4B,GAAG,IAAA,+BAAY,EAAC;IACvD,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,mDAAmD;IAChE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,kQAAkQ,EAAE,UAAU,EAAE,IAAI,EAAE;IACjT,KAAK,EAAE;QACL,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,gFAAgF;YAC7F,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC9B,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC/B;aACF;SACF,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,sHAAsH;YACnI,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;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E,QAAQ;aACf,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-message.d.ts","sourceRoot":"","sources":["../../../src/lib/action/get-message.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;EA6B3B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.twilioGetMessage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/twilio/src/lib/action/get-message.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
exports.twilioGetMessage = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: __1.twilioAuth,
|
|
13
|
+
name: 'get_message',
|
|
14
|
+
description: 'Retrieves the details of a specific message.',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Fetches the full details and status of a single Twilio message by its SID. Use to check delivery status or inspect a known message; requires the message SID (starting with "SM" or "MM"). Read-only and idempotent.', idempotent: true },
|
|
17
|
+
displayName: 'Get Message',
|
|
18
|
+
props: {
|
|
19
|
+
message_sid: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Message SID',
|
|
21
|
+
description: 'The unique identifier (SID) of the message to retrieve. It starts with "SM" or "MM".',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { message_sid } = context.propsValue;
|
|
28
|
+
const account_sid = context.auth.username;
|
|
29
|
+
const auth_token = context.auth.password;
|
|
30
|
+
const path = `Messages/${message_sid}.json`;
|
|
31
|
+
const response = yield (0, common_1.callTwilioApi)(pieces_common_1.HttpMethod.GET, path, { account_sid, auth_token });
|
|
32
|
+
return response.body;
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=get-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-message.js","sourceRoot":"","sources":["../../../src/lib/action/get-message.ts"],"names":[],"mappings":";;;;AAAA,mGAAmG;AACnG,qEAAqE;AACrE,gEAAmE;AACnE,0DAAoD;AACpD,sCAA0C;AAC1C,6BAAmC;AAEtB,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,8CAA8C;IAC3D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,sNAAsN,EAAE,UAAU,EAAE,IAAI,EAAE;IACrQ,WAAW,EAAE,aAAa;IAC1B,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,sFAAsF;YACnG,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YAEzC,MAAM,IAAI,GAAG,YAAY,WAAW,OAAO,CAAC;YAE5C,MAAM,QAAQ,GAAI,MAAM,IAAA,sBAAa,EACnC,0BAAU,CAAC,GAAG,EACd,IAAI,EACJ,EAAE,WAAW,EAAE,UAAU,EAAE,CAC5B,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const twilioMakeCall: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").BasicAuthProperty, {
|
|
2
|
+
from: import("@agnocon/pieces-framework").DropdownProperty<any, true, import("@agnocon/pieces-framework").BasicAuthProperty>;
|
|
3
|
+
to: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
message: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
voice: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
language: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
sendDigits: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
timeout: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=make-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-call.d.ts","sourceRoot":"","sources":["../../../src/lib/action/make-call.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;EA+FzB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.twilioMakeCall = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/twilio/src/lib/action/make-call.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
exports.twilioMakeCall = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: __1.twilioAuth,
|
|
13
|
+
name: 'make_call',
|
|
14
|
+
description: 'Call a number and say a message.',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Places an outbound voice call from a Twilio number that reads a text-to-speech message to the recipient. Use to deliver a spoken notification or alert by phone. Requires both numbers in E.164 format and the message text; each call places a real, billable phone call, so it is not idempotent.', idempotent: false },
|
|
17
|
+
displayName: 'Call Phone',
|
|
18
|
+
props: {
|
|
19
|
+
from: common_1.twilioCommon.phone_number,
|
|
20
|
+
to: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'To',
|
|
22
|
+
description: 'The phone number to call. Must be in E.164 format (e.g., +15558675310).',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
message: pieces_framework_1.Property.LongText({
|
|
26
|
+
displayName: 'Message to Say',
|
|
27
|
+
description: 'The text message to be converted to speech and spoken to the recipient.',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
voice: pieces_framework_1.Property.StaticDropdown({
|
|
31
|
+
displayName: 'Voice',
|
|
32
|
+
description: 'The voice to use for the text-to-speech message.',
|
|
33
|
+
required: false,
|
|
34
|
+
options: {
|
|
35
|
+
options: [
|
|
36
|
+
{ label: 'Alice (Default)', value: 'alice' },
|
|
37
|
+
{ label: 'Man', value: 'man' },
|
|
38
|
+
{ label: 'Woman', value: 'woman' },
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
language: pieces_framework_1.Property.StaticDropdown({
|
|
43
|
+
displayName: 'Language',
|
|
44
|
+
description: 'The language to use for the text-to-speech message.',
|
|
45
|
+
required: false,
|
|
46
|
+
options: {
|
|
47
|
+
options: [
|
|
48
|
+
{ label: 'English (US)', value: 'en-US' },
|
|
49
|
+
{ label: 'English (UK)', value: 'en-GB' },
|
|
50
|
+
{ label: 'Spanish', value: 'es-ES' },
|
|
51
|
+
{ label: 'French', value: 'fr-FR' },
|
|
52
|
+
{ label: 'German', value: 'de-DE' },
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
sendDigits: pieces_framework_1.Property.ShortText({
|
|
57
|
+
displayName: 'Send DTMF Tones',
|
|
58
|
+
description: "A string of keys to dial after the call is connected. Use 'w' for a half-second pause.",
|
|
59
|
+
required: false,
|
|
60
|
+
}),
|
|
61
|
+
timeout: pieces_framework_1.Property.Number({
|
|
62
|
+
displayName: 'Timeout (seconds)',
|
|
63
|
+
description: 'The number of seconds to let the phone ring before assuming no answer. Default is 60.',
|
|
64
|
+
required: false,
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
run(context) {
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const { from, to, message, voice, language, sendDigits, timeout } = context.propsValue;
|
|
70
|
+
const account_sid = context.auth.username;
|
|
71
|
+
const auth_token = context.auth.password;
|
|
72
|
+
// Construct TwiML for the <Say> verb
|
|
73
|
+
const voiceAttr = voice ? ` voice="${voice}"` : '';
|
|
74
|
+
const langAttr = language ? ` language="${language}"` : '';
|
|
75
|
+
const escapedMessage = message
|
|
76
|
+
.replace(/&/g, '&')
|
|
77
|
+
.replace(/</g, '<')
|
|
78
|
+
.replace(/>/g, '>')
|
|
79
|
+
.replace(/"/g, '"')
|
|
80
|
+
.replace(/'/g, ''');
|
|
81
|
+
const twiml = `<Response><Say${voiceAttr}${langAttr}>${escapedMessage}</Say></Response>`;
|
|
82
|
+
const bodyParams = {
|
|
83
|
+
From: from,
|
|
84
|
+
To: to,
|
|
85
|
+
Twiml: twiml,
|
|
86
|
+
};
|
|
87
|
+
if (sendDigits) {
|
|
88
|
+
bodyParams['SendDigits'] = sendDigits;
|
|
89
|
+
}
|
|
90
|
+
if (timeout) {
|
|
91
|
+
bodyParams['Timeout'] = timeout;
|
|
92
|
+
}
|
|
93
|
+
const response = yield (0, common_1.callTwilioApi)(pieces_common_1.HttpMethod.POST, 'Calls.json', { account_sid, auth_token }, bodyParams);
|
|
94
|
+
return response.body;
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=make-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-call.js","sourceRoot":"","sources":["../../../src/lib/action/make-call.ts"],"names":[],"mappings":";;;;AAAA,iGAAiG;AACjG,qEAAqE;AACrE,gEAAmE;AACnE,0DAAoD;AACpD,sCAAwD;AACxD,6BAAmC;AAEtB,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,kCAAkC;IAC/C,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,qSAAqS,EAAE,UAAU,EAAE,KAAK,EAAE;IACrV,WAAW,EAAE,YAAY;IACzB,KAAK,EAAE;QACL,IAAI,EAAE,qBAAY,CAAC,YAAY;QAC/B,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,yEAAyE;YACtF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,yEAAyE;YACtF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC3B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE;oBAC5C,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC9B,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;iBACrC;aACJ;S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GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,MAAM,cAAc,GAAG,OAAO;iBACzB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;iBACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;iBACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;iBACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;iBACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC7B,MAAM,KAAK,GAAG,iBAAiB,SAAS,GAAG,QAAQ,IAAI,cAAc,mBAAmB,CAAC;YAEzF,MAAM,UAAU,GAA4B;gBAC1C,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE;gBACN,KAAK,EAAE,KAAK;aACb,CAAC;YAEF,IAAI,UAAU,EAAE,CAAC;gBACf,UAAU,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;YACxC,CAAC;YACD,IAAI,OAAO,EAAE,CAAC;gBACZ,UAAU,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;YAClC,CAAC;YAED,MAAM,QAAQ,GAAI,MAAM,IAAA,sBAAa,EACnC,0BAAU,CAAC,IAAI,EACf,YAAY,EACZ,EAAE,WAAW,EAAE,UAAU,EAAE,EAC3B,UAAU,CACX,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const twilioPhoneNumberLookup: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").BasicAuthProperty, {
|
|
2
|
+
phone_number: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
}>;
|
|
4
|
+
//# sourceMappingURL=phone-number-lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-number-lookup.d.ts","sourceRoot":"","sources":["../../../src/lib/action/phone-number-lookup.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB;;EAkClC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.twilioPhoneNumberLookup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/twilio/src/lib/action/phone-number-lookup.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const __1 = require("../..");
|
|
10
|
+
exports.twilioPhoneNumberLookup = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.twilioAuth,
|
|
12
|
+
name: 'phone_number_lookup',
|
|
13
|
+
description: 'Lookup information about a phone number.',
|
|
14
|
+
audience: 'both',
|
|
15
|
+
aiMetadata: { description: 'Looks up carrier and line-type intelligence for a single phone number via the Twilio Lookup API. Use to validate or enrich a number (e.g. detect mobile vs landline, carrier) before messaging or calling it. Read-only and idempotent.', idempotent: true },
|
|
16
|
+
displayName: 'Phone Number Lookup',
|
|
17
|
+
props: {
|
|
18
|
+
phone_number: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Phone Number',
|
|
20
|
+
required: true
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const { phone_number } = context.propsValue;
|
|
26
|
+
const account_sid = context.auth.username;
|
|
27
|
+
const auth_token = context.auth.password;
|
|
28
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
29
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
30
|
+
url: `https://lookups.twilio.com/v2/PhoneNumbers/${encodeURIComponent(phone_number)}`,
|
|
31
|
+
authentication: {
|
|
32
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
33
|
+
username: account_sid,
|
|
34
|
+
password: auth_token,
|
|
35
|
+
},
|
|
36
|
+
queryParams: {
|
|
37
|
+
Fields: 'line_type_intelligence'
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return response.body;
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=phone-number-lookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-number-lookup.js","sourceRoot":"","sources":["../../../src/lib/action/phone-number-lookup.ts"],"names":[],"mappings":";;;;AAAA,2GAA2G;AAC3G,qEAAqE;AACrE,gEAAmE;AACnE,0DAAoF;AACpF,6BAAmC;AAEtB,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,0CAA0C;IACvD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,yOAAyO,EAAE,UAAU,EAAE,IAAI,EAAE;IACxR,WAAW,EAAE,qBAAqB;IAClC,KAAK,EAAE;QACL,YAAY,EAAC,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAC,cAAc;YAC1B,QAAQ,EAAC,IAAI;SACd,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE5C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YAEzC,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAC,0BAAU,CAAC,GAAG;gBACrB,GAAG,EAAC,8CAA8C,kBAAkB,CAAC,YAAY,CAAC,EAAE;gBACnF,cAAc,EAAE;oBACX,IAAI,EAAE,kCAAkB,CAAC,KAAK;oBAC9B,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,UAAU;iBACrB;gBACH,WAAW,EAAC;oBACV,MAAM,EAAC,wBAAwB;iBAChC;aACJ,CAAC,CAAA;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;QACtB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const twilioSendSms: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").BasicAuthProperty, {
|
|
2
|
+
from: import("@agnocon/pieces-framework").DropdownProperty<any, true, import("@agnocon/pieces-framework").BasicAuthProperty>;
|
|
3
|
+
body: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
to: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=send-sms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-sms.d.ts","sourceRoot":"","sources":["../../../src/lib/action/send-sms.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa;;;;EAmCxB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.twilioSendSms = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/twilio/src/lib/action/send-sms.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
const __1 = require("../..");
|
|
11
|
+
exports.twilioSendSms = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: __1.twilioAuth,
|
|
13
|
+
name: 'send_sms',
|
|
14
|
+
description: 'Send a new SMS message',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Sends an SMS text message from a Twilio phone number to a recipient. Use to notify or message a person by text. Requires the destination number, message body, and a Twilio-owned sender number; sending costs money and delivers a separate message on every call, so it is not idempotent.', idempotent: false },
|
|
17
|
+
displayName: 'Send SMS',
|
|
18
|
+
props: {
|
|
19
|
+
from: common_1.twilioCommon.phone_number,
|
|
20
|
+
body: pieces_framework_1.Property.ShortText({
|
|
21
|
+
description: 'The body of the message to send',
|
|
22
|
+
displayName: 'Message Body',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
to: pieces_framework_1.Property.ShortText({
|
|
26
|
+
description: 'The phone number to send the message to',
|
|
27
|
+
displayName: 'To',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { body, to, from } = context.propsValue;
|
|
34
|
+
const account_sid = context.auth.username;
|
|
35
|
+
const auth_token = context.auth.password;
|
|
36
|
+
return yield (0, common_1.callTwilioApi)(pieces_common_1.HttpMethod.POST, 'Messages.json', { account_sid, auth_token }, {
|
|
37
|
+
From: from,
|
|
38
|
+
Body: body,
|
|
39
|
+
To: to,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=send-sms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-sms.js","sourceRoot":"","sources":["../../../src/lib/action/send-sms.ts"],"names":[],"mappings":";;;;AAAA,gGAAgG;AAChG,qEAAqE;AACrE,gEAAmE;AACnE,0DAAoD;AACpD,sCAAwD;AACxD,6BAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,wBAAwB;IACrC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,8RAA8R,EAAE,UAAU,EAAE,KAAK,EAAE;IAC9U,WAAW,EAAE,UAAU;IACvB,KAAK,EAAE;QACL,IAAI,EAAE,qBAAY,CAAC,YAAY;QAC/B,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,iCAAiC;YAC9C,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,yCAAyC;YACtD,WAAW,EAAE,IAAI;YACjB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC9C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YACzC,OAAO,MAAM,IAAA,sBAAa,EACxB,0BAAU,CAAC,IAAI,EACf,eAAe,EACf,EAAE,WAAW,EAAE,UAAU,EAAE,EAC3B;gBACE,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,IAAI;gBACV,EAAE,EAAE,EAAE;aACP,CACF,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpMethod } from '@agnocon/pieces-common';
|
|
2
|
+
export declare const twilioCommon: {
|
|
3
|
+
phone_number: import("@agnocon/pieces-framework").DropdownProperty<any, true, import("@agnocon/pieces-framework").BasicAuthProperty>;
|
|
4
|
+
};
|
|
5
|
+
export declare const callTwilioApi: <T extends unknown>(method: HttpMethod, path: string, auth: {
|
|
6
|
+
account_sid: string;
|
|
7
|
+
auth_token: string;
|
|
8
|
+
}, body?: any) => Promise<import("@agnocon/pieces-common").HttpResponse<T>>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/common/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,UAAU,EAIX,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,YAAY;;CAmCxB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,CAAC,0BAC3B,UAAU,QACZ,MAAM,QACN;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,SAC1C,GAAG,8DAeX,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.callTwilioApi = exports.twilioCommon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/twilio/src/lib/common/index.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
9
|
+
const __1 = require("../..");
|
|
10
|
+
exports.twilioCommon = {
|
|
11
|
+
phone_number: pieces_framework_1.Property.Dropdown({
|
|
12
|
+
auth: __1.twilioAuth,
|
|
13
|
+
description: 'The phone number to send the message from',
|
|
14
|
+
displayName: 'From',
|
|
15
|
+
required: true,
|
|
16
|
+
refreshers: [],
|
|
17
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
18
|
+
if (!auth) {
|
|
19
|
+
return {
|
|
20
|
+
disabled: true,
|
|
21
|
+
placeholder: 'connect your account first',
|
|
22
|
+
options: [],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const basicAuthProperty = auth;
|
|
26
|
+
const response = yield (0, exports.callTwilioApi)(pieces_common_1.HttpMethod.GET, 'IncomingPhoneNumbers.json', {
|
|
27
|
+
account_sid: basicAuthProperty.username,
|
|
28
|
+
auth_token: basicAuthProperty.password,
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
disabled: false,
|
|
32
|
+
options: response.body.incoming_phone_numbers.map((number) => ({
|
|
33
|
+
value: number.phone_number,
|
|
34
|
+
label: number.friendly_name,
|
|
35
|
+
})),
|
|
36
|
+
};
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
const callTwilioApi = (method, path, auth, body) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
42
|
+
method,
|
|
43
|
+
url: `https://api.twilio.com/2010-04-01/Accounts/${auth.account_sid}/${path}`,
|
|
44
|
+
authentication: {
|
|
45
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
46
|
+
username: auth.account_sid,
|
|
47
|
+
password: auth.auth_token,
|
|
48
|
+
},
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
51
|
+
},
|
|
52
|
+
body: body,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
exports.callTwilioApi = callTwilioApi;
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,6FAA6F;AAC7F,qEAAqE;AACrE,gEAGmC;AACnC,0DAKgC;AAChC,6BAAmC;AAEtB,QAAA,YAAY,GAAG;IAC1B,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC;QAC9B,IAAI,EAAE,cAAU;QAChB,WAAW,EAAE,2CAA2C;QACxD,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,IAAI;QACd,UAAU,EAA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,0 +1,3 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@agnocon/pieces-framework';
|
|
2
|
+
export declare const twilioNewCall: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").BasicAuthProperty, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").BasicAuthProperty, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").BasicAuthProperty, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").BasicAuthProperty, {}>;
|
|
3
|
+
//# sourceMappingURL=new-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-call.d.ts","sourceRoot":"","sources":["../../../src/lib/trigger/new-call.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAA2D,MAAM,2BAA2B,CAAC;AAqFpI,eAAO,MAAM,aAAa,8gBAsExB,CAAC"}
|