snippets_js
Integration
New integration from credential
const pipedrive = yepcode.integration.pipedrive("credential-slug");
New integration from plain authentication data
const pipedrive = require("pipedrive");
const client = pipedrive.ApiClient.instance;
client.authentications.api_key.apiKey = "your-api-token";
tip
Find the complete pipedrive API reference here: https://developers.pipedrive.com/docs/api/v1
Create Lead
Create lead
const leadsApi = new pipedrive.LeadsApi();
leadsApi
.addLead({
title: "lead-title",
person_id: person-id,
organization_id: organization-id
})
.then((response) => {
console.log(`Created lead with id ${response.data.id}`)
})
.catch(console.error);
List Leads
List leads
const leadsApi = new pipedrive.LeadsApi();
leadsApi.getLeads().then((response) => {
const leads = response.data
leads.forEach((lead) => {
console.log(`Found lead with id ${lead.id} and title ${lead.title}`)
})
}).catch(console.error);
Delete Lead
Delete lead
const leadsApi = new pipedrive.LeadsApi();
leadsApi.deleteLead("lead-id").then((response) => {
console.log(`Deleted lead widh id: ${response.data.id}`)
}).catch(console.error);
Create Contact
Create contact
const personsApi = new pipedrive.PersonsApi();
personsApi
.addPerson({
name: "contact-name",
email: ["contact-email"],
org_id: organization-id,
})
.then((response) => {
console.log(
`Created person widh id: ${response.data.id} and name ${response.data.name}`
);
})
.catch(console.error);
List Contacts
List contacts
const personsApi = new pipedrive.PersonsApi();
personsApi.getPersons().then((response) => {
const persons = response.data;
persons.forEach((person) => {
console.log(`Found person with id ${person.id} and name ${person.name}`)
})
}).catch(console.error);
Delete Contact
Delete contact
const personsApi = new pipedrive.PersonsApi();
personsApi.deletePerson(person-id).then((response) => {
console.log(`Deleted person widh id: ${response.data.id}`)
}).catch(console.error);
Create Organization
Create organization
const organizationsApi = new pipedrive.OrganizationsApi();
organizationsApi
.addOrganization({ name: "organization-name" })
.then((response) => {
console.log(
`Created organization widh id: ${response.data.id} and name ${response.data.name}`
);
})
.catch(console.error);
List Organizations
List organizations
const organizationsApi = new pipedrive.OrganizationsApi();
organizationsApi.getOrganizations().then((response) => {
response.data.forEach((organization) => {
console.log(`Found organization with id ${organization.id} and name ${organization.name}`)
})
}).catch(console.error);
Delete Organization
Delete organization
const organizationsApi = new pipedrive.OrganizationsApi();
organizationsApi.deleteOrganization(organization-id).then((response) => {
console.log(`Deleted organization widh id: ${response.data.id}`)
}).catch(console.error);