@pipedream/twilio 0.3.9 → 0.3.11
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/download-recording-media/download-recording-media.mjs +2 -2
- package/actions/list-messages/list-messages.mjs +12 -3
- package/actions/make-phone-call/make-phone-call.mjs +8 -3
- package/actions/send-mms/send-mms.mjs +8 -3
- package/actions/send-sms/send-sms.mjs +8 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import twilio from "../../twilio.app.mjs";
|
|
2
|
-
import got from "got";
|
|
2
|
+
import got from "got@12.4.1";
|
|
3
3
|
import stream from "stream";
|
|
4
4
|
import { promisify } from "util";
|
|
5
5
|
import fs from "fs";
|
|
@@ -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.1.
|
|
11
|
+
version: "0.1.3",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
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 docs](https://www.twilio.com/docs/sms/api/message-resource#read-multiple-message-resources) for more information",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.3",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
twilio,
|
|
@@ -42,14 +42,23 @@ export default {
|
|
|
42
42
|
if (this.to) {
|
|
43
43
|
const toParsed = phone(this.to);
|
|
44
44
|
if (!toParsed || !toParsed.phoneNumber) {
|
|
45
|
-
throw new Error(`Phone number ${this.to}
|
|
45
|
+
throw new Error(`Phone number ${this.to} could not be parsed as a valid number.`);
|
|
46
46
|
}
|
|
47
47
|
to = toParsed.phoneNumber;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
let from = this.from;
|
|
51
|
+
if (this.from) {
|
|
52
|
+
const fromParsed = phone(this.from);
|
|
53
|
+
if (!fromParsed || !fromParsed.phoneNumber) {
|
|
54
|
+
throw new Error(`Phone number ${this.from} could not be parsed as a valid number.`);
|
|
55
|
+
}
|
|
56
|
+
from = fromParsed.phoneNumber;
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
const resp = await this.twilio.listMessages(omitEmptyStringValues({
|
|
51
60
|
to,
|
|
52
|
-
from
|
|
61
|
+
from,
|
|
53
62
|
limit: this.limit,
|
|
54
63
|
}));
|
|
55
64
|
/* eslint-disable multiline-ternary */
|
|
@@ -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 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.1.
|
|
9
|
+
version: "0.1.3",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
twilio,
|
|
@@ -36,12 +36,17 @@ export default {
|
|
|
36
36
|
const toParsed = phone(this.to);
|
|
37
37
|
console.log(toParsed);
|
|
38
38
|
if (!toParsed || !toParsed.phoneNumber) {
|
|
39
|
-
throw new Error(`Phone number ${this.to}
|
|
39
|
+
throw new Error(`Phone number ${this.to} could not be parsed as a valid number.`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const fromParsed = phone(this.from);
|
|
43
|
+
if (!fromParsed || !fromParsed.phoneNumber) {
|
|
44
|
+
throw new Error(`Phone number ${this.from} could not be parsed as a valid number.`);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
const data = {
|
|
43
48
|
to: toParsed.phoneNumber,
|
|
44
|
-
from:
|
|
49
|
+
from: fromParsed.phoneNumber,
|
|
45
50
|
twiml: `<Response><Say>${this.text}</Say></Response>`,
|
|
46
51
|
};
|
|
47
52
|
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
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.1.
|
|
10
|
+
version: "0.1.3",
|
|
11
11
|
props: {
|
|
12
12
|
twilio,
|
|
13
13
|
from: {
|
|
@@ -42,12 +42,17 @@ export default {
|
|
|
42
42
|
// See https://www.npmjs.com/package/phone
|
|
43
43
|
const toParsed = phone(this.to);
|
|
44
44
|
if (!toParsed || !toParsed.phoneNumber) {
|
|
45
|
-
throw new Error(`Phone number ${this.to}
|
|
45
|
+
throw new Error(`Phone number ${this.to} could not be parsed as a valid number.`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const fromParsed = phone(this.from);
|
|
49
|
+
if (!fromParsed || !fromParsed.phoneNumber) {
|
|
50
|
+
throw new Error(`Phone number ${this.from} could not be parsed as a valid number.`);
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
const data = {
|
|
49
54
|
to: toParsed.phoneNumber,
|
|
50
|
-
from:
|
|
55
|
+
from: fromParsed.phoneNumber,
|
|
51
56
|
body: this.body,
|
|
52
57
|
mediaUrl: this.mediaUrl,
|
|
53
58
|
};
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
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.1.
|
|
10
|
+
version: "0.1.3",
|
|
11
11
|
props: {
|
|
12
12
|
twilio,
|
|
13
13
|
from: {
|
|
@@ -36,12 +36,17 @@ export default {
|
|
|
36
36
|
// See https://www.npmjs.com/package/phone
|
|
37
37
|
const toParsed = phone(this.to);
|
|
38
38
|
if (!toParsed || !toParsed.phoneNumber) {
|
|
39
|
-
throw new Error(`Phone number ${this.to}
|
|
39
|
+
throw new Error(`Phone number ${this.to} could not be parsed as a valid number.`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const fromParsed = phone(this.from);
|
|
43
|
+
if (!fromParsed || !fromParsed.phoneNumber) {
|
|
44
|
+
throw new Error(`Phone number ${this.from} could not be parsed as a valid number.`);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
const data = {
|
|
43
48
|
to: toParsed.phoneNumber,
|
|
44
|
-
from:
|
|
49
|
+
from: fromParsed.phoneNumber,
|
|
45
50
|
body: this.body,
|
|
46
51
|
};
|
|
47
52
|
|