@pipedream/twilio 0.4.0 → 0.5.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.
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import app from "../../twilio.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twilio-phone-number-lookup",
|
|
5
|
+
name: "Phone Number Lookup",
|
|
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
|
+
type: "action",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
props: {
|
|
10
|
+
app,
|
|
11
|
+
sid: {
|
|
12
|
+
type: "string",
|
|
13
|
+
label: "Phone Number",
|
|
14
|
+
description: "The phone number to lookup",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
lineTypeLookup(sid) {
|
|
19
|
+
const client = this.app.getClient();
|
|
20
|
+
return client.lookups.v2.phoneNumbers(sid).fetch({
|
|
21
|
+
fields: "line_type_intelligence",
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
async run({ $ }) {
|
|
26
|
+
const {
|
|
27
|
+
lineTypeLookup,
|
|
28
|
+
sid,
|
|
29
|
+
} = this;
|
|
30
|
+
|
|
31
|
+
const response = await lineTypeLookup(sid);
|
|
32
|
+
|
|
33
|
+
if (response.validationErrors?.length) {
|
|
34
|
+
$.export("$summary", `Failed to fetch phone number lookup: \`${JSON.stringify(response.validationErrors, null, 2)}\`.`);
|
|
35
|
+
} else {
|
|
36
|
+
$.export("$summary", `Successfully fetched phone number lookup of \`${sid}\``);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return response;
|
|
40
|
+
},
|
|
41
|
+
};
|