@pipedream/twilio 0.5.0 → 0.6.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/actions/check-verification-token/check-verification-token.mjs +1 -1
- package/actions/create-verification-service/create-verification-service.mjs +1 -1
- package/actions/delete-call/delete-call.mjs +1 -1
- package/actions/delete-message/delete-message.mjs +1 -1
- package/actions/download-recording-media/download-recording-media.mjs +1 -1
- package/actions/get-call/get-call.mjs +53 -2
- package/actions/get-message/get-message.mjs +1 -1
- package/actions/get-transcripts/get-transcripts.mjs +40 -0
- package/actions/list-calls/list-calls.mjs +1 -1
- package/actions/list-message-media/list-message-media.mjs +1 -1
- package/actions/list-messages/list-messages.mjs +1 -1
- package/actions/list-transcripts/list-transcripts.mjs +1 -1
- package/actions/make-phone-call/make-phone-call.mjs +1 -1
- package/actions/phone-number-lookup/phone-number-lookup.mjs +1 -1
- package/actions/send-message/send-message.mjs +1 -1
- package/actions/send-sms-verification/send-sms-verification.mjs +1 -1
- package/common/utils.mjs +1 -0
- package/package.json +1 -1
- package/sources/new-call/new-call.mjs +1 -1
- package/sources/new-incoming-sms/new-incoming-sms.mjs +1 -1
- package/sources/new-phone-number/new-phone-number.mjs +1 -1
- package/sources/new-recording/new-recording.mjs +1 -1
- package/sources/new-transcript-created/new-transcript-created.mjs +1 -1
- package/twilio.app.mjs +21 -3
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "Check Verification Token",
|
|
7
7
|
description: "Check if user-provided token is correct. [See the documentation](https://www.twilio.com/docs/verify/api)",
|
|
8
8
|
type: "action",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.3",
|
|
10
10
|
props: {
|
|
11
11
|
app,
|
|
12
12
|
serviceSid: {
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Create Verification Service",
|
|
6
6
|
description: "Create a verification service for sending SMS verifications. [See the documentation](https://www.twilio.com/docs/verify/api/service#create-a-verification-service)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
props: {
|
|
10
10
|
twilio,
|
|
11
11
|
friendlyName: {
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "twilio-delete-call",
|
|
5
5
|
name: "Delete Call",
|
|
6
6
|
description: "Remove a call record from your account. [See the documentation](https://www.twilio.com/docs/voice/api/call-resource#delete-a-call-resource)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.4",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
twilio,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "twilio-delete-message",
|
|
5
5
|
name: "Delete Message",
|
|
6
6
|
description: "Delete a message record from your account. [See the documentation](https://www.twilio.com/docs/sms/api/message-resource#delete-a-message-resource)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.4",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
twilio,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "twilio-download-recording-media",
|
|
9
9
|
name: "Download Recording Media",
|
|
10
10
|
description: "Download a recording media file. [See the documentation](https://www.twilio.com/docs/voice/api/recording#fetch-a-recording-media-file)",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.6",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
twilio,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "twilio-get-call",
|
|
6
6
|
name: "Get Call",
|
|
7
7
|
description: "Return call resource of an individual call. [See the documentation](https://www.twilio.com/docs/voice/api/call-resource#fetch-a-call-resource)",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
twilio,
|
|
@@ -16,9 +16,60 @@ export default {
|
|
|
16
16
|
],
|
|
17
17
|
optional: false,
|
|
18
18
|
},
|
|
19
|
+
includeTranscripts: {
|
|
20
|
+
type: "boolean",
|
|
21
|
+
label: "Include Transcripts",
|
|
22
|
+
description: "Set to `true` to include recording transcript(s) if available",
|
|
23
|
+
optional: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
async getTranscripts(callSid) {
|
|
28
|
+
const transcripts = [];
|
|
29
|
+
const recordings = await this.twilio.listRecordings({
|
|
30
|
+
callSid,
|
|
31
|
+
});
|
|
32
|
+
for (const recording of recordings) {
|
|
33
|
+
const recordingTranscripts = await this.getRecordingTranscripts(recording.sid);
|
|
34
|
+
if (recordingTranscripts?.length) {
|
|
35
|
+
transcripts.push(...recordingTranscripts);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return transcripts;
|
|
39
|
+
},
|
|
40
|
+
async getRecordingTranscripts(sourceSid) {
|
|
41
|
+
const transcripts = await this.twilio.listTranscripts({
|
|
42
|
+
sourceSid,
|
|
43
|
+
});
|
|
44
|
+
const results = [];
|
|
45
|
+
for (const transcript of transcripts) {
|
|
46
|
+
const {
|
|
47
|
+
sentences, transcript: fullTranscript,
|
|
48
|
+
} = await this.twilio.getSentences(transcript.sid);
|
|
49
|
+
results.push({
|
|
50
|
+
...transcript,
|
|
51
|
+
_version: undefined,
|
|
52
|
+
sentences,
|
|
53
|
+
transcript: fullTranscript,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return results;
|
|
57
|
+
},
|
|
19
58
|
},
|
|
20
59
|
async run({ $ }) {
|
|
21
|
-
|
|
60
|
+
let resp = await this.twilio.getCall(this.sid);
|
|
61
|
+
|
|
62
|
+
if (this.includeTranscripts) {
|
|
63
|
+
const transcripts = await this.getTranscripts(this.sid);
|
|
64
|
+
if (transcripts?.length) {
|
|
65
|
+
resp = {
|
|
66
|
+
...resp,
|
|
67
|
+
_version: undefined,
|
|
68
|
+
transcripts,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
22
73
|
$.export("$summary", `Successfully fetched the call, "${callToString(resp)}"`);
|
|
23
74
|
return resp;
|
|
24
75
|
},
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "twilio-get-message",
|
|
6
6
|
name: "Get Message",
|
|
7
7
|
description: "Return details of a message. [See the documentation](https://www.twilio.com/docs/sms/api/message-resource#fetch-a-message-resource)",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
twilio,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import twilio from "../../twilio.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twilio-get-transcripts",
|
|
5
|
+
name: "Get Transcripts",
|
|
6
|
+
description: "Retrieves full transcripts for the specified transcript SIDs. [See the documentation](https://www.twilio.com/docs/voice/intelligence/api/transcript-sentence-resource#get-transcript-sentences)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
twilio,
|
|
11
|
+
transcriptSids: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twilio,
|
|
14
|
+
"transcriptSids",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
async run({ $ }) {
|
|
19
|
+
const transcripts = [];
|
|
20
|
+
for (const sid of this.transcriptSids) {
|
|
21
|
+
transcripts.push(await this.twilio.getTranscript(sid));
|
|
22
|
+
}
|
|
23
|
+
const results = [];
|
|
24
|
+
for (const transcript of transcripts) {
|
|
25
|
+
const {
|
|
26
|
+
sentences, transcript: fullTranscript,
|
|
27
|
+
} = await this.twilio.getSentences(transcript.sid);
|
|
28
|
+
results.push({
|
|
29
|
+
...transcript,
|
|
30
|
+
_version: undefined,
|
|
31
|
+
sentences,
|
|
32
|
+
transcript: fullTranscript,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
$.export("$summary", `Successfully fetched ${results.length} transcript${results.length === 1
|
|
36
|
+
? ""
|
|
37
|
+
: "s"}`);
|
|
38
|
+
return results;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "twilio-list-calls",
|
|
6
6
|
name: "List Calls",
|
|
7
7
|
description: "Return a list of calls associated with your account. [See the documentation](https://www.twilio.com/docs/voice/api/call-resource#read-multiple-call-resources)",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
twilio,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "twilio-list-message-media",
|
|
6
6
|
name: "List Message Media",
|
|
7
7
|
description: "Return a list of media associated with your message. [See the documentation](https://www.twilio.com/docs/sms/api/media-resource#read-multiple-media-resources)",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.4",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
twilio,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "twilio-list-messages",
|
|
7
7
|
name: "List Messages",
|
|
8
8
|
description: "Return a list of messages associated with your account. [See the documentation](https://www.twilio.com/docs/sms/api/message-resource#read-multiple-message-resources)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.5",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
twilio,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "twilio-list-transcripts",
|
|
6
6
|
name: "List Transcripts",
|
|
7
7
|
description: "Return a list of transcripts. [See the documentation](https://www.twilio.com/docs/voice/intelligence/api/transcript-resource#fetch-multiple-transcripts)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
twilio,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "twilio-make-phone-call",
|
|
7
7
|
name: "Make a Phone Call",
|
|
8
8
|
description: "Make a phone call passing text, a URL, or an application that Twilio will use to handle the call. [See the documentation](https://www.twilio.com/docs/voice/api/call-resource#create-a-call-resource)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.5",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
twilio,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Phone Number Lookup",
|
|
6
6
|
description: "Lookup information about a phone number. [See the documentation](https://www.twilio.com/docs/lookup/v2-api/line-type-intelligence) for more information",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.2",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
sid: {
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "Send Message",
|
|
8
8
|
description: "Send an SMS text with optional media files. [See the documentation](https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource)",
|
|
9
9
|
type: "action",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.2",
|
|
11
11
|
props: {
|
|
12
12
|
twilio,
|
|
13
13
|
from: {
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Send SMS Verification",
|
|
6
6
|
description: "Send an SMS verification to a phone number. [See the documentation](https://www.twilio.com/docs/verify/api)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.3",
|
|
9
9
|
props: {
|
|
10
10
|
app,
|
|
11
11
|
serviceSid: {
|
package/common/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "twilio-new-call",
|
|
7
7
|
name: "New Call (Instant)",
|
|
8
8
|
description: "Emit new event each time a call to the phone number is completed. Configures a webhook in Twilio, tied to a phone number.",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.5",
|
|
10
10
|
type: "source",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
key: "twilio-new-incoming-sms",
|
|
10
10
|
name: "New Incoming SMS (Instant)",
|
|
11
11
|
description: "Emit new event every time an SMS is sent to the phone number set. Configures a webhook in Twilio, tied to an incoming phone number.",
|
|
12
|
-
version: "0.1.
|
|
12
|
+
version: "0.1.5",
|
|
13
13
|
type: "source",
|
|
14
14
|
dedupe: "unique",
|
|
15
15
|
props: {
|
package/twilio.app.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import twilio from "twilio";
|
|
2
2
|
import {
|
|
3
|
+
formatTimeElapsed,
|
|
3
4
|
callToString,
|
|
4
5
|
messageToString,
|
|
5
6
|
recordingToString,
|
|
@@ -177,6 +178,22 @@ export default {
|
|
|
177
178
|
})) || [];
|
|
178
179
|
},
|
|
179
180
|
},
|
|
181
|
+
transcriptSids: {
|
|
182
|
+
type: "string[]",
|
|
183
|
+
label: "Transcript SIDs",
|
|
184
|
+
description: "The unique SID identifiers of the Transcripts to retrieve",
|
|
185
|
+
async options({ page }) {
|
|
186
|
+
const transcripts = await this.listTranscripts({
|
|
187
|
+
page,
|
|
188
|
+
});
|
|
189
|
+
return transcripts?.map(({
|
|
190
|
+
sid: value, dateCreated, duration,
|
|
191
|
+
}) => ({
|
|
192
|
+
value,
|
|
193
|
+
label: `${dateCreated} for ${formatTimeElapsed(duration)}`,
|
|
194
|
+
})) || [];
|
|
195
|
+
},
|
|
196
|
+
},
|
|
180
197
|
},
|
|
181
198
|
methods: {
|
|
182
199
|
validateRequest({
|
|
@@ -259,6 +276,10 @@ export default {
|
|
|
259
276
|
const client = this.getClient();
|
|
260
277
|
return client.intelligence.v2.transcripts(transcriptId).sentences.list(params);
|
|
261
278
|
},
|
|
279
|
+
getTranscript(transcriptId) {
|
|
280
|
+
const client = this.getClient();
|
|
281
|
+
return client.intelligence.v2.transcripts(transcriptId).fetch();
|
|
282
|
+
},
|
|
262
283
|
async getSentences(transcriptId) {
|
|
263
284
|
const sentences = await this.listTranscriptSentences(transcriptId, {
|
|
264
285
|
limit: 1000,
|
|
@@ -394,7 +415,6 @@ export default {
|
|
|
394
415
|
const client = this.getClient();
|
|
395
416
|
return client.recordings(sid).transcriptions.list(params);
|
|
396
417
|
},
|
|
397
|
-
|
|
398
418
|
/**
|
|
399
419
|
* Send a verification code via sms
|
|
400
420
|
*
|
|
@@ -409,7 +429,6 @@ export default {
|
|
|
409
429
|
channel: "sms",
|
|
410
430
|
});
|
|
411
431
|
},
|
|
412
|
-
|
|
413
432
|
/**
|
|
414
433
|
* List all services
|
|
415
434
|
*
|
|
@@ -419,7 +438,6 @@ export default {
|
|
|
419
438
|
const client = this.getClient();
|
|
420
439
|
return client.verify.v2.services.list();
|
|
421
440
|
},
|
|
422
|
-
|
|
423
441
|
/**
|
|
424
442
|
* Check whether the verification token is valid
|
|
425
443
|
*
|