Skip to content

Commit 3429bf6

Browse files
committed
smstools init
1 parent 78d91e2 commit 3429bf6

File tree

6 files changed

+552
-6
lines changed

6 files changed

+552
-6
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import smstools from "../../smstools.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "smstools-add-contact-opt-out",
6+
name: "Add Contact to Opt-Out List",
7+
description: "Adds a selected contact to the opt-out list, stopping further communications. [See the documentation](https://www.smstools.com/en/sms-gateway-api/add_optout)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
smstools,
12+
contact: {
13+
propDefinition: [
14+
smstools,
15+
"contact",
16+
],
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.smstools.addOptOut({
21+
contactid: this.contact,
22+
});
23+
24+
$.export("$summary", `Successfully added contact with ID ${this.contact} to the opt-out list.`);
25+
return response;
26+
},
27+
};
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import smstools from "../../smstools.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "smstools-add-contact",
6+
name: "Add Contact to Group",
7+
description: "Adds a new contact to an existing contact list. [See the documentation](https://www.smstools.com/en/sms-gateway-api/add_contact)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
smstools,
12+
phone: {
13+
propDefinition: [
14+
smstools,
15+
"phone",
16+
],
17+
},
18+
groupId: {
19+
propDefinition: [
20+
smstools,
21+
"groupId",
22+
],
23+
},
24+
firstName: {
25+
type: "string",
26+
label: "First Name",
27+
description: "First name of the contact.",
28+
optional: true,
29+
},
30+
lastName: {
31+
type: "string",
32+
label: "Last Name",
33+
description: "Last name of the contact.",
34+
optional: true,
35+
},
36+
birthday: {
37+
type: "string",
38+
label: "Birthday",
39+
description: "Birthday of the contact.",
40+
optional: true,
41+
},
42+
extra1: {
43+
type: "string",
44+
label: "Extra 1",
45+
description: "Extra field 1 for the contact.",
46+
optional: true,
47+
},
48+
extra2: {
49+
type: "string",
50+
label: "Extra 2",
51+
description: "Extra field 2 for the contact.",
52+
optional: true,
53+
},
54+
extra3: {
55+
type: "string",
56+
label: "Extra 3",
57+
description: "Extra field 3 for the contact.",
58+
optional: true,
59+
},
60+
extra4: {
61+
type: "string",
62+
label: "Extra 4",
63+
description: "Extra field 4 for the contact.",
64+
optional: true,
65+
},
66+
extra5: {
67+
type: "string",
68+
label: "Extra 5",
69+
description: "Extra field 5 for the contact.",
70+
optional: true,
71+
},
72+
extra6: {
73+
type: "string",
74+
label: "Extra 6",
75+
description: "Extra field 6 for the contact.",
76+
optional: true,
77+
},
78+
extra7: {
79+
type: "string",
80+
label: "Extra 7",
81+
description: "Extra field 7 for the contact.",
82+
optional: true,
83+
},
84+
extra8: {
85+
type: "string",
86+
label: "Extra 8",
87+
description: "Extra field 8 for the contact.",
88+
optional: true,
89+
},
90+
unsubscribed: {
91+
type: "boolean",
92+
label: "Unsubscribed",
93+
description: "Indicates if the contact is unsubscribed.",
94+
optional: true,
95+
},
96+
},
97+
async run({ $ }) {
98+
const response = await this.smstools.addContactToGroup({
99+
phone: this.phone,
100+
groupId: this.groupId,
101+
firstname: this.firstName,
102+
lastname: this.lastName,
103+
birthday: this.birthday,
104+
extra1: this.extra1,
105+
extra2: this.extra2,
106+
extra3: this.extra3,
107+
extra4: this.extra4,
108+
extra5: this.extra5,
109+
extra6: this.extra6,
110+
extra7: this.extra7,
111+
extra8: this.extra8,
112+
unsubscribed: this.unsubscribed,
113+
});
114+
115+
$.export("$summary", `Successfully added contact with phone number ${this.phone}`);
116+
return response;
117+
},
118+
};
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import smstools from "../../smstools.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "smstools-send-sms",
6+
name: "Send SMS or WhatsApp Message",
7+
description: "Sends a SMS or WhatsApp message to a specified contact. [See the documentation](https://www.smstools.com/en/sms-gateway-api/send_message)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
smstools,
12+
message: {
13+
type: "string",
14+
label: "Message",
15+
description: "The message to be sent.",
16+
},
17+
to: {
18+
propDefinition: [
19+
smstools,
20+
"to",
21+
],
22+
},
23+
sender: {
24+
propDefinition: [
25+
smstools,
26+
"sender",
27+
],
28+
},
29+
date: {
30+
propDefinition: [
31+
smstools,
32+
"date",
33+
],
34+
optional: true,
35+
},
36+
reference: {
37+
propDefinition: [
38+
smstools,
39+
"reference",
40+
],
41+
optional: true,
42+
},
43+
test: {
44+
propDefinition: [
45+
smstools,
46+
"test",
47+
],
48+
optional: true,
49+
},
50+
subId: {
51+
propDefinition: [
52+
smstools,
53+
"subId",
54+
],
55+
optional: true,
56+
},
57+
},
58+
async run({ $ }) {
59+
const response = await this.smstools.sendMessage({
60+
message: this.message,
61+
to: this.to,
62+
sender: this.sender,
63+
date: this.date,
64+
reference: this.reference,
65+
test: this.test,
66+
subId: this.subId,
67+
});
68+
$.export("$summary", `Message sent successfully with ID: ${response.messageid}`);
69+
return response;
70+
},
71+
};

components/smstools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"publishConfig": {
1313
"access": "public"
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)