AutomationFlowsData & Sheets › Churn Sync Loop

Churn Sync Loop

Churn Sync Loop. Uses supabase, httpRequest. Scheduled trigger; 6 nodes.

Cron / scheduled trigger★★★★☆ complexity6 nodesSupabaseHTTP Request
Data & Sheets Trigger: Cron / scheduled Nodes: 6 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Supabase recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Churn Sync Loop",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 2 * * *"
            }
          ]
        }
      },
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "tableId": "member_features",
        "returnAll": true
      },
      "name": "Get All Features",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "http://host.docker.internal:8000/score",
        "method": "POST",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-KEY",
              "value": "={{$credentials.Brain_API_Key}}"
            }
          ]
        },
        "sendBody": true,
        "contentType": "json",
        "bodyParameters": {
          "parameters": [
            {
              "name": "Gender",
              "value": "={{$node[\"Get All Features\"].json[\"Gender\"]}}"
            },
            {
              "name": "Near_Location",
              "value": "={{$node[\"Get All Features\"].json[\"Near_Location\"]}}"
            },
            {
              "name": "Partner",
              "value": "={{$node[\"Get All Features\"].json[\"Partner\"]}}"
            },
            {
              "name": "Promo_friends",
              "value": "={{$node[\"Get All Features\"].json[\"Promo_friends\"]}}"
            },
            {
              "name": "Phone",
              "value": "={{$node[\"Get All Features\"].json[\"Phone\"]}}"
            },
            {
              "name": "Age",
              "value": "={{$node[\"Get All Features\"].json[\"Age\"]}}"
            },
            {
              "name": "Lifetime_Tenure",
              "value": "={{$node[\"Get All Features\"].json[\"Lifetime_Tenure\"]}}"
            },
            {
              "name": "Contract_period",
              "value": "={{$node[\"Get All Features\"].json[\"Contract_period\"]}}"
            },
            {
              "name": "Month_to_end_contract",
              "value": "={{$node[\"Get All Features\"].json[\"Month_to_end_contract\"]}}"
            },
            {
              "name": "Group_visits",
              "value": "={{$node[\"Get All Features\"].json[\"Group_visits\"]}}"
            },
            {
              "name": "Avg_class_frequency_total",
              "value": "={{$node[\"Get All Features\"].json[\"Avg_class_frequency_total\"]}}"
            },
            {
              "name": "Avg_class_frequency_current_month",
              "value": "={{$node[\"Get All Features\"].json[\"Avg_class_frequency_current_month\"]}}"
            },
            {
              "name": "Avg_additional_charges_total",
              "value": "={{$node[\"Get All Features\"].json[\"Avg_additional_charges_total\"]}}"
            },
            {
              "name": "Days_Since_Last_Visit",
              "value": "={{$node[\"Get All Features\"].json[\"Days_Since_Last_Visit\"]}}"
            },
            {
              "name": "Month_1",
              "value": "={{$node[\"Get All Features\"].json[\"Month_1\"]}}"
            },
            {
              "name": "Month_2",
              "value": "={{$node[\"Get All Features\"].json[\"Month_2\"]}}"
            },
            {
              "name": "Month_3",
              "value": "={{$node[\"Get All Features\"].json[\"Month_3\"]}}"
            },
            {
              "name": "Month_4",
              "value": "={{$node[\"Get All Features\"].json[\"Month_4\"]}}"
            },
            {
              "name": "Month_5",
              "value": "={{$node[\"Get All Features\"].json[\"Month_5\"]}}"
            },
            {
              "name": "Month_6",
              "value": "={{$node[\"Get All Features\"].json[\"Month_6\"]}}"
            },
            {
              "name": "Month_7",
              "value": "={{$node[\"Get All Features\"].json[\"Month_7\"]}}"
            },
            {
              "name": "Month_8",
              "value": "={{$node[\"Get All Features\"].json[\"Month_8\"]}}"
            },
            {
              "name": "Month_9",
              "value": "={{$node[\"Get All Features\"].json[\"Month_9\"]}}"
            },
            {
              "name": "Month_10",
              "value": "={{$node[\"Get All Features\"].json[\"Month_10\"]}}"
            },
            {
              "name": "Month_11",
              "value": "={{$node[\"Get All Features\"].json[\"Month_11\"]}}"
            },
            {
              "name": "Month_12",
              "value": "={{$node[\"Get All Features\"].json[\"Month_12\"]}}"
            },
            {
              "name": "Month_13",
              "value": "={{$node[\"Get All Features\"].json[\"Month_13\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "POST Brain Score",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "values": {
          "number": [
            {
              "name": "last_churn_score",
              "value": "={{$json[\"churn_probability_score\"]}}"
            }
          ],
          "string": [
            {
              "name": "last_score_date",
              "value": "={{new Date().toISOString()}}"
            }
          ],
          "boolean": [
            {
              "name": "is_high_risk",
              "value": "={{$json[\"churn_probability_score\"] >= 70.0}}"
            }
          ]
        }
      },
      "name": "Compute Flags",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "tableId": "members",
        "updateKey": "gym_id,member_id",
        "columns": "last_churn_score,last_score_date,is_high_risk"
      },
      "name": "Update Members",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "tableId": "member_score_history",
        "columns": "gym_id,member_id,churn_score,score_date"
      },
      "name": "Insert Score History",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ],
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get All Features",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Features": {
      "main": [
        [
          {
            "node": "POST Brain Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST Brain Score": {
      "main": [
        [
          {
            "node": "Compute Flags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compute Flags": {
      "main": [
        [
          {
            "node": "Update Members",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Members": {
      "main": [
        [
          {
            "node": "Insert Score History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Churn Sync Loop. Uses supabase, httpRequest. Scheduled trigger; 6 nodes.

Source: https://github.com/SeanPrentice85/GymGuard-App/blob/58f5e7d651591ea06c17c4f69fc32fe1c78acffe/n8n/churn_sync_workflow.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

This workflow solves a common problem with RSS feeds: they often only provide a short summary or snippet of the full article. This template automatically monitors a list of your favorite blog RSS feed

HTTP Request, RSS Feed Read, Supabase
Data & Sheets

This workflow is a multi-system document synchronization pipeline built in n8n, designed to automatically sync and back up files between Microsoft SharePoint, Supabase/Postgres, and Google Drive.

HTTP Request, Supabase, Postgres +1
Data & Sheets

03 - Recordatorio 4h (CON VERIFICACIÓN) ✅. Uses supabase, httpRequest, twilio. Scheduled trigger; 17 nodes.

Supabase, HTTP Request, Twilio
Data & Sheets

02 - Recordatorio 24h antes (CON VERIFICACIÓN) ✅. Uses supabase, httpRequest, twilio. Scheduled trigger; 17 nodes.

Supabase, HTTP Request, Twilio
Data & Sheets

• Fetches IT-related tenders from the French BOAMP API (filter: informatique) • Scores each tender with OpenAI (pertinence, budget, stack, GO/NO-GO) • Routes to Supabase as hot (≥75) or archived • Run

HTTP Request, Supabase