Pipedrive
In this example, we will show you how you can get started working with the Pipedrive API and produce a working use case that allows you to list all of the Organizations in your Pipedrive CRM.
You'll need to get an API token that is valid for the CRM you want to access. Find out how to set that up in the Pipedrive Authorization documentation.
Install & Authorize Superface
The Superface CLI provides all the tooling needed to author the Comlinks for your integration.
- macOS
- Linux
- Windows
brew install superfaceai/cli/superface
npm install -g @superfaceai/cli@latest
npm install -g @superfaceai/cli@latest
If you don't have a Superface account already, you can sign up here. You can use your account to authenticate the CLI.
superface login
Prepare the documentation
Pipedrive's documentation is available as an Open API 3 specification document that is regularly maintained. Use this for a complete index of their API capabilities.
superface prepare https://developers.pipedrive.com/docs/api/v1/openapi.yaml pipedrive
Once the documentation has been indexed, you can create a profile for the use case you want to achieve.
superface new pipedrive "list all organizations"
A file called organizations-management.get-collection.profile
will be created in the superface
folder as a result of. This is a Comlink file that decribes the input and output expectations that the API expects to achieve this use case.
Turn the Comlink into code
To turn the Comlink profile into runnable code in either Node.js or Python, use the following command and include the name of the provider and a use case profile you want to work with.
- Node.js
- Python
superface map pipedrive organizations-management/get-collection
superface map pipedrive organizations-management/get-collection python
Add your API key
If you don't already have your Pipedrive API key in your environment, you can add it to your .env
file as PIPEDRIVE_API_KEY=<your-pipedrive-api-key>"
.
For help finding your Pipedrive API Key, please refer to their How to find the API token documentation.
Set up your inputs
In order to list the organizations correctly, you will need to modify the boilerplate code from the Pipedrive documentation so it contains a real request object. From the superface
folder, open organizations-management.get-collection.pipedrive.mjs
(or .py
if you created Python files) and modify the object in the usecase.perform()
function.
- Node.js
- Python
{
start: 0,
limit: 10,
sort : 'name ASC',
},
{
start: 0,
limit: 10,
sort : 'name ASC',
},
Test it
To test it you can use the execute
command.
- Node.js
- Python
superface execute pipedrive organizations-management/get-collection
superface execute pipedrive organizations-management/get-collection python
If successful, you will see a JSON response listing the contacts in your CRM workspace.