{
  "openruna_format": "flow-graph-v1",
  "title": "2. Refresh Pipedrive tokens",
  "slug": "2-refresh-pipedrive-tokens",
  "source_filename": "1504_Stopanderror_Code_Automation_Webhook.json",
  "nodes": [
    {
      "id": "Stop and Error",
      "name": "Stop and Error",
      "integration": "stopAndError",
      "kind": "action"
    },
    {
      "id": "Insert",
      "name": "Insert",
      "integration": "supabase",
      "kind": "action"
    },
    {
      "id": "Get Pipedrive Token",
      "name": "Get Pipedrive Token",
      "integration": "supabase",
      "kind": "action"
    },
    {
      "id": "Get contact from Pipedrive",
      "name": "Get contact from Pipedrive",
      "integration": "httpRequest",
      "kind": "action"
    },
    {
      "id": "Access Token Invalid",
      "name": "Access Token Invalid",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "Success",
      "name": "Success",
      "integration": "respondToWebhook",
      "kind": "action"
    },
    {
      "id": "Refresh Access Token",
      "name": "Refresh Access Token",
      "integration": "httpRequest",
      "kind": "action"
    },
    {
      "id": "convert clientId and secret to base64",
      "name": "convert clientId and secret to base64",
      "integration": "code",
      "kind": "logic"
    },
    {
      "id": "Generate Refresh Token from authcode",
      "name": "Generate Refresh Token from authcode",
      "integration": "httpRequest",
      "kind": "action"
    },
    {
      "id": "Look for the related record in Supabase",
      "name": "Look for the related record in Supabase",
      "integration": "supabase",
      "kind": "action"
    },
    {
      "id": "IF rec not found",
      "name": "IF rec not found",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "Update tokns in the record",
      "name": "Update tokns in the record",
      "integration": "supabase",
      "kind": "action"
    },
    {
      "id": "Supabase- look for the record",
      "name": "Supabase- look for the record",
      "integration": "supabase",
      "kind": "action"
    },
    {
      "id": "combine client id and secret",
      "name": "combine client id and secret",
      "integration": "set",
      "kind": "logic"
    },
    {
      "id": "Get Pipedrive acess token",
      "name": "Get Pipedrive acess token",
      "integration": "httpRequest",
      "kind": "action"
    },
    {
      "id": "IF success",
      "name": "IF success",
      "integration": "if",
      "kind": "logic"
    },
    {
      "id": "Update thr row with new access token",
      "name": "Update thr row with new access token",
      "integration": "supabase",
      "kind": "action"
    },
    {
      "id": "Webhook",
      "name": "Webhook",
      "integration": "webhook",
      "kind": "trigger"
    },
    {
      "id": "Receive request",
      "name": "Receive request",
      "integration": "webhook",
      "kind": "trigger"
    },
    {
      "id": "catch Auth code",
      "name": "catch Auth code",
      "integration": "webhook",
      "kind": "trigger"
    }
  ],
  "edges": [
    {
      "from": "Webhook",
      "to": "Supabase- look for the record"
    },
    {
      "from": "IF success",
      "to": "Update thr row with new access token"
    },
    {
      "from": "IF success",
      "to": "Stop and Error"
    },
    {
      "from": "Receive request",
      "to": "Get Pipedrive Token"
    },
    {
      "from": "catch Auth code",
      "to": "convert clientId and secret to base64"
    },
    {
      "from": "IF rec not found",
      "to": "Insert"
    },
    {
      "from": "IF rec not found",
      "to": "Update tokns in the record"
    },
    {
      "from": "Get Pipedrive Token",
      "to": "Get contact from Pipedrive"
    },
    {
      "from": "Access Token Invalid",
      "to": "Refresh Access Token"
    },
    {
      "from": "Access Token Invalid",
      "to": "Success"
    },
    {
      "from": "Refresh Access Token",
      "to": "Get Pipedrive Token"
    },
    {
      "from": "Get Pipedrive acess token",
      "to": "IF success"
    },
    {
      "from": "Get contact from Pipedrive",
      "to": "Access Token Invalid"
    },
    {
      "from": "combine client id and secret",
      "to": "Get Pipedrive acess token"
    },
    {
      "from": "Supabase- look for the record",
      "to": "combine client id and secret"
    },
    {
      "from": "Generate Refresh Token from authcode",
      "to": "Look for the related record in Supabase"
    },
    {
      "from": "convert clientId and secret to base64",
      "to": "Generate Refresh Token from authcode"
    },
    {
      "from": "Look for the related record in Supabase",
      "to": "IF rec not found"
    }
  ]
}