Skip to content
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
42 changes: 42 additions & 0 deletions components/productlane/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import productlane from "../../productlane.app.mjs";

export default {
key: "productlane-create-contact",
name: "Create Contact",
description: "Creates a new contact with email, name, and an array of segments in Productlane. [See the documentation](https://productlane.com/docs/api-reference/contacts/create-contact)",
version: "0.0.1",
type: "action",
props: {
productlane,
email: {
propDefinition: [
productlane,
"email",
],
},
name: {
type: "string",
label: "Name",
description: "The name of the contact",
optional: true,
},
segments: {
type: "string[]",
label: "Segments",
description: "Array of segments",
optional: true,
},
},
async run({ $ }) {
const response = await this.productlane.createContact({
$,
data: {
email: this.email,
name: this.name,
segments: this.segments,
},
});
$.export("$summary", `Successfully created contact ${this.email}`);
return response;
},
};
100 changes: 100 additions & 0 deletions components/productlane/actions/create-feedback/create-feedback.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import {
ORIGIN_OPTIONS, PAIN_LEVEL_OPTIONS,
} from "../../common/constants.mjs";
import productlane from "../../productlane.app.mjs";

export default {
key: "productlane-create-feedback",
name: "Create Feedback",
description:
"Create new feedback in Productlane. [See the documentation](https://productlane.com/docs/api-reference/portal/create-feedback)",
version: "0.0.1",
type: "action",
props: {
productlane,
projectId: {
propDefinition: [
productlane,
"projectId",
],
},
email: {
propDefinition: [
productlane,
"email",
],
description: "The email for the feedback",
},
text: {
type: "string",
label: "Text",
description: "The text of the feedback",
},
notifyByEmail: {
propDefinition: [
productlane,
"notify",
],
label: "Notify by Email",
description: "Whether to notify by email",
},
notifyBySlack: {
propDefinition: [
productlane,
"notify",
],
label: "Notify by Slack",
description: "Whether to notify by slack",
},
origin: {
type: "string",
label: "Origin",
description: "The origin of the feedback",
optional: true,
options: ORIGIN_OPTIONS,
},
painLevel: {
type: "string",
label: "Pain Level",
description: "The pain level of the feedback",
options: PAIN_LEVEL_OPTIONS,
},
},
async run({ $ }) {
const {
email,
notifyByEmail,
notifyBySlack,
origin,
painLevel,
text,
projectId,
} = this;

const data = {
email: email,
notify: ((notifyByEmail ?? notifyBySlack) !== undefined)
? {
email: notifyByEmail,
slack: notifyBySlack,
}
: undefined,
origin: origin,
painLevel: painLevel,
text: text,
projectId: projectId,
};

const response = await this.productlane.createFeedback({
$,
data,
});

$.export(
"$summary",
`Successfully created feedback with ID: ${response.id}`,
);

return response;
},
};
36 changes: 36 additions & 0 deletions components/productlane/actions/upvote-project/upvote-project.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import productlane from "../../productlane.app.mjs";

export default {
key: "productlane-upvote-project",
name: "Upvote Project",
description: "Upvotes a project by ID. [See the documentation](https://productlane.com/docs/api-reference/portal/upvote-project)",
version: "0.0.1",
type: "action",
props: {
productlane,
projectId: {
propDefinition: [
productlane,
"projectId",
],
},
email: {
propDefinition: [
productlane,
"email",
],
description: "The email associated with the upvote",
},
},
async run({ $ }) {
const response = await this.productlane.upvoteProject({
$,
projectId: this.projectId,
data: {
email: this.email,
},
});
$.export("$summary", "Successfully upvoted project");
return response;
},
};
20 changes: 20 additions & 0 deletions components/productlane/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export const ORIGIN_OPTIONS = [
"INAPP",
"PORTAL",
"API",
"SLACK",
"INTERCOM",
"INTERCOM_ATTACHMENT",
"ZENDESK_ATTACHMENT",
"FRONT_ATTACHMENT",
"EMAIL",
"ZAPIER",
"HUBSPOT",
];

export const PAIN_LEVEL_OPTIONS = [
"UNKNOWN",
"LOW",
"MEDIUM",
"HIGH",
];
7 changes: 5 additions & 2 deletions components/productlane/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/productlane",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Productlane Components",
"main": "productlane.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.5.1"
}
}
}
80 changes: 76 additions & 4 deletions components/productlane/productlane.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,83 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "productlane",
propDefinitions: {},
propDefinitions: {
projectId: {
type: "string",
label: "Project ID",
description: "The ID of the project. [See the documentation](https://productlane.com/docs/api-reference/portal/list-projects) for more information",
async options() {
const projects = await this.listProjects();
return projects.map((p) => ({
label: p.name,
value: p.id,
}));
},
},
email: {
type: "string",
label: "Email",
description: "The email of the contact",
},
notify: {
type: "boolean",
label: "Notify",
description: "Whether to notify",
optional: true,
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://productlane.com/api/v1";
},
_workspaceId() {
return this.$auth.workspace_id;
},
async _makeRequest({
$ = this,
path,
headers,
...otherOpts
}) {
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
Authorization: `Bearer ${this.$auth.api_key}`,
},
});
},
async createContact(opts) {
return this._makeRequest({
...opts,
path: "/contacts",
method: "POST",
});
},
async upvoteProject({
projectId, ...opts
}) {
return this._makeRequest({
...opts,
path: `/projects/${projectId}/upvotes`,
method: "POST",
});
},
async createFeedback(opts) {
return this._makeRequest({
...opts,
path: "/feedback",
method: "POST",
});
},
async listProjects() {
const { projects } = await this._makeRequest({
path: `/projects/${this._workspaceId()}`,
});
return projects;
},
},
};
5 changes: 4 additions & 1 deletion pnpm-lock.yaml

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