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 →
{
"name": "TokPortal credits balance guard \u2192 top-up reminder",
"nodes": [
{
"parameters": {
"content": "## Credits balance guard\nEvery 6 hours: read the credit balance, compare with the price of your usual bundle, and send a top-up reminder when fewer than N bundles remain.\n\nEdit `MIN_BUNDLES_LEFT` in **Thresholds**.",
"height": 200,
"width": 560,
"color": 4
},
"id": "tp-059",
"name": "Sticky Notetp-058",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-40,
-240
]
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 6
}
]
}
},
"id": "tp-060",
"name": "Every 6 Hours",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
0,
60
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "t1",
"name": "MIN_BUNDLES_LEFT",
"value": 5,
"type": "number"
}
]
},
"options": {}
},
"id": "tp-061",
"name": "Thresholds",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
220,
60
]
},
{
"parameters": {
"resource": "credits",
"operation": "getBalance"
},
"id": "tp-062",
"name": "Credit Balance",
"type": "n8n-nodes-tokportal.tokPortal",
"typeVersion": 1,
"position": [
440,
-40
],
"credentials": {
"tokPortalApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"resource": "credits",
"operation": "getCosts"
},
"id": "tp-063",
"name": "Credit Costs",
"type": "n8n-nodes-tokportal.tokPortal",
"typeVersion": 1,
"position": [
440,
160
],
"credentials": {
"tokPortalApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"numberInputs": 2
},
"id": "tp-064",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
680,
60
]
},
{
"parameters": {
"jsCode": "const items = $input.all().map(i => i.json);\nconst balance = items[0] || {};\nconst costs = items[1] || {};\nconst credits = Number(balance.total_credits ?? balance.balance ?? 0);\n// Price of one account bundle with 3 videos (GET /credit-costs \u2192 data.costs.*.credits).\nconst c = costs.costs || {};\nconst perBundle = (Number(c.account_creation?.credits ?? 32) + 3 * Number(c.video_upload?.credits ?? 2)) || 38;\nconst bundlesLeft = Math.floor(credits / perBundle);\nconst min = Number($('Thresholds').first().json.MIN_BUNDLES_LEFT || 5);\nreturn [{ json: { credits, perBundle, bundlesLeft, min, low: bundlesLeft < min } }];"
},
"id": "tp-065",
"name": "Compute Runway",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
920,
60
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose"
},
"conditions": [
{
"id": "l1",
"leftValue": "={{ $json.low }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "tp-066",
"name": "Balance Low?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1160,
60
]
},
{
"parameters": {
"resource": "message",
"operation": "post",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "name",
"value": "#social-ops"
},
"text": "=:warning: *TokPortal credits running low* \u2014 {{ $json.credits }} credits left (~{{ $json.bundlesLeft }} bundles at {{ $json.perBundle }} credits each, threshold {{ $json.min }}).\nTop up: https://app.tokportal.com/dashboard/billing",
"otherOptions": {}
},
"id": "tp-067",
"name": "Slack: Top-Up Reminder",
"type": "n8n-nodes-base.slack",
"typeVersion": 2.2,
"position": [
1400,
-40
],
"credentials": {
"slackApi": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Every 6 Hours": {
"main": [
[
{
"node": "Thresholds",
"type": "main",
"index": 0
}
]
]
},
"Thresholds": {
"main": [
[
{
"node": "Credit Balance",
"type": "main",
"index": 0
},
{
"node": "Credit Costs",
"type": "main",
"index": 0
}
]
]
},
"Credit Balance": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Credit Costs": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Compute Runway",
"type": "main",
"index": 0
}
]
]
},
"Compute Runway": {
"main": [
[
{
"node": "Balance Low?",
"type": "main",
"index": 0
}
]
]
},
"Balance Low?": {
"main": [
[
{
"node": "Slack: Top-Up Reminder",
"type": "main",
"index": 0
}
],
[]
]
}
},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": [
{
"name": "TokPortal"
}
]
}
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.
slackApitokPortalApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
TokPortal credits balance guard → top-up reminder. Uses n8n-nodes-tokportal, slack. Scheduled trigger; 9 nodes.
Source: https://github.com/tokportal/n8n-nodes-tokportal/blob/main/templates/08-credits-balance-guard.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Daily TokPortal analytics digest → Slack. Uses n8n-nodes-tokportal, slack. Scheduled trigger; 8 nodes.
This workflow fully automates your team's daily standup process using Slack for communication, Notion for structured data storage, and Redis for real-time session management.
debug. Uses httpRequest, slack, redis, mailgun. Scheduled trigger; 60 nodes.
Seller Follow-Up Engine (Enhanced). Uses httpRequest, slack. Scheduled trigger; 44 nodes.
This workflow is an automated employee time tracking and reporting system that monitors weekly work hours via TMetric, then delivers personalized summaries directly to each team member on Slack. It co