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
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-activity/add-activity.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "pipedrive-add-activity",
name: "Add Activity",
description: "Adds a new activity. Includes `more_activities_scheduled_in_context` property in response's `additional_data` which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the supplied data). See the Pipedrive API docs for Activities [here](https://developers.pipedrive.com/docs/api/v1/#!/Activities). For info on [adding an activity in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Activities#addActivity)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
pipedriveApp,
Expand Down
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-deal/add-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "pipedrive-add-deal",
name: "Add Deal",
description: "Adds a new deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#addDeal)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
pipedriveApp,
Expand Down
107 changes: 107 additions & 0 deletions components/pipedrive/actions/add-lead/add-lead.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import pipedrive from "../../pipedrive.app.mjs";
import { ConfigurationError } from "@pipedream/platform";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "pipedrive-add-lead",
name: "Add Lead",
description: "Create a new lead in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Leads#addLead)",
version: "0.0.1",
type: "action",
props: {
pipedrive,
title: {
type: "string",
label: "Title",
description: "The name of the lead",
},
personId: {
propDefinition: [
pipedrive,
"personId",
],
description: "The ID of a person which this lead will be linked to. If the person does not exist yet, it needs to be created first. This property is required unless organization_id is specified.",
},
organizationId: {
propDefinition: [
pipedrive,
"organizationId",
],
description: "The ID of an organization which this lead will be linked to. If the organization does not exist yet, it needs to be created first. This property is required unless person_id is specified.",
},
ownerId: {
propDefinition: [
pipedrive,
"userId",
],
description: "The ID of the user which will be the owner of the created lead. If not provided, the user making the request will be used.",
},
leadLabelIds: {
propDefinition: [
pipedrive,
"leadLabelIds",
],
},
value: {
type: "object",
label: "Value",
description: "Potential value of the lead, e.g. `{ \"amount\": 200, \"currency\": \"EUR\" }`",
optional: true,
},
expectedCloseDate: {
type: "string",
label: "Expected Close Date",
description: "The date of when the deal which will be created from the lead is expected to be closed. In ISO 8601 format: YYYY-MM-DD.",
optional: true,
},
visibleTo: {
type: "string",
label: "Visible To",
description: "The visibility of the lead. If omitted, the visibility will be set to the default visibility setting of this item type for the authorized user. Read more about visibility groups [here](https://support.pipedrive.com/en/article/visibility-groups).",
options: [
{
label: "Essential / Advanced plan - Owner & followers, Professional / Enterprise plan - Owner only",
value: "1",
},
{
label: "Essential / Advanced plan - Entire company, Professional / Enterprise plan - Owner's visibility group",
value: "3",
},
{
label: "Professional / Enterprise plan - Owner's visibility group and sub-groups",
value: "5",
},
{
label: "Professional / Enterprise plan - Entire company",
value: "7",
},
],
optional: true,
},
wasSeen: {
type: "boolean",
label: "Was Seen",
description: "A flag indicating whether the lead was seen by someone in the Pipedrive UI",
optional: true,
},
},
async run({ $ }) {
if (!this.organizationId && !this.personId) {
throw new ConfigurationError("Either organizationId or personId is required");
}

const response = await this.pipedrive.addLead({
title: this.title,
person_id: this.personId,
organization_id: this.organizationId,
owner_id: this.ownerId,
label_ids: this.leadLabelIds,
value: parseObject(this.value),
expected_close_date: this.expectedCloseDate,
visible_to: this.visibleTo,
was_seen: this.wasSeen,
});
$.export("$summary", `Successfully created lead: ${response.data?.title || response.data?.id}`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-note/add-note.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "pipedrive-add-note",
name: "Add Note",
description: "Adds a new note. For info on [adding an note in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Notes#addNote)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
pipedriveApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "pipedrive-add-organization",
name: "Add Organization",
description: "Adds a new organization. See the Pipedrive API docs for Organizations [here](https://developers.pipedrive.com/docs/api/v1/Organizations#addOrganization)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
pipedriveApp,
Expand Down
2 changes: 1 addition & 1 deletion components/pipedrive/actions/add-person/add-person.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "pipedrive-add-person",
name: "Add Person",
description: "Adds a new person. See the Pipedrive API docs for People [here](https://developers.pipedrive.com/docs/api/v1/Persons#addPerson)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
pipedriveApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "pipedrive-search-persons",
name: "Search persons",
description: "Searches all Persons by `name`, `email`, `phone`, `notes` and/or custom fields. This endpoint is a wrapper of `/v1/itemSearch` with a narrower OAuth scope. Found Persons can be filtered by Organization ID. See the Pipedrive API docs [here](https://developers.pipedrive.com/docs/api/v1/Persons#searchPersons)",
version: "0.1.7",
version: "0.1.8",
type: "action",
props: {
pipedriveApp,
Expand Down
2 changes: 1 addition & 1 deletion components/pipedrive/actions/update-deal/update-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "pipedrive-update-deal",
name: "Update Deal",
description: "Updates the properties of a deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#updateDeal)",
version: "0.1.8",
version: "0.1.9",
type: "action",
props: {
pipedriveApp,
Expand Down
2 changes: 1 addition & 1 deletion components/pipedrive/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/pipedrive",
"version": "0.3.13",
"version": "0.4.0",
"description": "Pipedream Pipedrive Components",
"main": "pipedrive.app.mjs",
"keywords": [
Expand Down
26 changes: 26 additions & 0 deletions components/pipedrive/pipedrive.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,22 @@ export default {
};
},
},
leadLabelIds: {
type: "string[]",
label: "Lead Label IDs",
description: "The IDs of the lead labels to associate with the lead",
optional: true,
async options() {
const { data: leadLabels } = await this.getLeadLabels();

return leadLabels?.map(({
id, name,
}) => ({
label: name,
value: id,
}));
},
},
},
methods: {
api(model, version = "v1") {
Expand Down Expand Up @@ -323,6 +339,10 @@ export default {
const stagesApi = this.api("StagesApi", "v2");
return stagesApi.getStages(opts);
},
getLeadLabels(opts) {
const leadLabelsApi = this.api("LeadLabelsApi");
return leadLabelsApi.getLeadLabels(opts);
},
addActivity(opts = {}) {
const activityApi = this.api("ActivitiesApi", "v2");
return activityApi.addActivity({
Expand Down Expand Up @@ -353,6 +373,12 @@ export default {
AddPersonRequest: opts,
});
},
addLead(opts = {}) {
const leadApi = this.api("LeadsApi");
return leadApi.addLead({
AddLeadRequest: opts,
});
},
addWebhook(opts = {}) {
const webhooksApi = this.api("WebhooksApi");
return webhooksApi.addWebhook({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "pipedrive-new-deal-instant",
name: "New Deal (Instant)",
description: "Emit new event when a new deal is created.",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "pipedrive-new-person-instant",
name: "New Person (Instant)",
description: "Emit new event when a new person is created.",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "pipedrive-updated-deal-instant",
name: "New Deal Update (Instant)",
description: "Emit new event when a deal is updated.",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
export default {
...common,
key: "pipedrive-updated-person-instant",
name: "Updated Person (Instant)",

Check warning on line 7 in components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a person is updated.",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Loading