@pipedream/twilio 0.3.4 → 0.3.6

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/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # Overview
2
+
3
+ With the Twilio API, you can build telephone applications that make and receive
4
+ phone calls, as well astext messaging applications that send and receive text
5
+ messages.
6
+
7
+ Some examples of applications you could build include:
8
+
9
+ - A phone call application that allows you to make and receive phone calls over
10
+ the internet
11
+ - A text messaging application that allows you to send and receive text
12
+ messages over the internet
13
+ - A voicemail application that allows you to leave and receive voicemails over
14
+ the internet
@@ -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 docs](https://www.twilio.com/docs/voice/api/call-resource#delete-a-call-resource) for more information",
7
- version: "0.0.1",
7
+ version: "0.1.1",
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 docs](https://www.twilio.com/docs/sms/api/message-resource#delete-a-message-resource) for more information",
7
- version: "0.0.1",
7
+ version: "0.1.1",
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 docs](https://www.twilio.com/docs/voice/api/recording#fetch-a-recording-media-file) for more information",
11
- version: "0.0.1",
11
+ version: "0.1.1",
12
12
  type: "action",
13
13
  props: {
14
14
  twilio,
@@ -1,10 +1,11 @@
1
1
  import twilio from "../../twilio.app.mjs";
2
+ import { callToString } from "../../common/utils.mjs";
2
3
 
3
4
  export default {
4
5
  key: "twilio-get-call",
5
6
  name: "Get Call",
6
7
  description: "Return call resource of an individual call. [See the docs](https://www.twilio.com/docs/voice/api/call-resource#fetch-a-call-resource) for more information",
7
- version: "0.0.1",
8
+ version: "0.1.1",
8
9
  type: "action",
9
10
  props: {
10
11
  twilio,
@@ -17,7 +18,7 @@ export default {
17
18
  },
18
19
  async run({ $ }) {
19
20
  const resp = await this.twilio.getCall(this.sid);
20
- $.export("$summary", `Successfully fetched the call, "${this.twilio.callToString(resp)}"`);
21
+ $.export("$summary", `Successfully fetched the call, "${callToString(resp)}"`);
21
22
  return resp;
22
23
  },
23
24
  };
@@ -1,10 +1,11 @@
1
1
  import twilio from "../../twilio.app.mjs";
2
+ import { messageToString } from "../../common/utils.mjs";
2
3
 
3
4
  export default {
4
5
  key: "twilio-get-message",
5
6
  name: "Get Message",
6
7
  description: "Return details of a message. [See the docs](https://www.twilio.com/docs/sms/api/message-resource#fetch-a-message-resource) for more information",
7
- version: "0.0.1",
8
+ version: "0.1.1",
8
9
  type: "action",
9
10
  props: {
10
11
  twilio,
@@ -17,7 +18,7 @@ export default {
17
18
  },
18
19
  async run({ $ }) {
19
20
  const resp = await this.twilio.getMessage(this.messageId);
20
- $.export("$summary", `Successfully fetched the message, "${this.twilio.messageToString(resp)}"`);
21
+ $.export("$summary", `Successfully fetched the message, "${messageToString(resp)}"`);
21
22
  return resp;
22
23
  },
23
24
  };
@@ -1,11 +1,11 @@
1
1
  import twilio from "../../twilio.app.mjs";
2
- import { omitEmptyStringValues } from "../../utils.mjs";
2
+ import { omitEmptyStringValues } from "../../common/utils.mjs";
3
3
 
4
4
  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 docs](https://www.twilio.com/docs/voice/api/call-resource#read-multiple-call-resources) for more information",
8
- version: "0.0.1",
8
+ version: "0.1.1",
9
9
  type: "action",
10
10
  props: {
11
11
  twilio,
@@ -1,11 +1,11 @@
1
1
  import twilio from "../../twilio.app.mjs";
2
- import { omitEmptyStringValues } from "../../utils.mjs";
2
+ import { omitEmptyStringValues } from "../../common/utils.mjs";
3
3
 
4
4
  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 docs](https://www.twilio.com/docs/sms/api/media-resource#read-multiple-media-resources) for more information",
8
- version: "0.0.1",
8
+ version: "0.1.1",
9
9
  type: "action",
10
10
  props: {
11
11
  twilio,
@@ -1,12 +1,12 @@
1
- import twilio from "../../twilio.app.mjs";
2
1
  import { phone } from "phone";
3
- import { omitEmptyStringValues } from "../../utils.mjs";
2
+ import twilio from "../../twilio.app.mjs";
3
+ import { omitEmptyStringValues } from "../../common/utils.mjs";
4
4
 
5
5
  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 docs](https://www.twilio.com/docs/sms/api/message-resource#read-multiple-message-resources) for more information",
9
- version: "0.0.1",
9
+ version: "0.1.1",
10
10
  type: "action",
11
11
  props: {
12
12
  twilio,
@@ -1,11 +1,11 @@
1
1
  import twilio from "../../twilio.app.mjs";
2
- import { omitEmptyStringValues } from "../../utils.mjs";
2
+ import { omitEmptyStringValues } from "../../common/utils.mjs";
3
3
 
4
4
  export default {
5
5
  key: "twilio-list-recording-transcriptions",
6
6
  name: "List Recording Transcriptions",
7
7
  description: "Return a set of transcriptions available for a recording. [See the docs](https://www.twilio.com/docs/voice/api/recording#fetch-a-recordings-transcriptions) for more information",
8
- version: "0.0.1",
8
+ version: "0.1.1",
9
9
  type: "action",
10
10
  props: {
11
11
  twilio,
@@ -1,12 +1,12 @@
1
- // Read the Twilio docs at https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource
2
- import twilio from "../../twilio.app.mjs";
3
1
  import { phone } from "phone";
2
+ import twilio from "../../twilio.app.mjs";
3
+ import { callToString } from "../../common/utils.mjs";
4
4
 
5
5
  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 that Twilio will speak to the recipient of the call. [See the docs](https://www.twilio.com/docs/voice/api/call-resource#create-a-call-resource) for more information",
9
- version: "0.0.7",
9
+ version: "0.1.1",
10
10
  type: "action",
11
11
  props: {
12
12
  twilio,
@@ -46,7 +46,7 @@ export default {
46
46
  };
47
47
 
48
48
  const resp = await this.twilio.getClient().calls.create(data);
49
- $.export("$summary", `Successfully made a new phone call, "${this.twilio.callToString(resp)}"`);
49
+ $.export("$summary", `Successfully made a new phone call, "${callToString(resp)}"`);
50
50
  return resp;
51
51
  },
52
52
  };
@@ -1,13 +1,13 @@
1
- // Read the Twilio docs at https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource
2
- import twilio from "../../twilio.app.mjs";
3
1
  import { phone } from "phone";
2
+ import twilio from "../../twilio.app.mjs";
3
+ import { messageToString } from "../../common/utils.mjs";
4
4
 
5
5
  export default {
6
6
  key: "twilio-send-mms",
7
7
  name: "Send MMS",
8
8
  description: "Send an SMS with text and media files. [See the docs](https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource) for more information",
9
9
  type: "action",
10
- version: "0.0.6",
10
+ version: "0.1.1",
11
11
  props: {
12
12
  twilio,
13
13
  from: {
@@ -53,7 +53,7 @@ export default {
53
53
  };
54
54
 
55
55
  const resp = await this.twilio.getClient().messages.create(data);
56
- $.export("$summary", `Successfully sent a new MMS, "${this.twilio.messageToString(resp)}"`);
56
+ $.export("$summary", `Successfully sent a new MMS, "${messageToString(resp)}"`);
57
57
  return resp;
58
58
  },
59
59
  };
@@ -1,13 +1,13 @@
1
- // Read the Twilio docs at https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource
2
- import twilio from "../../twilio.app.mjs";
3
1
  import { phone } from "phone";
2
+ import twilio from "../../twilio.app.mjs";
3
+ import { messageToString } from "../../common/utils.mjs";
4
4
 
5
5
  export default {
6
6
  key: "twilio-send-sms",
7
7
  name: "Send SMS",
8
8
  description: "Send a simple text-only SMS. [See the docs](https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource) for more information",
9
9
  type: "action",
10
- version: "0.0.6",
10
+ version: "0.1.1",
11
11
  props: {
12
12
  twilio,
13
13
  from: {
@@ -46,7 +46,7 @@ export default {
46
46
  };
47
47
 
48
48
  const resp = await this.twilio.getClient().messages.create(data);
49
- $.export("$summary", `Successfully sent a new SMS, "${this.twilio.messageToString(resp)}"`);
49
+ $.export("$summary", `Successfully sent a new SMS, "${messageToString(resp)}"`);
50
50
  return resp;
51
51
  },
52
52
  };
@@ -0,0 +1,13 @@
1
+ const HTTP_METHOD = {
2
+ POST: "POST",
3
+ };
4
+
5
+ const SERVICE_TYPE = {
6
+ SMS: "sms",
7
+ VOICE: "voice",
8
+ };
9
+
10
+ export default {
11
+ HTTP_METHOD,
12
+ SERVICE_TYPE,
13
+ };
@@ -136,11 +136,8 @@ function recordingToString(recording) {
136
136
  }
137
137
 
138
138
  export {
139
- formatTimeElapsed,
140
139
  timeBetween,
141
140
  omitEmptyStringValues,
142
- valueOrEmptyString,
143
- formatDateString,
144
141
  callToString,
145
142
  messageToString,
146
143
  recordingToString,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/twilio",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Pipedream Twilio Components",
5
5
  "main": "twilio.app.mjs",
6
6
  "keywords": [
@@ -11,6 +11,7 @@
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "license": "MIT",
13
13
  "dependencies": {
14
+ "phone": "^3.1.29",
14
15
  "twilio": "^3.54.2"
15
16
  },
16
17
  "gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
@@ -1,5 +1,4 @@
1
1
  import twilio from "../twilio.app.mjs";
2
- import twilioClient from "twilio";
3
2
 
4
3
  export default {
5
4
  props: {
@@ -25,43 +24,33 @@ export default {
25
24
  },
26
25
  hooks: {
27
26
  async activate() {
28
- const createWebhookResp = await this.setWebhook(
29
- this.incomingPhoneNumber,
30
- this.http.endpoint,
31
- );
27
+ const createWebhookResp = await this.twilio.setWebhookURL({
28
+ serviceType: this.getServiceType(),
29
+ phoneNumberSid: this.incomingPhoneNumber,
30
+ url: this.http.endpoint,
31
+ });
32
32
  console.log(createWebhookResp);
33
33
  },
34
34
  async deactivate() {
35
- const deleteWebhookResp = await this.setWebhook(
36
- this.incomingPhoneNumber,
37
- "", // remove the webhook URL
38
- );
35
+ // remove the webhook URL if url prop is not set
36
+ const deleteWebhookResp = await this.twilio.setWebhookURL({
37
+ serviceType: this.getServiceType(),
38
+ phoneNumberSid: this.incomingPhoneNumber,
39
+ url: "",
40
+ });
39
41
  console.log(deleteWebhookResp);
40
42
  },
41
43
  },
42
44
  methods: {
45
+ getServiceType() {
46
+ throw new Error("getServiceType() is not implemented!");
47
+ },
43
48
  getResponseBody() {
44
49
  return null;
45
50
  },
46
51
  isRelevant() {
47
52
  return true;
48
53
  },
49
- validateRequest(body, headers) {
50
- const twilioSignature = headers["x-twilio-signature"];
51
- if (!twilioSignature) {
52
- console.log("No x-twilio-signature header in request. Exiting.");
53
- return false;
54
- }
55
-
56
- /** See https://www.twilio.com/docs/usage/webhooks/webhooks-security */
57
- return twilioClient.validateRequest(
58
- this.authToken,
59
- twilioSignature,
60
- /** This must match the incoming URL exactly, which contains a / */
61
- `${this.http.endpoint}/`,
62
- body,
63
- );
64
- },
65
54
  emitEvent(body, headers) {
66
55
  const meta = this.generateMeta(body, headers);
67
56
  this.$emit(body, meta);
@@ -84,15 +73,30 @@ export default {
84
73
  });
85
74
  }
86
75
 
87
- if (typeof body !== "object")
76
+ if (typeof body !== "object") {
88
77
  body = Object.fromEntries(new URLSearchParams(body));
78
+ }
89
79
 
90
80
  if (!this.isRelevant(body)) {
91
81
  console.log("Event not relevant. Skipping...");
92
82
  return;
93
83
  }
94
84
 
95
- if (!this.validateRequest(body, headers)) {
85
+ const signature = headers["x-twilio-signature"];
86
+ if (!signature) {
87
+ console.log("No x-twilio-signature header in request. Exiting.");
88
+ return;
89
+ }
90
+
91
+ // The url must match the incoming URL exactly, which contains a `/` at the end
92
+ const isRequestValid = this.twilio.validateRequest({
93
+ signature,
94
+ url: `${this.http.endpoint}/`,
95
+ params: body,
96
+ authToken: this.authToken,
97
+ });
98
+
99
+ if (!isRequestValid) {
96
100
  console.log("Event could not be validated. Skipping...");
97
101
  return;
98
102
  }
@@ -1,18 +1,18 @@
1
1
  import common from "../common-webhook.mjs";
2
+ import constants from "../../common/constants.mjs";
2
3
 
3
4
  export default {
4
5
  ...common,
5
6
  key: "twilio-new-call",
6
7
  name: "New Call (Instant)",
7
- description:
8
- "Configures a webhook in Twilio, tied to a phone number, and emits an event each time a call to that number is completed",
9
- version: "0.0.3",
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.1",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  methods: {
13
13
  ...common.methods,
14
- async setWebhook(...args) {
15
- return await this.twilio.setIncomingCallWebhookURL(...args);
14
+ getServiceType() {
15
+ return constants.SERVICE_TYPE.VOICE;
16
16
  },
17
17
  generateMeta(body, headers) {
18
18
  return {
@@ -1,14 +1,15 @@
1
- import common from "../common-webhook.mjs";
2
1
  import twilio from "twilio";
2
+ import common from "../common-webhook.mjs";
3
+ import constants from "../../common/constants.mjs";
4
+
3
5
  const MessagingResponse = twilio.twiml.MessagingResponse;
4
6
 
5
7
  export default {
6
8
  ...common,
7
9
  key: "twilio-new-incoming-sms",
8
10
  name: "New Incoming SMS (Instant)",
9
- description:
10
- "Configures a webhook in Twilio, tied to an incoming phone number, and emits an event each time an SMS is sent to that number",
11
- version: "0.0.7",
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.1",
12
13
  type: "source",
13
14
  dedupe: "unique",
14
15
  props: {
@@ -22,8 +23,8 @@ export default {
22
23
  },
23
24
  methods: {
24
25
  ...common.methods,
25
- async setWebhook(...args) {
26
- return await this.twilio.setIncomingSMSWebhookURL(...args);
26
+ getServiceType() {
27
+ return constants.SERVICE_TYPE.SMS;
27
28
  },
28
29
  getResponseBody() {
29
30
  const twiml = new MessagingResponse();
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "twilio-new-phone-number",
6
6
  name: "New Phone Number",
7
- description: "Emits an event when you add a new phone number to your account",
8
- version: "0.0.3",
7
+ description: "Emit new event when you add a new phone number to your account",
8
+ version: "0.1.1",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -2,10 +2,10 @@ import common from "../common-polling.mjs";
2
2
 
3
3
  export default {
4
4
  ...common,
5
- key: "twilio-new-phone-recording",
5
+ key: "twilio-new-recording",
6
6
  name: "New Recording",
7
- description: "Emits an event when a new call recording is created",
8
- version: "0.0.3",
7
+ description: "Emit new event when a new call recording is created",
8
+ version: "0.1.1",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "twilio-new-transcription",
6
6
  name: "New Transcription",
7
- description: "Emits an event when a new call transcription is created",
8
- version: "0.0.3",
7
+ description: "Emit new event when a new call transcription is created",
8
+ version: "0.1.1",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
package/twilio.app.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import twilioClient from "twilio";
1
+ import twilio from "twilio";
2
2
  import {
3
3
  callToString,
4
4
  messageToString,
5
5
  recordingToString,
6
- } from "./utils.mjs";
6
+ } from "./common/utils.mjs";
7
+ import constants from "./common/constants.mjs";
7
8
 
8
9
  export default {
9
10
  type: "app",
@@ -84,7 +85,7 @@ export default {
84
85
  const messages = await this.listMessages();
85
86
  return messages.map((message) => {
86
87
  return {
87
- label: this.messageToString(message),
88
+ label: messageToString(message),
88
89
  value: message.sid,
89
90
  };
90
91
  });
@@ -116,7 +117,7 @@ export default {
116
117
  const recordings = await this.listRecordings();
117
118
  return recordings.map((recording) => {
118
119
  return {
119
- label: this.recordingToString(recording),
120
+ label: recordingToString(recording),
120
121
  value: recording.sid,
121
122
  };});
122
123
  },
@@ -155,33 +156,38 @@ export default {
155
156
  },
156
157
  },
157
158
  methods: {
158
- // Static methods
159
- callToString,
160
- messageToString,
161
- recordingToString,
162
-
159
+ validateRequest({
160
+ signature, url, params, authToken = this.$auth.authToken,
161
+ } = {}) {
162
+ // See https://www.twilio.com/docs/usage/webhooks/webhooks-security
163
+ return twilio.validateRequest(
164
+ authToken,
165
+ signature,
166
+ url,
167
+ params,
168
+ );
169
+ },
163
170
  getClient() {
164
- return twilioClient(this.$auth.Sid, this.$auth.Secret, {
171
+ // Uncomment this line when users are ready to migrate
172
+ // return twilio(this.$auth.accountSid, this.$auth.authToken);
173
+ return twilio(this.$auth.Sid, this.$auth.Secret, {
165
174
  accountSid: this.$auth.AccountSid,
166
175
  });
167
176
  },
168
- async setWebhookURL(phoneNumberSid, params) {
177
+ setWebhookURL({
178
+ serviceType = constants.SERVICE_TYPE.SMS, phoneNumberSid, url,
179
+ } = {}) {
180
+ const opts = serviceType === constants.SERVICE_TYPE.SMS
181
+ ? {
182
+ smsMethod: constants.HTTP_METHOD.POST,
183
+ smsUrl: url,
184
+ }
185
+ : {
186
+ statusCallbackMethod: constants.HTTP_METHOD.POST,
187
+ statusCallback: url,
188
+ };
169
189
  const client = this.getClient();
170
- return await client.incomingPhoneNumbers(phoneNumberSid).update(params);
171
- },
172
- async setIncomingSMSWebhookURL(phoneNumberSid, url) {
173
- const params = {
174
- smsMethod: "POST",
175
- smsUrl: url,
176
- };
177
- return await this.setWebhookURL(phoneNumberSid, params);
178
- },
179
- async setIncomingCallWebhookURL(phoneNumberSid, url) {
180
- const params = {
181
- statusCallbackMethod: "POST",
182
- statusCallback: url,
183
- };
184
- return await this.setWebhookURL(phoneNumberSid, params);
190
+ return client.incomingPhoneNumbers(phoneNumberSid).update(opts);
185
191
  },
186
192
  /**
187
193
  * Returns a IncomingPhoneNumber list resource representing an account's
@@ -192,9 +198,9 @@ export default {
192
198
  *
193
199
  * @returns the IncomingPhoneNumber list
194
200
  */
195
- async listIncomingPhoneNumbers(params) {
201
+ listIncomingPhoneNumbers(params) {
196
202
  const client = this.getClient();
197
- return await client.incomingPhoneNumbers.list(params);
203
+ return client.incomingPhoneNumbers.list(params);
198
204
  },
199
205
  /**
200
206
  * Returns a list of Recordings, each representing a recording generated
@@ -205,9 +211,9 @@ export default {
205
211
  *
206
212
  * @returns the list of recordings
207
213
  */
208
- async listRecordings(params) {
214
+ listRecordings(params) {
209
215
  const client = this.getClient();
210
- return await client.recordings.list(params);
216
+ return client.recordings.list(params);
211
217
  },
212
218
  /**
213
219
  * Returns a list of Transcriptions generated from all recordings in an
@@ -218,9 +224,9 @@ export default {
218
224
  *
219
225
  * @returns the list of transcriptions
220
226
  */
221
- async listTranscriptions(params) {
227
+ listTranscriptions(params) {
222
228
  const client = this.getClient();
223
- return await client.transcriptions.list(params);
229
+ return client.transcriptions.list(params);
224
230
  },
225
231
  /**
226
232
  * Returns a list of messages associated with your account. When getting the
@@ -232,9 +238,9 @@ export default {
232
238
  *
233
239
  * @returns the list of messages
234
240
  */
235
- async listMessages(params) {
241
+ listMessages(params) {
236
242
  const client = this.getClient();
237
- return await client.messages.list(params);
243
+ return client.messages.list(params);
238
244
  },
239
245
  /**
240
246
  * Returns a single message specified by the provided Message `sid`
@@ -244,9 +250,9 @@ export default {
244
250
  *
245
251
  * @returns the message
246
252
  */
247
- async getMessage(sid) {
253
+ getMessage(sid) {
248
254
  const client = this.getClient();
249
- return await client.messages(sid).fetch();
255
+ return client.messages(sid).fetch();
250
256
  },
251
257
  /**
252
258
  * Deletes a message record from your account. Once the record is deleted,
@@ -256,9 +262,9 @@ export default {
256
262
  * the Message resource to delete
257
263
  * @returns `true` on success
258
264
  */
259
- async deleteMessage(sid) {
265
+ deleteMessage(sid) {
260
266
  const client = this.getClient();
261
- return await client.messages(sid).remove();
267
+ return client.messages(sid).remove();
262
268
  },
263
269
  /**
264
270
  * Returns a list of media associated with your message
@@ -268,9 +274,9 @@ export default {
268
274
  * @param {Object} [params] - an object containing parameters to be fed to the
269
275
  * Twilio API call, as defined in [the API docs](https://bit.ly/3mc8apg)
270
276
  */
271
- async listMessageMedia(messageId, params) {
277
+ listMessageMedia(messageId, params) {
272
278
  const client = this.getClient();
273
- return await client.messages(messageId).media.list(params);
279
+ return client.messages(messageId).media.list(params);
274
280
  },
275
281
  /**
276
282
  * Return a list of phone calls made to and from an account
@@ -279,15 +285,15 @@ export default {
279
285
  * Twilio API call, as defined in [the API docs](https://bit.ly/3iiHIJ9)
280
286
  * @returns the list of calls
281
287
  */
282
- async listCalls(params) {
288
+ listCalls(params) {
283
289
  const client = this.getClient();
284
- return await client.calls.list(params);
290
+ return client.calls.list(params);
285
291
  },
286
292
  async listCallsOptions(params = {}) {
287
293
  const calls = await this.listCalls(params);
288
294
  return calls.map((call) => {
289
295
  return {
290
- label: this.callToString(call),
296
+ label: callToString(call),
291
297
  value: call.sid,
292
298
  };
293
299
  });
@@ -298,9 +304,9 @@ export default {
298
304
  * @param {String} sid - The SID of the Call resource to fetch
299
305
  * @returns the Call
300
306
  */
301
- async getCall(sid) {
307
+ getCall(sid) {
302
308
  const client = this.getClient();
303
- return await client.calls(sid).fetch();
309
+ return client.calls(sid).fetch();
304
310
  },
305
311
  /**
306
312
  * This will delete a call record from the account. Once the record is
@@ -310,9 +316,9 @@ export default {
310
316
  * the Call resource to delete
311
317
  * @returns `true` on success
312
318
  */
313
- async deleteCall(sid) {
319
+ deleteCall(sid) {
314
320
  const client = this.getClient();
315
- return await client.calls(sid).remove();
321
+ return client.calls(sid).remove();
316
322
  },
317
323
  /**
318
324
  * Returns a recording specified by the provided Recording `sid`
@@ -322,9 +328,9 @@ export default {
322
328
  *
323
329
  * @returns the recording
324
330
  */
325
- async getRecording(sid) {
331
+ getRecording(sid) {
326
332
  const client = this.getClient();
327
- return await client.recordings(sid).fetch();
333
+ return client.recordings(sid).fetch();
328
334
  },
329
335
  /**
330
336
  * Returns a list of transcriptions available for the recording identified
@@ -335,9 +341,9 @@ export default {
335
341
  *
336
342
  * @returns the list of transcriptions
337
343
  */
338
- async listRecordingTranscriptions(sid, params) {
344
+ listRecordingTranscriptions(sid, params) {
339
345
  const client = this.getClient();
340
- return await client.recordings(sid).transcriptions.list(params);
346
+ return client.recordings(sid).transcriptions.list(params);
341
347
  },
342
348
  },
343
349
  };