Skip to content

Commit f846410

Browse files
authored
New Components - slybroadcast (#14661)
* init * new actions * pnpm-lock.yaml * remove console.log
1 parent b476225 commit f846410

File tree

7 files changed

+173
-20
lines changed

7 files changed

+173
-20
lines changed

components/slybroadcast/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import slybroadcast from "../../slybroadcast.app.mjs";
2+
3+
export default {
4+
key: "slybroadcast-start-campaign-audio-file",
5+
name: "Start Campaign with Audio File",
6+
description: "Start a new voicemail campaign using an audio file uploaded to your slybroadcast account. [See the documentation](https://www.slybroadcast.com/documentation.php)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
slybroadcast,
11+
audioFile: {
12+
propDefinition: [
13+
slybroadcast,
14+
"audioFile",
15+
],
16+
},
17+
recipients: {
18+
propDefinition: [
19+
slybroadcast,
20+
"recipients",
21+
],
22+
},
23+
date: {
24+
propDefinition: [
25+
slybroadcast,
26+
"date",
27+
],
28+
},
29+
},
30+
async run({ $ }) {
31+
const response = await this.slybroadcast.startCampaign({
32+
$,
33+
data: {
34+
c_record_audio: this.audioFile,
35+
c_phone: this.recipients.join(),
36+
c_date: this.date,
37+
},
38+
});
39+
$.export("$summary", `Started campaign with audio file ID: ${this.audioFile}`);
40+
return response;
41+
},
42+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import slybroadcast from "../../slybroadcast.app.mjs";
2+
3+
export default {
4+
key: "slybroadcast-start-campaign-audio-url",
5+
name: "Start Campaign With Audio URL",
6+
description: "Launch a new voicemail campaign to an individual or a group using an audio file url. [See the documentation](https://www.slybroadcast.com/documentation.php)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
slybroadcast,
11+
audioFileUrl: {
12+
type: "string",
13+
label: "Audio File URL",
14+
description: "The URL of the audio file for the voicemail campaign",
15+
},
16+
audioFileType: {
17+
type: "string",
18+
label: "Audio File Type",
19+
description: "WAV, Mp3 or M4a",
20+
options: [
21+
"WAV",
22+
"Mp3",
23+
"M4a",
24+
],
25+
},
26+
recipients: {
27+
propDefinition: [
28+
slybroadcast,
29+
"recipients",
30+
],
31+
},
32+
date: {
33+
propDefinition: [
34+
slybroadcast,
35+
"date",
36+
],
37+
},
38+
},
39+
async run({ $ }) {
40+
const response = await this.slybroadcast.startCampaign({
41+
$,
42+
data: {
43+
c_url: this.audioFileUrl,
44+
c_audio: this.audioFileType,
45+
c_phone: this.recipients.join(),
46+
c_date: this.date,
47+
},
48+
});
49+
$.export("$summary", "Campaign started successfully");
50+
return response;
51+
},
52+
};

components/slybroadcast/app/slybroadcast.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
22
"name": "@pipedream/slybroadcast",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "Pipedream Slybroadcast Components",
5-
"main": "dist/app/slybroadcast.app.mjs",
5+
"main": "slybroadcast.app.mjs",
66
"keywords": [
77
"pipedream",
88
"slybroadcast"
99
],
10-
"files": ["dist"],
1110
"homepage": "https://pipedream.com/apps/slybroadcast",
1211
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1312
"publishConfig": {
1413
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1517
}
1618
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "slybroadcast",
6+
propDefinitions: {
7+
audioFile: {
8+
type: "string",
9+
label: "Audio File",
10+
description: "The audio file uploaded to your slybroadcast account",
11+
async options() {
12+
const files = await this.listAudioFiles();
13+
const filenames = [
14+
...files.matchAll(/"\|"(.*?)"\|"/g),
15+
].map((match) => match[1]);
16+
return filenames;
17+
},
18+
},
19+
recipients: {
20+
type: "string[]",
21+
label: "Recipients",
22+
description: "Array of recipients' phone numbers for the voicemail campaign",
23+
},
24+
date: {
25+
type: "string",
26+
label: "Date",
27+
description: "Date/Time of delivery in Eastern Time. YYYY-MM-DD HH:MM:SS *Must use 24-hour time format. Example: 5:00pm = 17:00:00",
28+
default: "now",
29+
optional: true,
30+
},
31+
},
32+
methods: {
33+
_baseUrl() {
34+
return "https://www.mobile-sphere.com/gateway/";
35+
},
36+
_makeRequest(opts = {}) {
37+
const {
38+
$ = this, method = "POST", path, data, ...otherOpts
39+
} = opts;
40+
return axios($, {
41+
...otherOpts,
42+
method,
43+
url: `${this._baseUrl()}${path}`,
44+
data: {
45+
...data,
46+
c_uid: `${this.$auth.email}`,
47+
c_password: `${this.$auth.password}`,
48+
},
49+
headers: {
50+
"Content-Type": "application/x-www-form-urlencoded",
51+
},
52+
});
53+
},
54+
listAudioFiles(opts = {}) {
55+
return this._makeRequest({
56+
path: "/vmb.aflist.php",
57+
data: {
58+
c_method: "get_audio_list",
59+
},
60+
...opts,
61+
});
62+
},
63+
startCampaign(opts = {}) {
64+
return this._makeRequest({
65+
path: "/vmb.php",
66+
...opts,
67+
});
68+
},
69+
},
70+
};

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)