@pipedream/twilio 0.3.9 → 0.3.10

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.
@@ -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.2",
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} couldn't be parsed as a valid number.`);
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: this.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.2",
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} couldn't be parsed as a valid number.`);
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: this.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.2",
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} couldn't be parsed as a valid number.`);
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: this.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.2",
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} couldn't be parsed as a valid number.`);
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: this.from,
49
+ from: fromParsed.phoneNumber,
45
50
  body: this.body,
46
51
  };
47
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/twilio",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "Pipedream Twilio Components",
5
5
  "main": "twilio.app.mjs",
6
6
  "keywords": [