diff --git a/components/autobound/actions/write-personalized-content/write-personalized-content.mjs b/components/autobound/actions/write-personalized-content/write-personalized-content.mjs new file mode 100644 index 0000000000000..6eecc80912882 --- /dev/null +++ b/components/autobound/actions/write-personalized-content/write-personalized-content.mjs @@ -0,0 +1,64 @@ +import app from "../../autobound.app.mjs"; + +export default { + key: "autobound-write-personalized-content", + name: "Write Personalized Content", + description: "Write personalized content using Autobound. [See the documentation](https://autobound-api.readme.io/docs/generate-personalized-content-copy)", + version: "0.0.1", + type: "action", + props: { + app, + contentType: { + propDefinition: [ + app, + "contentType", + ], + }, + contactEmail: { + propDefinition: [ + app, + "contactEmail", + ], + }, + userEmail: { + propDefinition: [ + app, + "userEmail", + ], + }, + writingStyle: { + propDefinition: [ + app, + "writingStyle", + ], + }, + additionalContext: { + propDefinition: [ + app, + "additionalContext", + ], + }, + wordCount: { + propDefinition: [ + app, + "wordCount", + ], + }, + }, + + async run({ $ }) { + const response = await this.app.writePersonalizedContent({ + $, + data: { + contactEmail: this.contactEmail, + userEmail: this.userEmail, + contentType: this.contentType, + writingStyle: this.writingStyle, + additionalContext: this.additionalContext, + wordCount: this.wordCount, + }, + }); + $.export("$summary", "Successfully generated personalized content"); + return response; + }, +}; diff --git a/components/autobound/autobound.app.mjs b/components/autobound/autobound.app.mjs index 4c9acaccef9dd..f7d8404352393 100644 --- a/components/autobound/autobound.app.mjs +++ b/components/autobound/autobound.app.mjs @@ -1,11 +1,70 @@ +import { axios } from "@pipedream/platform"; +import constants from "./common/constants.mjs"; + export default { type: "app", app: "autobound", - propDefinitions: {}, + propDefinitions: { + contactEmail: { + type: "string", + label: "Contact Email", + description: "The email address of the contact the user is reaching out to", + }, + userEmail: { + type: "string", + label: "User Email", + description: "The email address of the user the content is written on behalf of", + }, + contentType: { + type: "string", + label: "Content Type", + description: "Type of content to generate", + options: constants.CONTENT_TYPES, + }, + writingStyle: { + type: "string", + label: "Writing Style", + description: "Writing style for content generation", + options: constants.WRITING_STYLES, + }, + additionalContext: { + type: "string", + label: "Additional Context", + description: "Extra information for customizing generated content", + }, + wordCount: { + type: "integer", + label: "Word Count", + description: "Approximate word count for output", + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.autobound.ai/api/external"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + path, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl() + path, + headers: { + "X-API-KEY": `${this.$auth.api_key}`, + "Content-Type": "application/json", + ...headers, + }, + }); + }, + async writePersonalizedContent(args = {}) { + return this._makeRequest({ + path: "/generate-content/v3.5", + method: "post", + ...args, + }); }, }, }; diff --git a/components/autobound/common/constants.mjs b/components/autobound/common/constants.mjs new file mode 100644 index 0000000000000..abd58c83194a5 --- /dev/null +++ b/components/autobound/common/constants.mjs @@ -0,0 +1,36 @@ +export default { + CONTENT_TYPES: [ + "email", + "opener", + "sms", + "connectionRequest", + "callScript", + "sequence", + ], + WRITING_STYLES: [ + { + label: "For a conversational and insightful approach", + value: "challenger_sale", + }, + { + label: "To craft content with a creative, poetic twist", + value: "clever_poet", + }, + { + label: "For concise, executive-level pitches", + value: "cxo_pitch", + }, + { + label: "For content backed by data, statistics, and clear ROI", + value: "data_driven", + }, + { + label: "For short, personalized content that follows Basho protocol", + value: "basho", + }, + { + label: "Demonstrates a sense of urgency tied to the prospect's pain points", + value: "why_you_why_now", + }, + ], +}; diff --git a/components/autobound/package.json b/components/autobound/package.json index 38c4dedaf7f62..2241cc4837b03 100644 --- a/components/autobound/package.json +++ b/components/autobound/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/autobound", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Autobound Components", "main": "autobound.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "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 eb29df73dccb8..9882b43a8319a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1035,7 +1035,11 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/autobound: {} + components/autobound: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/autodesk: dependencies: