Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Components - slybroadcast #14661

Merged
merged 4 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions components/slybroadcast/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import slybroadcast from "../../slybroadcast.app.mjs";

export default {
key: "slybroadcast-start-campaign-audio-file",
name: "Start Campaign with Audio File",
description: "Start a new voicemail campaign using an audio file uploaded to your slybroadcast account. [See the documentation](https://www.slybroadcast.com/documentation.php)",
version: "0.0.1",
type: "action",
props: {
slybroadcast,
audioFile: {
propDefinition: [
slybroadcast,
"audioFile",
],
},
recipients: {
propDefinition: [
slybroadcast,
"recipients",
],
},
date: {
propDefinition: [
slybroadcast,
"date",
],
},
},
async run({ $ }) {
const response = await this.slybroadcast.startCampaign({
$,
data: {
c_record_audio: this.audioFile,
c_phone: this.recipients.join(),
c_date: this.date,
},
});
$.export("$summary", `Started campaign with audio file ID: ${this.audioFile}`);
return response;
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import slybroadcast from "../../slybroadcast.app.mjs";

export default {
key: "slybroadcast-start-campaign-audio-url",
name: "Start Campaign With Audio URL",
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)",
version: "0.0.1",
type: "action",
props: {
slybroadcast,
audioFileUrl: {
type: "string",
label: "Audio File URL",
description: "The URL of the audio file for the voicemail campaign",
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
audioFileType: {
type: "string",
label: "Audio File Type",
description: "WAV, Mp3 or M4a",
options: [
"WAV",
"Mp3",
"M4a",
],
},
recipients: {
propDefinition: [
slybroadcast,
"recipients",
],
},
date: {
propDefinition: [
slybroadcast,
"date",
],
},
},
async run({ $ }) {
const response = await this.slybroadcast.startCampaign({
$,
data: {
c_url: this.audioFileUrl,
c_audio: this.audioFileType,
c_phone: this.recipients.join(),
c_date: this.date,
},
});
$.export("$summary", "Campaign started successfully");
return response;
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
};
13 changes: 0 additions & 13 deletions components/slybroadcast/app/slybroadcast.app.ts

This file was deleted.

8 changes: 5 additions & 3 deletions components/slybroadcast/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "@pipedream/slybroadcast",
"version": "0.0.2",
"version": "0.1.0",
"description": "Pipedream Slybroadcast Components",
"main": "dist/app/slybroadcast.app.mjs",
"main": "slybroadcast.app.mjs",
"keywords": [
"pipedream",
"slybroadcast"
],
"files": ["dist"],
"homepage": "https://pipedream.com/apps/slybroadcast",
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
70 changes: 70 additions & 0 deletions components/slybroadcast/slybroadcast.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "slybroadcast",
propDefinitions: {
audioFile: {
type: "string",
label: "Audio File",
description: "The audio file uploaded to your slybroadcast account",
async options() {
const files = await this.listAudioFiles();
const filenames = [
...files.matchAll(/"\|"(.*?)"\|"/g),
].map((match) => match[1]);
return filenames;
},
},
recipients: {
type: "string[]",
label: "Recipients",
description: "Array of recipients' phone numbers for the voicemail campaign",
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
date: {
type: "string",
label: "Date",
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",
default: "now",
optional: true,
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
},
methods: {
_baseUrl() {
return "https://www.mobile-sphere.com/gateway/";
},
_makeRequest(opts = {}) {
const {
$ = this, method = "POST", path, data, ...otherOpts
} = opts;
return axios($, {
...otherOpts,
method,
url: `${this._baseUrl()}${path}`,
data: {
...data,
c_uid: `${this.$auth.email}`,
c_password: `${this.$auth.password}`,
},
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
listAudioFiles(opts = {}) {
return this._makeRequest({
path: "/vmb.aflist.php",
data: {
c_method: "get_audio_list",
},
...opts,
});
},
startCampaign(opts = {}) {
return this._makeRequest({
path: "/vmb.php",
...opts,
});
},
michelle0927 marked this conversation as resolved.
Show resolved Hide resolved
},
};
107 changes: 55 additions & 52 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading