Feeling stuck with Segment? Say πŸ‘‹ to RudderStack.

SVG
Log in

How to load data from Pipedrive to Redshift

How to Extract my data from Pipedrive?

Pipedrive exposes its complete platform to developers through its API. As a Web API following the RESTful architecture principles, it can be accessed through HTTP.

As a RESTful API, interacting with it can be achieved using tools like CURL or Postman or by using HTTP clients for your favorite language or framework. A few suggestions:

Pipedrive API Authentication

Pipedrive API Authentication is API-Key based. You acquire an API Key from the platform and you can use it to authenticate to the API securely. All the calls are executed over secure HTTPS.

Pipedrive rate limiting

Rate limiting is considered per API token. For example, API allows performing 100 requests per 10 seconds.

Every API response includes the following headers:

  1. X-RateLimit-Limit: the number of requests the current API token can perform for the 10 seconds window.
  2. X-RateLimit-Remaining: the number of requests left for the 10 seconds window.
  3. X-RateLimit-Reset: the amount of seconds before the limit resets.

In case the limit is exceeded for the time window, the Pipedrive API will return an error response with HTTP code 429 and Retry-After header that will indicate the number of seconds before the limit resets.

Endpoints and available resources

Pipedrive exposes a large number of endpoints from which we can interact with the platform. These endpoints can be used to execute commands like adding a new person to our contact list and pulling data from it. A unique characteristic of the Pipedrive API is that a companion resource manages the custom fields that you might have created for the resource for many of the resources. In this way, maximum flexibility is offered to the users of the platform. The list of available resources follows:

  • Activities: Activities are appointments, tasks, and events in general that can be associated with a deal and your sales pipeline.
  • Activity Fields: custom fields created for your activities.
  • Activity Types: user-defined types for your activities
  • Authorization: Authorization objects can be fetched without an API token but using an email and password.
  • Currencies: Supported currencies that can represent the monetary value of a Deal or a value of any monetary type custom field.
  • Deals: Deals represent ongoing, lost, or won sales to an organization or a Person.
  • Deal Fields: DealFields represent the near-complete schema for a Deal in the context of the company of the authorized user.
  • Email Messages: EmailMessages represent e-mail messages sent or received through Pipedrive designated e-mail account.
  • Email Threads: EmailThreads represent e-mail message threads that contain individual e-mail messages.
  • Files: Files are documents of any kind (images, spreadsheets, text files, etc.) that are uploaded to Pipedrive
  • Filters: Each filter is essentially a set of data validation conditions.
  • Goals: Goals help your team meet your sales targets.
  • Mail Messages: MailMessages represent mail messages synced with Pipedrive using the 2-way sync or the Smart Email BCC feature.
  • MailThreads: MailThreads represent mail threads that contain individual mail messages.
  • Notes: Notes are textual (HTML-formatted) information attached to Deals, Persons, and Organizations.
  • Note Fields: Custom fields for Notes.
  • Organizations: Organizations are companies and other kinds of organizations you are making Deals with.
  • Organization Fields: OrganizationFields represent the near-complete schema for an Organization in the context of the company of the authorized user.
  • Persons: Persons are your contacts, the customers you are doing Deals with
  • Person Fields: Custom fields for persons.
  • Pipelines: Pipelines are essentially ordered collections of Stages.
  • Products: Products are the goods or services you are dealing with.
  • Product fields: ProductFields represent the near-complete schema for a Product.
  • Stages: Stage is a logical component of a Pipeline and essentially a bucket that can hold a number of Deals.
  • Users: Users are people with access to your Pipedrive account.

For a detailed list of all endpoints together with a way to make requests to them without a client to see the data they return, if you have a Pipedrive account. Please check here.

It is clear that with such a rich platform and API the data that can be pulled out of Pipedrive are both valuable and come in large quantities. So, let’s assume that we want to pull all the persons out of Pipedrive to use the associated data for further analysis. To do so, we need to make a GET request with your favorite client to the Persons’ endpoint like this.

JAVASCRIPT
GET https://api.pipedrive.com/v1/persons?start=0&api_token=YOUR_KEY

The response headers and the actual response will look like the following:

JAVASCRIPT
{
"server": "nginx",
"date": "Tue, 06 Sep 2016 15:46:38 GMT",
"content-type": "application/json",
"transfer-encoding": "chunked",
"connection": "keep-alive",
"x-frame-options": "SAMEORIGIN",
"x-xss-protection": "1; mode=block",
"x-ratelimit-limit": "100",
"x-ratelimit-remaining": "99",
"x-ratelimit-reset": "10",
"access-control-allow-origin": "*"
}
JAVASCRIPT
{
"success": true,
"data": [
{
"id": 1,
"company_id": 1180166,
"owner_id": {
"id": 1682699,
"name": "Kostas",
"email": "costas.pardalis@gmail.com",
"has_pic": true,
"pic_hash": "39bf355364aacbde4fdfed3cef8a4589",
"active_flag": true,
"value": 1682699
},
"org_id": null,
"name": "Fotiz",
"first_name": null,
"last_name": "Fotiz",
"open_deals_count": 0,
"closed_deals_count": 0,
"participant_open_deals_count": 0,
"participant_closed_deals_count": 0,
"email_messages_count": 0,
"activities_count": 0,
"done_activities_count": 0,
"undone_activities_count": 0,
"reference_activities_count": 0,
"files_count": 0,
"notes_count": 0,
"followers_count": 1,
"won_deals_count": 0,
"lost_deals_count": 0,
"active_flag": true,

Inside the response, there will be an array of objects, with each one representing one Person as it is represented in Pipedrive. Please note that all data are serialized in JSON.
After successfully pulling your data from the Pipedrive API, you are ready to extract and prepare them for Amazon Redshift. Of course, the above process is only for one of the available resources. If you would like to have a complete view of all the available data, you will have to create a much more complex ETL process, including most of the resources that Pipedrive has. Alternatively, you can check RudderStack, which can simplify the whole process, and you can have your data all available for analysis in a matter of a few minutes.

[@portabletext/react] Unknown block type "aboutNodeBlock", specify a component for it in the `components.types` prop

How can I prepare my Pipedrive Data for Amazon Redshift?

Amazon Redshift is built around industry-standard SQL with added functionality to manage very large datasets and high-performance analysis. So, to load your data into it, you will have to follow its data model, a typical relational database model. The data you extract from your data source should be mapped into tables and columns where you can consider the table as a map to the resource you want to store and columns the resource attributes. Also, each attribute should adhere to the datatypes that are supported by Redshift. Currently, the datatypes that are supported are the following:

  • SMALLINT
  • INTEGER
  • BIGINT
  • DECIMAL
  • REAL
  • DOUBLE PRECISION
  • BOOLEAN
  • CHAR
  • VARCHAR
  • DATE
  • TIMESTAMP

As your data is probably coming in a representation like JSON that supports a much smaller range of data types, you have to be careful about what data you feed into Redshift and make sure that you have mapped your types into one of the datatypes that are supported by Redshift. Designing a Schema for Redshift and mapping the data from your data source to it is a process that you should take seriously as it can both affect the performance of your cluster and the questions that you can answer. It’s always a good idea to have in your mind the best practices that Amazon has published regarding the design of a Redshift database. When you have concluded on the design of your database you need to load your data on one of the data sources that are supported as input by Redshift, these are the following:

[@portabletext/react] Unknown block type "aboutNodeBlock", specify a component for it in the `components.types` prop

How can I Load my data from Pipedrive to Redshift?

The first step to load your data from Pipedrive to Redshift is to put them in a source that Redshift can pull it from. As mentioned earlier, there are three main data sources supported: Amazon S3, Amazon DynamoDB, and Amazon Kinesis Firehose, with Firehose being the most recent addition to insert data into Redshift.

To upload your data to Amazon S3, you will have to use the AWS REST API. As we see again, APIs play an important role in the extraction and the loading of data into our data warehouse. The first task that you have to perform is to create a bucket. You do that by executing an HTTP PUT on the Amazon AWS REST API endpoints for S3. You can do this by using a tool like CURL or Postman. Or use the libraries provided by Amazon for your favorite language. You can find more information by reading the API reference for the Bucket operations on Amazon AWS documentation.

After creating your bucket, you can start sending your data to Amazon S3, using gain the same AWS REST API but using the endpoints for Object operations. As in the Bucket case, you can either access the HTTP endpoints directly or use the library of your preference.

DynamoDB imports data again from S3. It adds another step between S3 and Amazon Redshift, so if you don’t need it for other reasons, you can avoid it.

Amazon Kinesis Firehose is the latest addition to insert data into Redshift and offers a real-time streaming approach to data importing. The necessary steps for adding data to Redshift through Kinesis Firehose are the following:

  • create a delivery stream
  • add data to the stream

Whenever you add new data to the stream, Kinesis takes care of adding this data to S3 or Redshift; again going through S3, in this case, is redundant if your goal is to move your data to Redshift. The execution of the previous two steps can be performed either through the REST API or through your favorite library just as in the previous two cases. The difference here is that for pushing your data into the stream you’ll be using a Kinesis Agent.

Amazon Redshift supports two methods for loading data into it. The first one is by invoking an INSERT command. You can connect to your Amazon Redshift instance with your client, using either a JDBC or ODBC connection, and then you perform an INSERT command for your data.

JAVASCRIPT
insert into category_stage values
(12, 'Concerts', 'Comedy', 'All stand-up comedy performances');

The way you invoke the INSERT command is the same as you would do with any other SQL database. For more information, you can check the INSERT examples page on the Amazon Redshift documentation.

Redshift is not designed for INSERT-like operations; on the contrary, the most efficient way of loading data into it is by doing bulk uploads using a COPY command. You can perform a COPY command for data that lives as flat files on S3 or from an Amazon DynamoDB table. When you perform COPY commands, Redshift is able to read multiple files simultaneously, and it automatically distributes the workload to the cluster nodes and performs the load in parallel. As a command COPY is quite flexible and allows for many different ways of using it, depending on your use case. Performing a COPY on Amazon S3 is as simple as the following command:

JAVASCRIPT
copy listing
from 's3://mybucket/data/listing/'
credentials 'aws_access_key_id=;aws_secret_access_key=';

For more examples on how to invoke a COPY command, you can check the COPY examples page on Amazon Redshift documentation. As in the INSERT case, the way to perform the COPY command is by connecting to your Amazon Redshift instance using a JDBC or ODBC connection and then invoke the commands you want using the SQL Reference from Amazon Redshift documentation.

What is the best way to load data from Pipedrive to Amazon Redshift and what are the possible alternatives?

So far we just scraped the surface of what can be done with Amazon Redshift and how to load data into it. The way to proceed relies heavily on the data you want to load, from which service they are coming from, and the requirements of your use case. Things can get even more complicated if you want to integrate data coming from different sources.

Instead of writing, hosting, and maintaining a flexible data infrastructure, a possible alternative is to use an ETL as a service product like RudderStack that can automatically handle this kind of problem for you.

RudderStack integrates with multiple sources or services like databases, CRM, email campaigns, analytics, and more. So quickly and safely, move all your data from Pipedrive into Amazon Redshift and start generating insights from your data.

Sign Up For Free And Start Sending Data

Test out our event stream, ELT, and reverse-ETL pipelines. Use our HTTP source to send data in less than 5 minutes, or install one of our 12 SDKs in your website or app.

Don't want to go through the pain of direct integration?

RudderStack's Pipedrive integration

makes it easy to send data from Pipedrive to Amazon Redshift.