← All N8N workflows
Automation & utilitiesCodeHTTP RequestIfRespond To WebhookEdit Fields

2. Refresh Pipedrive tokens

Configured with HTTP Request, Respond To Webhook, Stop And Error, Supabase, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
RoutingStop and ErrorStop And ErrorData storeInsertSupabaseData storeGet Pipedrive TokenSupabaseWeb / APIGet contact fromPipedriveHTTP RequestRoutingAccess Token InvalidIfWeb / APISuccessRespond To WebhookWeb / APIRefresh Access TokenHTTP RequestCodeconvert clientId andsecret to base64CodeWeb / APIGenerate Refresh Tokenfrom authcodeHTTP RequestData storeLook for the relatedrecord in SupabaseSupabaseRoutingIF rec not foundIfData storeUpdate tokns in therecordSupabaseData storeSupabase- look for therecordSupabaseTransformcombine client id andsecretEdit FieldsWeb / APIGet Pipedrive acesstokenHTTP RequestRoutingIF successIfData storeUpdate thr row with newaccess tokenSupabaseTriggerWebhookWebhookTriggerReceive requestWebhookTriggercatch Auth codeWebhook

Node categories in this workflow

  • Routing
  • Data store
  • Web / API
  • Code
  • Transform
  • Trigger

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Stop and ErrorRoutingStop And ErrorSee node parameters
InsertData storeSupabaseSee node parameters
Get Pipedrive TokenData storeSupabaseget
Get contact from PipedriveWeb / APIHTTP RequestSee node parameters
Access Token InvalidRoutingIfSee node parameters
SuccessWeb / APIRespond To WebhookSee node parameters
Refresh Access TokenWeb / APIHTTP RequestPOST
convert clientId and secret to base64CodeCodeSee node parameters
Generate Refresh Token from authcodeWeb / APIHTTP RequestPOST
Look for the related record in SupabaseData storeSupabaseget
IF rec not foundRoutingIfSee node parameters
Update tokns in the recordData storeSupabaseupdate
Supabase- look for the recordData storeSupabaseget
combine client id and secretTransformEdit FieldsSee node parameters
Get Pipedrive acess tokenWeb / APIHTTP RequestPOST
IF successRoutingIfSee node parameters
Update thr row with new access tokenData storeSupabaseupdate
WebhookTriggerWebhookSee node parameters
Receive requestTriggerWebhookSee node parameters
catch Auth codeTriggerWebhookSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • httpBasicAuth
  • supabaseApi

Workflow notes

Step 2:

Step 2:

Create a workflow to refresh your access token when the access token requires a refresh.

Sticky Note1

Post unique data to identify your row in Database and be able to fetch the existing access and refresh token

Step 1:

Step 1:

Save Refresh token and Access token to DB when authenticated by user and installed.

Sticky Note4

You can also use SET NODE + tobase64 function as done in step 2

Step 3:

Step 3:

Make an actual API call. In this example, we are using search person API. Please refer to Pipedrive API documentation for your specific use case.

Loop back to fecth the refreshed Access Token

Loop back to fecth the refreshed Access Token

Note:

You can add further conditions and use Switch statemen tinstead of IF to validate API response based on your use case.

Sticky Note8

A 3rd partyapplication posting the request to the webhook

2. Refresh Pipedrive tokens

2. Refresh Pipedrive tokens

Purpose and structure

This folder contains the 2. Refresh Pipedrive tokens workflow. Its executable nodes use code, httpRequest, if, respondToWebhook, set, stopAndError, supabase, webhook. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Webhook, Receive request, catch Auth code

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Stopanderror/1504_Stopanderror_Code_Automation_Webhook.json MIT; preserve source notices.

Canvas section labels

These name areas of the original canvas; they do not include explanatory instructions.

  • Get token from pipedrive
  • 1. This workflow helps you create your own Oauth 2.0 token refresh system. It helps you have better control of your oauth 2.0 auth process.

More in Automation & utilities