Skip to content

Commit e26745a

Browse files
authored
SMS Messages - new components (#19153)
* new components * pnpm-lock.yaml
1 parent d5c63bc commit e26745a

File tree

6 files changed

+201
-8
lines changed

6 files changed

+201
-8
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import smsMessages from "../../sms_messages.app.mjs";
2+
3+
export default {
4+
key: "sms_messages-send-registered-sms-contract",
5+
name: "Send Registered SMS Contract",
6+
description: "Send a registered SMS contract using SMS Messages. [See the documentation](https://api.lleida.net/dtd/sms/v2/en/)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
smsMessages,
16+
message: {
17+
propDefinition: [
18+
smsMessages,
19+
"message",
20+
],
21+
},
22+
numbers: {
23+
propDefinition: [
24+
smsMessages,
25+
"numbers",
26+
],
27+
},
28+
email: {
29+
propDefinition: [
30+
smsMessages,
31+
"email",
32+
],
33+
},
34+
},
35+
async run({ $ }) {
36+
const response = await this.smsMessages.sendSMS({
37+
$,
38+
data: {
39+
sms: {
40+
user: this.smsMessages.getUser(),
41+
dst: {
42+
num: this.numbers,
43+
},
44+
txt: this.message,
45+
delivery_receipt: {
46+
cert_type: "T",
47+
email: this.email,
48+
},
49+
},
50+
},
51+
});
52+
$.export("$summary", "Successfully sent registered SMS contract");
53+
return response;
54+
},
55+
};
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import smsMessages from "../../sms_messages.app.mjs";
2+
3+
export default {
4+
key: "sms_messages-send-registered-sms",
5+
name: "Send Registered SMS",
6+
description: "Send a registered SMS message using SMS Messages. [See the documentation](https://api.lleida.net/dtd/sms/v2/en/)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
smsMessages,
16+
message: {
17+
propDefinition: [
18+
smsMessages,
19+
"message",
20+
],
21+
},
22+
numbers: {
23+
propDefinition: [
24+
smsMessages,
25+
"numbers",
26+
],
27+
},
28+
email: {
29+
propDefinition: [
30+
smsMessages,
31+
"email",
32+
],
33+
},
34+
},
35+
async run({ $ }) {
36+
const response = await this.smsMessages.sendSMS({
37+
$,
38+
data: {
39+
sms: {
40+
user: this.smsMessages.getUser(),
41+
dst: {
42+
num: this.numbers,
43+
},
44+
txt: this.message,
45+
delivery_receipt: {
46+
cert_type: "D",
47+
email: this.email,
48+
},
49+
},
50+
},
51+
});
52+
$.export("$summary", "Successfully sent registered SMS message");
53+
return response;
54+
},
55+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import smsMessages from "../../sms_messages.app.mjs";
2+
3+
export default {
4+
key: "sms_messages-send-sms",
5+
name: "Send SMS",
6+
description: "Send an SMS message using SMS Messages. [See the documentation](https://api.lleida.net/dtd/sms/v2/en/)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
smsMessages,
16+
message: {
17+
propDefinition: [
18+
smsMessages,
19+
"message",
20+
],
21+
},
22+
numbers: {
23+
propDefinition: [
24+
smsMessages,
25+
"numbers",
26+
],
27+
},
28+
},
29+
async run({ $ }) {
30+
const response = await this.smsMessages.sendSMS({
31+
$,
32+
data: {
33+
sms: {
34+
user: this.smsMessages.getUser(),
35+
dst: {
36+
num: this.numbers,
37+
},
38+
txt: this.message,
39+
},
40+
},
41+
});
42+
$.export("$summary", "Successfully sent SMS message");
43+
return response;
44+
},
45+
};

components/sms_messages/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/sms_messages",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream SMS Messages Components",
55
"main": "sms_messages.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.1.1"
1417
}
15-
}
18+
}
Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,42 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "sms_messages",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
message: {
8+
type: "string",
9+
label: "Message",
10+
description: "The message to send",
11+
},
12+
numbers: {
13+
type: "string[]",
14+
label: "Numbers",
15+
description: "An array of phone numbers to send the message to. Phone numbers should be entered in international format (i.e. + followed by country code)",
16+
},
17+
email: {
18+
type: "string",
19+
label: "Email",
20+
description: "The delivery receipt email. An email will be sent to the given address whenever the operator notifies any change in the state of the SMS.",
21+
},
22+
},
523
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
24+
getUser() {
25+
return this.$auth.username;
26+
},
27+
sendSMS({
28+
$ = this, data = {},
29+
}) {
30+
return axios($, {
31+
url: "https://api.lleida.net/sms/v2/",
32+
method: "POST",
33+
headers: {
34+
"Content-Type": "application/json; charset=utf-8",
35+
"Accept": "application/json",
36+
"Authorization": `x-api-key ${this.$auth.api_key}`,
37+
},
38+
data,
39+
});
940
},
1041
},
11-
};
42+
};

pnpm-lock.yaml

Lines changed: 5 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)