Netzo Logo

pipedrive

Pipedrive is a sales management tool.

Usage

import { pipedrive } from 'netzo/apis/pipedrive.ts'

const api = pipedrive({
  apiToken: Deno.env.get('PIPEDRIVE_API_TOKEN'),
  companyDomain: Deno.env.get('PIPEDRIVE_COMPANY_DOMAIN')
})

Configuration

The pipedrive factory function expects an object with the following, and returns an object with an API client api.

ParamTypeDefaultDescription
apiTokenstringDeno.env.get('PIPEDRIVE_API_TOKEN')the API token to use for authentication
companyDomainstringDeno.env.get('PIPEDRIVE_COMPANY_DOMAIN')the company domain to use for authentication
Refer to the API documentation to get the required information.

Examples

The following examples assume you have created an api client instance.

Find Deals

Find all deals that match the query.

const query: QueryGetDeals = {}
const result = await api.deals.get<Deals>(query)
const resultData = result.data

Search Deals

Find all deals that match the search criteria.

const query: QuerySearchDeals = { term: 'New Deal' }
const result = await api.deals.search.get<SearchDealsResult>(query)
const resultData = result.data.items

Add Deal

Add a new deal.

const data: DataAddDeal = { title: 'New Deal', value: 100 }
const result = await api.deals.post<AddOrUpdateDealResult>(data)
const resultData = result.data

Update deal

Update a deal by id.

const data: DataUpdateDeal = { title: 'Updated Title' }
const result = await api.deals[DEAL_ID].put<AddOrUpdateDealResult>(data)
const resultData = result.data

Delete deal

Delete a deal by id.

const result = await api.deals[DEAL_ID].delete<DeleteResult>()
const resultData = result.data

Find persons

Find all persons that match the query.

const query: QueryGetPersons = {}
const result = await api.persons.get<Persons>(query)
const resultData = result.data

Search persons

Find all persons that match the search criteria.

const query: QuerySearchPersons = { term: 'Smith' }
const result = await api.persons.search.get<SearchPersonsResult>(query)
const resultData = result.data.items

Add person

Add a new person.

const data: DataAddPerson = { name: 'John Doe' }
const result = await api.persons.post<AddOrUpdatePersonResult>(data)
const resultData = result.data

Update person

Update a person by id.

const data: DataUpdatePerson = { email: '[email protected]' }
const result = await api.persons[PERSON_ID].put<AddOrUpdatePersonResult>(data)
const resultData = result.data

Delete person

Delete a person by id.

const result = await api.persons[PERSON_ID].delete<DeleteResult>()
const resultData = result.data

References