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.
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.
| Node | Category | Type | Operation |
|---|---|---|---|
| Stop and Error | Routing | Stop And Error | See node parameters |
| Insert | Data store | Supabase | See node parameters |
| Get Pipedrive Token | Data store | Supabase | get |
| Get contact from Pipedrive | Web / API | HTTP Request | See node parameters |
| Access Token Invalid | Routing | If | See node parameters |
| Success | Web / API | Respond To Webhook | See node parameters |
| Refresh Access Token | Web / API | HTTP Request | POST |
| convert clientId and secret to base64 | Code | Code | See node parameters |
| Generate Refresh Token from authcode | Web / API | HTTP Request | POST |
| Look for the related record in Supabase | Data store | Supabase | get |
| IF rec not found | Routing | If | See node parameters |
| Update tokns in the record | Data store | Supabase | update |
| Supabase- look for the record | Data store | Supabase | get |
| combine client id and secret | Transform | Edit Fields | See node parameters |
| Get Pipedrive acess token | Web / API | HTTP Request | POST |
| IF success | Routing | If | See node parameters |
| Update thr row with new access token | Data store | Supabase | update |
| Webhook | Trigger | Webhook | See node parameters |
| Receive request | Trigger | Webhook | See node parameters |
| catch Auth code | Trigger | Webhook | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- 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
httpBasicAuthsupabaseApi
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.