Skip to content

Commit a48cf80

Browse files
authored
New Components - seven (#13936)
* new components * pnpm-lock.yaml * fix key
1 parent fd6abb7 commit a48cf80

File tree

10 files changed

+290
-72
lines changed

10 files changed

+290
-72
lines changed

components/seven/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import seven from "../../seven.app.mjs";
2+
3+
export default {
4+
key: "seven-lookup-cnam",
5+
name: "Lookup CNAM",
6+
description: "Look up caller name information via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/lookup#cnam)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
seven,
11+
number: {
12+
propDefinition: [
13+
seven,
14+
"number",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.seven.lookupCnam({
20+
$,
21+
params: {
22+
number: this.number,
23+
},
24+
});
25+
if (response.success) {
26+
$.export("$summary", `Successfully looked up caller information for number: ${this.number}`);
27+
}
28+
return response;
29+
},
30+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import seven from "../../seven.app.mjs";
2+
3+
export default {
4+
key: "seven-lookup-format",
5+
name: "Lookup Format",
6+
description: "Look up phone number formatting via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/lookup#format)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
seven,
11+
number: {
12+
propDefinition: [
13+
seven,
14+
"number",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.seven.lookupFormat({
20+
$,
21+
params: {
22+
number: this.number,
23+
},
24+
});
25+
if (response.success) {
26+
$.export("$summary", `Successfully looked up phone number formatting for number: ${this.number}`);
27+
}
28+
return response;
29+
},
30+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import seven from "../../seven.app.mjs";
2+
3+
export default {
4+
key: "seven-lookup-hlr",
5+
name: "Lookup HLR",
6+
description: "Look up home location register information via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/lookup#hlr)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
seven,
11+
number: {
12+
propDefinition: [
13+
seven,
14+
"number",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.seven.lookupHlr({
20+
$,
21+
params: {
22+
number: this.number,
23+
},
24+
});
25+
if (response.success) {
26+
$.export("$summary", `Successfully looked up location register information for number: ${this.number}`);
27+
}
28+
return response;
29+
},
30+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import seven from "../../seven.app.mjs";
2+
3+
export default {
4+
key: "seven-make-tts-call",
5+
name: "Make TTS Call",
6+
description: "Make a text-to-speech call via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/voice#send-voice-call)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
seven,
11+
to: {
12+
propDefinition: [
13+
seven,
14+
"to",
15+
],
16+
},
17+
text: {
18+
type: "string",
19+
label: "Text",
20+
description: "Text message to be read out",
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.seven.sendTtsCall({
25+
$,
26+
data: {
27+
to: this.to,
28+
text: this.text,
29+
},
30+
});
31+
$.export("$summary", `Successfully sent TTS call to number: ${this.to}`);
32+
return response;
33+
},
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import seven from "../../seven.app.mjs";
2+
3+
export default {
4+
key: "seven-send-sms",
5+
name: "Send SMS",
6+
description: "Send SMS via Seven. [See the documentation](https://docs.seven.io/en/rest-api/endpoints/sms#send-sms)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
seven,
11+
to: {
12+
propDefinition: [
13+
seven,
14+
"to",
15+
],
16+
},
17+
text: {
18+
type: "string",
19+
label: "Text",
20+
description: "SMS message to send",
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.seven.sendSms({
25+
$,
26+
data: {
27+
to: this.to,
28+
text: this.text,
29+
},
30+
});
31+
$.export("$summary", `Successfully sent SMS message to number: ${this.to}`);
32+
return response;
33+
},
34+
};

components/seven/app/seven.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

components/seven/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
22
"name": "@pipedream/seven",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Seven Components",
5-
"main": "dist/app/seven.app.mjs",
5+
"main": "seven.app.mjs",
66
"keywords": [
77
"pipedream",
88
"seven"
99
],
10-
"files": ["dist"],
1110
"homepage": "https://pipedream.com/apps/seven",
1211
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1312
"publishConfig": {
1413
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.1"
1517
}
16-
}
18+
}

components/seven/seven.app.mjs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "seven",
6+
propDefinitions: {
7+
number: {
8+
type: "string",
9+
label: "Number",
10+
description: "The phone number to look up. (e.g. `49176123456789`)",
11+
},
12+
to: {
13+
type: "string",
14+
label: "To",
15+
description: "The destination phone number. Accepts all common formats like `0049171123456789`, `49171123456789`, `+49171123456789`",
16+
},
17+
},
18+
methods: {
19+
_baseUrl() {
20+
return "https://gateway.seven.io/api";
21+
},
22+
_headers() {
23+
return {
24+
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
25+
};
26+
},
27+
_makeRequest({
28+
$ = this,
29+
path,
30+
...args
31+
}) {
32+
return axios($, {
33+
url: `${this._baseUrl()}${path}`,
34+
headers: this._headers(),
35+
...args,
36+
});
37+
},
38+
lookupCnam(opts = {}) {
39+
return this._makeRequest({
40+
path: "/lookup/cnam",
41+
...opts,
42+
});
43+
},
44+
lookupFormat(opts = {}) {
45+
return this._makeRequest({
46+
path: "/lookup/format",
47+
...opts,
48+
});
49+
},
50+
lookupHlr(opts = {}) {
51+
return this._makeRequest({
52+
path: "/lookup/hlr",
53+
...opts,
54+
});
55+
},
56+
sendSms(opts = {}) {
57+
return this._makeRequest({
58+
method: "POST",
59+
path: "/sms",
60+
...opts,
61+
});
62+
},
63+
sendTtsCall(opts = {}) {
64+
return this._makeRequest({
65+
method: "POST",
66+
path: "/voice",
67+
...opts,
68+
});
69+
},
70+
},
71+
};

0 commit comments

Comments
 (0)