diff --git a/components/slybroadcast/.gitignore b/components/slybroadcast/.gitignore deleted file mode 100644 index ec761ccab7595..0000000000000 --- a/components/slybroadcast/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.js -*.mjs -dist \ No newline at end of file diff --git a/components/slybroadcast/actions/start-campaign-audio-file/start-campaign-audio-file.mjs b/components/slybroadcast/actions/start-campaign-audio-file/start-campaign-audio-file.mjs new file mode 100644 index 0000000000000..54173d404b6ee --- /dev/null +++ b/components/slybroadcast/actions/start-campaign-audio-file/start-campaign-audio-file.mjs @@ -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; + }, +}; diff --git a/components/slybroadcast/actions/start-campaign-audio-url/start-campaign-audio-url.mjs b/components/slybroadcast/actions/start-campaign-audio-url/start-campaign-audio-url.mjs new file mode 100644 index 0000000000000..c7b9aec53d4ff --- /dev/null +++ b/components/slybroadcast/actions/start-campaign-audio-url/start-campaign-audio-url.mjs @@ -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", + }, + 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; + }, +}; diff --git a/components/slybroadcast/app/slybroadcast.app.ts b/components/slybroadcast/app/slybroadcast.app.ts deleted file mode 100644 index ecb4a51753113..0000000000000 --- a/components/slybroadcast/app/slybroadcast.app.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineApp } from "@pipedream/types"; - -export default defineApp({ - type: "app", - app: "slybroadcast", - propDefinitions: {}, - methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); - }, - }, -}); \ No newline at end of file diff --git a/components/slybroadcast/package.json b/components/slybroadcast/package.json index 2d11b0f8b761a..20c656178bce2 100644 --- a/components/slybroadcast/package.json +++ b/components/slybroadcast/package.json @@ -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 (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } diff --git a/components/slybroadcast/slybroadcast.app.mjs b/components/slybroadcast/slybroadcast.app.mjs new file mode 100644 index 0000000000000..b1cf736e582ce --- /dev/null +++ b/components/slybroadcast/slybroadcast.app.mjs @@ -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", + }, + 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, + }, + }, + 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", + }, + }); + }, + 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, + }); + }, + }, +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1bb40f3699cb3..24905259427ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9514,7 +9514,10 @@ importers: '@pipedream/platform': 1.5.1 components/slybroadcast: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.3 + dependencies: + '@pipedream/platform': 3.0.3 components/smaily: specifiers: @@ -13414,55 +13417,6 @@ packages: - aws-crt dev: false - /@aws-sdk/client-sso-oidc/3.600.0_tdq3komn4zwyd65w7klbptsu34: - resolution: {integrity: sha512-7+I8RWURGfzvChyNQSyj5/tKrqRbzRl7H+BnTOf/4Vsw1nFOi5ROhlhD4X/Y0QCTacxnaoNcIrqnY7uGGvVRzw==} - engines: {node: '>=16.0.0'} - dependencies: - '@aws-crypto/sha256-browser': 5.2.0 - '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sts': 3.600.0 - '@aws-sdk/core': 3.598.0 - '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 - '@aws-sdk/middleware-host-header': 3.598.0 - '@aws-sdk/middleware-logger': 3.598.0 - '@aws-sdk/middleware-recursion-detection': 3.598.0 - '@aws-sdk/middleware-user-agent': 3.598.0 - '@aws-sdk/region-config-resolver': 3.598.0 - '@aws-sdk/types': 3.598.0 - '@aws-sdk/util-endpoints': 3.598.0 - '@aws-sdk/util-user-agent-browser': 3.598.0 - '@aws-sdk/util-user-agent-node': 3.598.0 - '@smithy/config-resolver': 3.0.3 - '@smithy/core': 2.2.3 - '@smithy/fetch-http-handler': 3.2.1 - '@smithy/hash-node': 3.0.2 - '@smithy/invalid-dependency': 3.0.2 - '@smithy/middleware-content-length': 3.0.2 - '@smithy/middleware-endpoint': 3.0.4 - '@smithy/middleware-retry': 3.0.6 - '@smithy/middleware-serde': 3.0.3 - '@smithy/middleware-stack': 3.0.3 - '@smithy/node-config-provider': 3.1.3 - '@smithy/node-http-handler': 3.1.2 - '@smithy/protocol-http': 4.0.3 - '@smithy/smithy-client': 3.1.6 - '@smithy/types': 3.3.0 - '@smithy/url-parser': 3.0.3 - '@smithy/util-base64': 3.0.0 - '@smithy/util-body-length-browser': 3.0.0 - '@smithy/util-body-length-node': 3.0.0 - '@smithy/util-defaults-mode-browser': 3.0.6 - '@smithy/util-defaults-mode-node': 3.0.6 - '@smithy/util-endpoints': 2.0.3 - '@smithy/util-middleware': 3.0.3 - '@smithy/util-retry': 3.0.2 - '@smithy/util-utf8': 3.0.0 - tslib: 2.6.3 - transitivePeerDependencies: - - '@aws-sdk/client-sts' - - aws-crt - dev: false - /@aws-sdk/client-sso/3.423.0: resolution: {integrity: sha512-znIufHkwhCIePgaYciIs3x/+BpzR57CZzbCKHR9+oOvGyufEPPpUT5bFLvbwTgfiVkTjuk6sG/ES3U5Bc+xtrA==} engines: {node: '>=14.0.0'} @@ -13698,7 +13652,7 @@ packages: dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sso-oidc': 3.600.0_tdq3komn4zwyd65w7klbptsu34 + '@aws-sdk/client-sso-oidc': 3.600.0 '@aws-sdk/core': 3.598.0 '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 '@aws-sdk/middleware-host-header': 3.598.0 @@ -13740,6 +13694,55 @@ packages: - aws-crt dev: false + /@aws-sdk/client-sts/3.600.0_dseaa2p5u2yk67qiepewcq3hkq: + resolution: {integrity: sha512-KQG97B7LvTtTiGmjlrG1LRAY8wUvCQzrmZVV5bjrJ/1oXAU7DITYwVbSJeX9NWg6hDuSk0VE3MFwIXS2SvfLIA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 5.2.0 + '@aws-crypto/sha256-js': 5.2.0 + '@aws-sdk/client-sso-oidc': 3.600.0 + '@aws-sdk/core': 3.598.0 + '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 + '@aws-sdk/middleware-host-header': 3.598.0 + '@aws-sdk/middleware-logger': 3.598.0 + '@aws-sdk/middleware-recursion-detection': 3.598.0 + '@aws-sdk/middleware-user-agent': 3.598.0 + '@aws-sdk/region-config-resolver': 3.598.0 + '@aws-sdk/types': 3.598.0 + '@aws-sdk/util-endpoints': 3.598.0 + '@aws-sdk/util-user-agent-browser': 3.598.0 + '@aws-sdk/util-user-agent-node': 3.598.0 + '@smithy/config-resolver': 3.0.3 + '@smithy/core': 2.2.3 + '@smithy/fetch-http-handler': 3.2.1 + '@smithy/hash-node': 3.0.2 + '@smithy/invalid-dependency': 3.0.2 + '@smithy/middleware-content-length': 3.0.2 + '@smithy/middleware-endpoint': 3.0.4 + '@smithy/middleware-retry': 3.0.6 + '@smithy/middleware-serde': 3.0.3 + '@smithy/middleware-stack': 3.0.3 + '@smithy/node-config-provider': 3.1.3 + '@smithy/node-http-handler': 3.1.2 + '@smithy/protocol-http': 4.0.3 + '@smithy/smithy-client': 3.1.6 + '@smithy/types': 3.3.0 + '@smithy/url-parser': 3.0.3 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.6 + '@smithy/util-defaults-mode-node': 3.0.6 + '@smithy/util-endpoints': 2.0.3 + '@smithy/util-middleware': 3.0.3 + '@smithy/util-retry': 3.0.2 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.3 + transitivePeerDependencies: + - '@aws-sdk/client-sso-oidc' + - aws-crt + dev: false + /@aws-sdk/core/3.556.0: resolution: {integrity: sha512-vJaSaHw2kPQlo11j/Rzuz0gk1tEaKdz+2ser0f0qZ5vwFlANjt08m/frU17ctnVKC1s58bxpctO/1P894fHLrA==} engines: {node: '>=14.0.0'} @@ -18083,7 +18086,7 @@ packages: '@aws-sdk/client-sns': 3.423.0 '@aws-sdk/client-sqs': 3.423.0 '@aws-sdk/client-ssm': 3.423.0 - '@aws-sdk/client-sts': 3.600.0 + '@aws-sdk/client-sts': 3.600.0_dseaa2p5u2yk67qiepewcq3hkq '@aws-sdk/s3-request-presigner': 3.609.0 '@pipedream/helper_functions': 0.3.12 '@pipedream/platform': 1.6.6