Skip to content

Commit 4e2f97b

Browse files
authored
NumVerify new action (#13142)
* Package update * pnpm * Validate Phone action * Numverify app and basic request method * Adding optional prop + adjustments * Newline added to json * Text adjustment * Emitting entire event for new/updated triggers * Reverting wrong commit * Reverting wrong commit
1 parent 0a089b1 commit 4e2f97b

File tree

4 files changed

+62
-7
lines changed

4 files changed

+62
-7
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import numverify from "../../numverify.app.mjs";
2+
3+
export default {
4+
key: "numverify-validate-phone",
5+
name: "Validate Phone",
6+
description: "Validates a phone number. [See the documentation](https://numverify.com/documentation)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
numverify,
11+
number: {
12+
type: "string",
13+
label: "Number",
14+
description: "It is most efficient to provide phone numbers in a strictly numeric format (e.g. `441179287870`), but NumVerify is also capable of processing numbers containing special characters (e.g. `+44 (0) 117 928 7870`).",
15+
},
16+
countryCode: {
17+
type: "string",
18+
label: "Country Code",
19+
description: "Specify only if working with national (local) phone numbers. 2-digit country code, such as `US`",
20+
optional: true,
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.numverify.validatePhone({
25+
$,
26+
params: {
27+
number: this.number,
28+
country_code: this.countryCode,
29+
},
30+
});
31+
$.export("$summary", `Successfully validated phone number ${this.number}`);
32+
return response;
33+
},
34+
};
Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "numverify",
4-
propDefinitions: {},
56
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
7+
async _makeRequest({
8+
$ = this, params, ...args
9+
}) {
10+
return axios($, {
11+
baseURL: "http://apilayer.net/api",
12+
params: {
13+
...params,
14+
access_key: `${this.$auth.api_key}`,
15+
},
16+
...args,
17+
});
18+
},
19+
async validatePhone(args) {
20+
return this._makeRequest({
21+
url: "/validate",
22+
...args,
23+
});
924
},
1025
},
1126
};

components/numverify/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/numverify",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream numverify Components",
55
"main": "numverify.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.0"
1417
}
15-
}
18+
}

pnpm-lock.yaml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)