pipedrive.ts
TypeScript icon, indicating that this package has built-in type declarations

0.12.0 • Public • Published

A Typescript Pipedrive package.

This is a RESTful Client project, that is written in Typescript, for Pipedrive CRM.

Aim and Scope of project

For early phases of this project, only some operations will be included to the project. In the future there is a possibility of adding all operations defined in Open API specification of Pipedrive.

Getting Started

To get started, you need to install Node.js. This installation will come with npm tool that can be used to install packages to your projects. Enough said, let's install and include the project.

Installation

npm install --save pipedrive.ts

or

yarn add pipedrive.ts

Adding to your project

require statement

const { ... } = require("pipedrive.ts");

import statement

import { ... } from "pipedrive.ts";

... represents package exports. A clear example is PipedriveClient. You can find more about package exports down below.

Operations

As stated above, initial scope of this project is to implement some operations of Pipedrive. This list will be updated in the future when adding new operations. Implemented operations are;

Using operations

Before getting started with operations, we will declare a piece of code that will be used in all operations for the sake of DRY principle.

Reused piece of code(with import statement)

import { PipedriveClient } from "pipedrive.ts";

const client = new PipedriveClient("Your Pipedrive API token goes here.");

Get all deals

const deals = await client.GetAllDeals();

note that this operation needs to be used in an async function.

Alternatively, we can do something like this;

const promise = client.GetAllDeals();

promise
    .then((deals) => {
        //Use deals object for your case.
    })
    .catch((error) => {
        //Throw the operation error.
        throw error;
    });

client.GetAllDeals method takes couple of parameters;

name description type optional
user_id If supplied, only deals matching the given user will be returned. However, filter_id and owned_by_you takes precedence over user_id when supplied. number true
filter_id The ID of the filter to use. number true
stage_id If supplied, only deals within the given stage will be returned. number true
status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. open, won, lost, deleted , all_not_deleted true
start Pagination start. number true
limit Items shown per page. number true
sort The field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). string true
owned_by_you When supplied, only deals owned by you are returned. However, filter_id takes precedence over owned_by_you when both are supplied. 0, 1 true

client.GetAllDeals method returns;

name description type may not be present
success If the response is successful or not. boolean true
data The array of deals. array true
additional_data The additional data of the list. object true
related_objects Related data of the call object true

data, additional_data and related_objects types can be found in their links.

Readme

Keywords

Package Sidebar

Install

npm i pipedrive.ts

Weekly Downloads

2

Version

0.12.0

License

MIT

Unpacked Size

100 kB

Total Files

125

Last publish

Collaborators

  • yarkingulacti