Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Check Verification Token",
description: "Check if user-provided token is correct. [See the documentation](https://www.twilio.com/docs/verify/api)",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
serviceSid: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Create Verification Service",
description: "Create a verification service for sending SMS verifications. [See the documentation](https://www.twilio.com/docs/verify/api/service#create-a-verification-service)",
type: "action",
version: "0.0.1",
version: "0.0.2",
props: {
twilio,
friendlyName: {
Expand Down
2 changes: 1 addition & 1 deletion components/twilio/actions/delete-call/delete-call.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "twilio-delete-call",
name: "Delete Call",
description: "Remove a call record from your account. [See the documentation](https://www.twilio.com/docs/voice/api/call-resource#delete-a-call-resource)",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
twilio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "twilio-delete-message",
name: "Delete Message",
description: "Delete a message record from your account. [See the documentation](https://www.twilio.com/docs/sms/api/message-resource#delete-a-message-resource)",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
twilio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "twilio-download-recording-media",
name: "Download Recording Media",
description: "Download a recording media file. [See the documentation](https://www.twilio.com/docs/voice/api/recording#fetch-a-recording-media-file)",
version: "0.1.5",
version: "0.1.6",
type: "action",
props: {
twilio,
Expand Down
55 changes: 53 additions & 2 deletions components/twilio/actions/get-call/get-call.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-get-call",
name: "Get Call",
description: "Return call resource of an individual call. [See the documentation](https://www.twilio.com/docs/voice/api/call-resource#fetch-a-call-resource)",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
twilio,
Expand All @@ -16,9 +16,60 @@ export default {
],
optional: false,
},
includeTranscripts: {
type: "boolean",
label: "Include Transcripts",
description: "Set to `true` to include recording transcript(s) if available",
optional: true,
},
},
methods: {
async getTranscripts(callSid) {
const transcripts = [];
const recordings = await this.twilio.listRecordings({
callSid,
});
for (const recording of recordings) {
const recordingTranscripts = await this.getRecordingTranscripts(recording.sid);
if (recordingTranscripts?.length) {
transcripts.push(...recordingTranscripts);
}
}
return transcripts;
},
async getRecordingTranscripts(sourceSid) {
const transcripts = await this.twilio.listTranscripts({
sourceSid,
});
const results = [];
for (const transcript of transcripts) {
const {
sentences, transcript: fullTranscript,
} = await this.twilio.getSentences(transcript.sid);
results.push({
...transcript,
_version: undefined,
sentences,
transcript: fullTranscript,
});
}
return results;
},
},
async run({ $ }) {
const resp = await this.twilio.getCall(this.sid);
let resp = await this.twilio.getCall(this.sid);

if (this.includeTranscripts) {
const transcripts = await this.getTranscripts(this.sid);
if (transcripts?.length) {
resp = {
...resp,
_version: undefined,
transcripts,
};
}
}

$.export("$summary", `Successfully fetched the call, "${callToString(resp)}"`);
return resp;
},
Expand Down
2 changes: 1 addition & 1 deletion components/twilio/actions/get-message/get-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-get-message",
name: "Get Message",
description: "Return details of a message. [See the documentation](https://www.twilio.com/docs/sms/api/message-resource#fetch-a-message-resource)",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
twilio,
Expand Down
40 changes: 40 additions & 0 deletions components/twilio/actions/get-transcripts/get-transcripts.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import twilio from "../../twilio.app.mjs";

export default {
key: "twilio-get-transcripts",
name: "Get Transcripts",
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)",
version: "0.0.1",
type: "action",
props: {
twilio,
transcriptSids: {
propDefinition: [
twilio,
"transcriptSids",
],
},
},
async run({ $ }) {
const transcripts = [];
for (const sid of this.transcriptSids) {
transcripts.push(await this.twilio.getTranscript(sid));
}
const results = [];
for (const transcript of transcripts) {
const {
sentences, transcript: fullTranscript,
} = await this.twilio.getSentences(transcript.sid);
results.push({
...transcript,
_version: undefined,
sentences,
transcript: fullTranscript,
});
}
$.export("$summary", `Successfully fetched ${results.length} transcript${results.length === 1
? ""
: "s"}`);
return results;
},
};
2 changes: 1 addition & 1 deletion components/twilio/actions/list-calls/list-calls.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-list-calls",
name: "List Calls",
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)",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
twilio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-list-message-media",
name: "List Message Media",
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)",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
twilio,
Expand Down
2 changes: 1 addition & 1 deletion components/twilio/actions/list-messages/list-messages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "twilio-list-messages",
name: "List Messages",
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)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
twilio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-list-transcripts",
name: "List Transcripts",
description: "Return a list of transcripts. [See the documentation](https://www.twilio.com/docs/voice/intelligence/api/transcript-resource#fetch-multiple-transcripts)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
twilio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "twilio-make-phone-call",
name: "Make a Phone Call",
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)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
twilio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Phone Number Lookup",
description: "Lookup information about a phone number. [See the documentation](https://www.twilio.com/docs/lookup/v2-api/line-type-intelligence) for more information",
type: "action",
version: "0.0.1",
version: "0.0.2",
props: {
app,
sid: {
Expand Down
2 changes: 1 addition & 1 deletion components/twilio/actions/send-message/send-message.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Send Message",
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)",
type: "action",
version: "0.0.1",
version: "0.0.2",
props: {
twilio,
from: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Send SMS Verification",
description: "Send an SMS verification to a phone number. [See the documentation](https://www.twilio.com/docs/verify/api)",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
serviceSid: {
Expand Down
1 change: 1 addition & 0 deletions components/twilio/common/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function recordingToString(recording) {
}

export {
formatTimeElapsed,
timeBetween,
omitEmptyStringValues,
callToString,
Expand Down
2 changes: 1 addition & 1 deletion components/twilio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/twilio",
"version": "0.5.0",
"version": "0.6.0",
"description": "Pipedream Twilio Components",
"main": "twilio.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/twilio/sources/new-call/new-call.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "twilio-new-call",
name: "New Call (Instant)",
description: "Emit new event each time a call to the phone number is completed. Configures a webhook in Twilio, tied to a phone number.",
version: "0.1.4",
version: "0.1.5",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "twilio-new-incoming-sms",
name: "New Incoming SMS (Instant)",
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.",
version: "0.1.4",
version: "0.1.5",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-new-phone-number",
name: "New Phone Number",
description: "Emit new event when you add a new phone number to your account",
version: "0.1.5",
version: "0.1.6",
type: "source",
dedupe: "unique",
methods: {
Expand Down
2 changes: 1 addition & 1 deletion components/twilio/sources/new-recording/new-recording.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-new-recording",
name: "New Recording",
description: "Emit new event when a new call recording is created",
version: "0.1.5",
version: "0.1.6",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "twilio-new-transcript-created",
name: "New Transcript Created",
description: "Emit new event when a new call transcript is created",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
props: {
Expand Down
24 changes: 21 additions & 3 deletions components/twilio/twilio.app.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import twilio from "twilio";
import {
formatTimeElapsed,
callToString,
messageToString,
recordingToString,
Expand Down Expand Up @@ -177,6 +178,22 @@ export default {
})) || [];
},
},
transcriptSids: {
type: "string[]",
label: "Transcript SIDs",
description: "The unique SID identifiers of the Transcripts to retrieve",
async options({ page }) {
const transcripts = await this.listTranscripts({
page,
});
return transcripts?.map(({
sid: value, dateCreated, duration,
}) => ({
value,
label: `${dateCreated} for ${formatTimeElapsed(duration)}`,
})) || [];
},
},
},
methods: {
validateRequest({
Expand Down Expand Up @@ -259,6 +276,10 @@ export default {
const client = this.getClient();
return client.intelligence.v2.transcripts(transcriptId).sentences.list(params);
},
getTranscript(transcriptId) {
const client = this.getClient();
return client.intelligence.v2.transcripts(transcriptId).fetch();
},
async getSentences(transcriptId) {
const sentences = await this.listTranscriptSentences(transcriptId, {
limit: 1000,
Expand Down Expand Up @@ -394,7 +415,6 @@ export default {
const client = this.getClient();
return client.recordings(sid).transcriptions.list(params);
},

/**
* Send a verification code via sms
*
Expand All @@ -409,7 +429,6 @@ export default {
channel: "sms",
});
},

/**
* List all services
*
Expand All @@ -419,7 +438,6 @@ export default {
const client = this.getClient();
return client.verify.v2.services.list();
},

/**
* Check whether the verification token is valid
*
Expand Down
Loading