Automation library · CRM

Better Oauth2.0 workflow for Pipedrive CRM with Supabase

Started by another system calling it, and works across Supabase. 20 steps, 3 branches: a working afternoon to understand properly.

Medium

20 stepsMedium: a working afternoon
3Branches: places the flow splits
0Loops or waits
1Service it connects to

The flow

Starts it 4Logic 6Service 10

The steps in the order they run, from what starts it.

  1. 1WebhookWebhookStarts it
  2. 2Receive requestWebhookStarts it
  3. 3catch Auth codeWebhookStarts it
  4. 4Supabase- look for the recordSupabaseService
  5. 5Get Pipedrive TokenSupabaseService
  6. 6convert clientId and secret to base64CodeLogic
  7. 7combine client id and secretSetLogic
  8. 8Get contact from PipedriveHttp RequestService
  9. 9Generate Refresh Token from authcodeHttp RequestService
  10. 10Get Pipedrive acess tokenHttp RequestService
  11. 11Access Token InvalidIfLogic
  12. 12Look for the related record in SupabaseSupabaseService
  13. 13IF successIfLogic
  14. 14Refresh Access TokenHttp RequestService
  15. 15SuccessRespond To WebhookStarts it
  16. 16IF rec not foundIfLogic
  17. 17Update thr row with new access tokenSupabaseService
  18. 18Stop and ErrorStop And ErrorLogic
  19. 19InsertSupabaseService
  20. 20Update tokns in the recordSupabaseService

How it's built

Starts on
Another system calling it
Steps
20, with 3 branches
Size
Medium: a working afternoon
Connects to
Supabase
Model
None. This is plumbing, not judgement

Questions

What does it need to run?

An n8n account, plus your own Supabase account. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Plan an afternoon. 20 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 20 steps before you point it at anything that matters.