diff --git a/components/brosix/.gitignore b/components/brosix/.gitignore deleted file mode 100644 index ec761ccab7595..0000000000000 --- a/components/brosix/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.js -*.mjs -dist \ No newline at end of file diff --git a/components/brosix/actions/send-message/send-message.mjs b/components/brosix/actions/send-message/send-message.mjs new file mode 100644 index 0000000000000..f4be5630b040f --- /dev/null +++ b/components/brosix/actions/send-message/send-message.mjs @@ -0,0 +1,28 @@ +import app from "../../brosix.app.mjs"; + +export default { + key: "brosix-send-message", + name: "Send Message", + description: "Send a message with Brosix. [See the documentation](https://help.brosix.com/notifications-api/)", + version: "0.0.1", + type: "action", + props: { + app, + msg: { + propDefinition: [ + app, + "msg", + ], + }, + }, + async run({ $ }) { + const response = await this.app.sendMessage({ + $, + params: { + msg: this.msg, + }, + }); + $.export("$summary", "Successfully sent the message"); + return response; + }, +}; diff --git a/components/brosix/app/brosix.app.ts b/components/brosix/app/brosix.app.ts deleted file mode 100644 index f0e1a5d928b0b..0000000000000 --- a/components/brosix/app/brosix.app.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineApp } from "@pipedream/types"; - -export default defineApp({ - type: "app", - app: "brosix", - propDefinitions: {}, - methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); - }, - }, -}); diff --git a/components/brosix/brosix.app.mjs b/components/brosix/brosix.app.mjs new file mode 100644 index 0000000000000..8c35b7042a918 --- /dev/null +++ b/components/brosix/brosix.app.mjs @@ -0,0 +1,42 @@ +import { axios } from "@pipedream/platform"; + +export default { + type: "app", + app: "brosix", + propDefinitions: { + msg: { + type: "string", + label: "Message", + description: "The message that will be sent", + }, + }, + methods: { + _baseUrl() { + return "https://box-n2.brosix.com/api/v1"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + path, + params, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl() + path, + params: { + "apikey": `${this.$auth.api_key}`, + ...params, + }, + }); + }, + + async sendMessage(args = {}) { + return this._makeRequest({ + path: "/message/send/", + method: "post", + ...args, + }); + }, + }, +}; diff --git a/components/brosix/package.json b/components/brosix/package.json index 601bd2d1a1e50..831d531e3eb24 100644 --- a/components/brosix/package.json +++ b/components/brosix/package.json @@ -1,18 +1,18 @@ { "name": "@pipedream/brosix", - "version": "0.0.3", + "version": "0.1.0", "description": "Pipedream Brosix Components", - "main": "dist/app/brosix.app.mjs", + "main": "brosix.app.mjs", "keywords": [ "pipedream", "brosix" ], - "files": [ - "dist" - ], "homepage": "https://pipedream.com/apps/brosix", "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2fa3b1a7ab523..027723c4f2dd1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1786,7 +1786,11 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/brosix: {} + components/brosix: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/browse_ai: dependencies: