Skip to content

Commit 47c4872

Browse files
committed
init
1 parent 8b37319 commit 47c4872

File tree

5 files changed

+137
-16
lines changed

5 files changed

+137
-16
lines changed

components/slybroadcast/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
slybroadcast,
11+
audioFileId: {
12+
propDefinition: [
13+
slybroadcast,
14+
"audioFileId",
15+
],
16+
},
17+
recipients: {
18+
propDefinition: [
19+
slybroadcast,
20+
"recipients",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.slybroadcast.startCampaignWithFileId({
26+
audioFileId: this.audioFileId,
27+
recipients: this.recipients,
28+
});
29+
$.export("$summary", `Started campaign with audio file ID: ${this.audioFileId}`);
30+
return response;
31+
},
32+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
slybroadcast,
11+
recipients: {
12+
propDefinition: [
13+
slybroadcast,
14+
"recipients",
15+
],
16+
description: "List of recipients for the voicemail campaign",
17+
},
18+
audioFileUrl: {
19+
propDefinition: [
20+
slybroadcast,
21+
"audioFileUrl",
22+
],
23+
description: "The URL of the audio file for the voicemail campaign",
24+
},
25+
},
26+
async run({ $ }) {
27+
const response = await this.slybroadcast.startCampaignWithFileUrl({
28+
audioFileUrl: this.audioFileUrl,
29+
recipients: this.recipients,
30+
});
31+
$.export("$summary", "Campaign started successfully");
32+
return response;
33+
},
34+
};

components/slybroadcast/app/slybroadcast.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
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: "slybroadcast",
6+
propDefinitions: {
7+
audioFileId: {
8+
type: "string",
9+
label: "Audio File ID",
10+
description: "The ID of the audio file uploaded to your slybroadcast account",
11+
},
12+
recipients: {
13+
type: "string[]",
14+
label: "Recipients",
15+
description: "List of recipients for the voicemail campaign",
16+
},
17+
audioFileUrl: {
18+
type: "string",
19+
label: "Audio File URL",
20+
description: "The URL of the audio file for the voicemail campaign",
21+
},
22+
},
23+
methods: {
24+
_baseUrl() {
25+
return "https://www.mobile-sphere.com/gateway/vmb.php";
26+
},
27+
async _makeRequest(opts = {}) {
28+
const {
29+
$ = this, method = "POST", path, headers, ...otherOpts
30+
} = opts;
31+
return axios($, {
32+
...otherOpts,
33+
method,
34+
url: this._baseUrl() + path,
35+
headers: {
36+
...headers,
37+
"Content-Type": "application/x-www-form-urlencoded",
38+
},
39+
});
40+
},
41+
async startCampaignWithFileId({
42+
audioFileId, recipients,
43+
}) {
44+
return this._makeRequest({
45+
data: {
46+
c_uid: this.$auth.c_uid,
47+
c_password: this.$auth.c_password,
48+
c_callerID: this.$auth.c_callerID,
49+
c_phone: recipients.join(","),
50+
c_date: "now",
51+
c_record_audio: audioFileId,
52+
},
53+
});
54+
},
55+
async startCampaignWithFileUrl({
56+
audioFileUrl, recipients,
57+
}) {
58+
return this._makeRequest({
59+
data: {
60+
c_uid: this.$auth.c_uid,
61+
c_password: this.$auth.c_password,
62+
c_callerID: this.$auth.c_callerID,
63+
c_phone: recipients.join(","),
64+
c_date: "now",
65+
c_url: audioFileUrl,
66+
c_audio: audioFileUrl.split(".").pop(),
67+
},
68+
});
69+
},
70+
},
71+
};

0 commit comments

Comments
 (0)