@pipedream/octopush_sms 0.0.1 → 0.1.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,57 @@
|
|
|
1
|
+
import octopush from "../../octopush_sms.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "octopush_sms-add-contact",
|
|
5
|
+
name: "Add Contact",
|
|
6
|
+
description: "Adds a new contact to a list in the Octopush SMS Gateway. [See the documentation](https://dev.octopush.com/en/sms-gateway-api-documentation/add-a-contact/)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
octopush,
|
|
11
|
+
phone: {
|
|
12
|
+
type: "string",
|
|
13
|
+
label: "Phone Number",
|
|
14
|
+
description: "Phone number of the contact",
|
|
15
|
+
},
|
|
16
|
+
firstName: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "First Name",
|
|
19
|
+
description: "First name of the contact",
|
|
20
|
+
},
|
|
21
|
+
lastName: {
|
|
22
|
+
type: "string",
|
|
23
|
+
label: "Last Name",
|
|
24
|
+
description: "Last name of the contact",
|
|
25
|
+
},
|
|
26
|
+
listName: {
|
|
27
|
+
type: "string",
|
|
28
|
+
label: "List Name",
|
|
29
|
+
description: " Name of the list to which the contact should be added",
|
|
30
|
+
optional: true,
|
|
31
|
+
},
|
|
32
|
+
tag: {
|
|
33
|
+
type: "string",
|
|
34
|
+
label: "Tag Name",
|
|
35
|
+
description: "Name of the tag that will be attached to the contact",
|
|
36
|
+
optional: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
async run({ $ }) {
|
|
40
|
+
const response = await this.octopush.createContact({
|
|
41
|
+
$,
|
|
42
|
+
data: {
|
|
43
|
+
list_name: this.listName,
|
|
44
|
+
contacts: [
|
|
45
|
+
{
|
|
46
|
+
phone_number: this.phone,
|
|
47
|
+
first_name: this.firstName,
|
|
48
|
+
last_name: this.lastName,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
tag_name: this.tag,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
$.export("$summary", "Successfully created contact.");
|
|
55
|
+
return response;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import octopush from "../../octopush_sms.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "octopush_sms-send-new-sms",
|
|
5
|
+
name: "Send New SMS",
|
|
6
|
+
description: "Sends a new SMS using Octopush SMS. [See the documentation](https://dev.octopush.com/en/sms-gateway-api-documentation/send-sms/)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
octopush,
|
|
11
|
+
text: {
|
|
12
|
+
type: "string",
|
|
13
|
+
label: "Text",
|
|
14
|
+
description: "The message text (from 1 to 1224 characters).",
|
|
15
|
+
},
|
|
16
|
+
phone: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "Phone Number",
|
|
19
|
+
description: "Phone number of the recipient",
|
|
20
|
+
},
|
|
21
|
+
firstName: {
|
|
22
|
+
type: "string",
|
|
23
|
+
label: "First Name",
|
|
24
|
+
description: "First name of the recipient",
|
|
25
|
+
},
|
|
26
|
+
lastName: {
|
|
27
|
+
type: "string",
|
|
28
|
+
label: "Last Name",
|
|
29
|
+
description: "Last name of the recipient",
|
|
30
|
+
},
|
|
31
|
+
type: {
|
|
32
|
+
type: "string",
|
|
33
|
+
label: "Type",
|
|
34
|
+
description: "Campaign Type",
|
|
35
|
+
options: [
|
|
36
|
+
"sms_premium",
|
|
37
|
+
"sms_low_cost",
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
sender: {
|
|
41
|
+
type: "string",
|
|
42
|
+
label: "Sender",
|
|
43
|
+
description: "Sender of the message (if the user allows it), 3-11 alphanumeric characters (a-zA-Z0-9)",
|
|
44
|
+
optional: true,
|
|
45
|
+
},
|
|
46
|
+
sendAt: {
|
|
47
|
+
type: "string",
|
|
48
|
+
label: "Send At",
|
|
49
|
+
description: "When you want to send the sms campaign. Format: DateTime ISO8601 (for ex: “2018-10-03T07:42:39-07:00”)",
|
|
50
|
+
optional: true,
|
|
51
|
+
},
|
|
52
|
+
purpose: {
|
|
53
|
+
type: "string",
|
|
54
|
+
label: "Purpose",
|
|
55
|
+
description: "Campaign purpose",
|
|
56
|
+
options: [
|
|
57
|
+
"alert",
|
|
58
|
+
"wholesale",
|
|
59
|
+
],
|
|
60
|
+
optional: true,
|
|
61
|
+
},
|
|
62
|
+
withReplies: {
|
|
63
|
+
type: "boolean",
|
|
64
|
+
label: "With Replies",
|
|
65
|
+
description: "Set to `true` to get back recipient replies",
|
|
66
|
+
optional: true,
|
|
67
|
+
},
|
|
68
|
+
simulationMode: {
|
|
69
|
+
type: "boolean",
|
|
70
|
+
label: "Simulation Mode",
|
|
71
|
+
description: "If this value is `true`, your request will be simulated, and you will receive a fake result",
|
|
72
|
+
optional: true,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
async run({ $ }) {
|
|
76
|
+
const response = await this.octopush.sendSMS({
|
|
77
|
+
$,
|
|
78
|
+
data: {
|
|
79
|
+
text: this.text,
|
|
80
|
+
recipients: [
|
|
81
|
+
{
|
|
82
|
+
phone_number: this.phone,
|
|
83
|
+
first_name: this.firstName,
|
|
84
|
+
last_name: this.lastName,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
type: this.type,
|
|
88
|
+
send_at: this.sendAt,
|
|
89
|
+
purpose: this.purpose,
|
|
90
|
+
with_replies: this.withReplies,
|
|
91
|
+
simulation_mode: this.simulationMode,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
$.export("$summary", "Successfully send new SMS.");
|
|
95
|
+
return response;
|
|
96
|
+
},
|
|
97
|
+
};
|
package/octopush_sms.app.mjs
CHANGED
|
@@ -1,11 +1,44 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
4
|
type: "app",
|
|
3
5
|
app: "octopush_sms",
|
|
4
6
|
propDefinitions: {},
|
|
5
7
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
_baseUrl() {
|
|
9
|
+
return "https://api.octopush.com/v1/public";
|
|
10
|
+
},
|
|
11
|
+
_headers() {
|
|
12
|
+
return {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
"api-login": `${this.$auth.api_login}`,
|
|
15
|
+
"api-key": `${this.$auth.api_key}`,
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
_makeRequest({
|
|
19
|
+
$ = this,
|
|
20
|
+
path,
|
|
21
|
+
...opts
|
|
22
|
+
}) {
|
|
23
|
+
return axios($, {
|
|
24
|
+
url: `${this._baseUrl()}${path}`,
|
|
25
|
+
headers: this._headers(),
|
|
26
|
+
...opts,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
createContact(opts = {}) {
|
|
30
|
+
return this._makeRequest({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/contact/create",
|
|
33
|
+
...opts,
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
sendSMS(opts = {}) {
|
|
37
|
+
return this._makeRequest({
|
|
38
|
+
method: "POST",
|
|
39
|
+
path: "/sms-campaign/send",
|
|
40
|
+
...opts,
|
|
41
|
+
});
|
|
9
42
|
},
|
|
10
43
|
},
|
|
11
|
-
};
|
|
44
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/octopush_sms",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Pipedream Octopush SMS Components",
|
|
5
5
|
"main": "octopush_sms.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^1.6.0"
|
|
14
17
|
}
|
|
15
18
|
}
|