Docsv1.0
Docs/Guides/n8n Integration

n8n Integration

Connect Tizemint tip events to n8n automation workflows.

n8n Integration

Connect Tizemint tip events to n8n to trigger automations — send notifications, update spreadsheets, post to Slack, and more.

Warning

n8n does not natively support Server-Sent Events (SSE). The Tizemint event stream uses SSE, so you need a small bridge to get events into n8n. Two approaches are covered below: a real-time bridge (recommended) and a polling approach (simpler, less real-time).


Approach A: SSE Bridge (Real-Time)

This is the recommended approach. A lightweight script subscribes to the Tizemint SSE stream and forwards each event to an n8n webhook trigger.

Step 1: Create an n8n Webhook Workflow

  1. In n8n, create a new workflow.
  2. Add a Webhook trigger node.
  3. Set the HTTP method to POST.
  4. Copy the webhook URL (looks like https://your-n8n-instance.com/webhook/abc123).
  5. Add downstream nodes — for example, a Discord node or Send Email node.

Step 2: Install Dependencies

bash
npm init -y
npm install eventsource

Step 3: Create the Bridge Script

js
// tizemint-n8n-bridge.js
import EventSource from "eventsource";
 
const TIZEMINT_TOKEN = process.env.TIZEMINT_TOKEN; // tzmnt_...
const N8N_WEBHOOK_URL = process.env.N8N_WEBHOOK_URL; // Your n8n webhook URL
 
if (!TIZEMINT_TOKEN || !N8N_WEBHOOK_URL) {
  console.error("Missing TIZEMINT_TOKEN or N8N_WEBHOOK_URL env vars");
  process.exit(1);
}
 
function connect() {
  const url = `https://tizemint.com/api/tip-events/stream?token=${TIZEMINT_TOKEN}`;
  const es = new EventSource(url);
 
  es.onopen = () => {
    console.log("[tizemint-bridge] Connected to event stream");
  };
 
  es.onmessage = async (event) => {
    let data;
    try {
      data = JSON.parse(event.data);
    } catch {
      // Ignore keep-alive pings and malformed messages
      return;
    }
 
    console.log(`[tizemint-bridge] Event received: ${data.type}`);
 
    try {
      const res = await fetch(N8N_WEBHOOK_URL, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(data),
      });
      if (!res.ok) {
        console.error(`[tizemint-bridge] n8n webhook returned ${res.status}`);
      }
    } catch (err) {
      console.error("[tizemint-bridge] Failed to forward event:", err.message);
    }
  };
 
  es.onerror = (err) => {
    console.error("[tizemint-bridge] SSE error, reconnecting in 5s...", err);
    es.close();
    setTimeout(connect, 5000);
  };
}
 
connect();

Step 4: Run the Bridge

bash
TIZEMINT_TOKEN=tzmnt_your_token_here \
N8N_WEBHOOK_URL=https://your-n8n.com/webhook/abc123 \
node tizemint-n8n-bridge.js

The bridge will reconnect automatically on disconnect. The Tizemint stream has a 5-minute keep-alive timeout; the bridge handles this with a reconnect loop.

Step 5: Handle Events in n8n

Your n8n Webhook node will receive the raw event JSON body. The shape varies by event type:

json
{
  "type": "tip:received",
  "amount": 500,
  "displayName": "CoolViewer42",
  "message": "Great stream!",
  "goalId": "goal_abc123",
  "timestamp": "2026-04-07T14:23:00Z"
}

Use an IF node to branch on {{ $json.type }} to handle different event types differently.

Example: Discord Notification on Tip

  1. After the Webhook trigger, add an IF node: {{ $json.type }} equals tip:received.
  2. On the true branch, add an HTTP Request node (or Discord node):
    • Method: POST
    • URL: Your Discord webhook URL
    • Body:
      json
      {
        "content": "💸 **{{ $json.displayName }}** tipped ${{ $json.amount / 100 }}! \"{{ $json.message }}\""
      }
Tip

Divide amount by 100 — tip amounts are stored in cents. A value of 500 means $5.00.

Running as a Background Service

bash
npm install -g pm2
TIZEMINT_TOKEN=tzmnt_... N8N_WEBHOOK_URL=https://... pm2 start tizemint-n8n-bridge.js --name tizemint-bridge
pm2 save
pm2 startup

Approach B: HTTP Polling (Simpler, Less Real-Time)

If you don't want to run a separate process, you can poll the Tizemint REST API on a schedule using n8n's Schedule Trigger and HTTP Request nodes.

Warning

Polling introduces latency — a 30-second poll interval means tip alerts can be up to 30 seconds delayed. For live stream alerts, Approach A is strongly preferred.

Info

This approach requires a REST endpoint that returns recent tips. Check the Tizemint API docs for available query endpoints — SSE stream polling is not the same as a REST query.

Basic Polling Workflow

  1. Add a Schedule Trigger node (e.g., every 30 seconds).
  2. Add an HTTP Request node:
    • Method: GET
    • URL: https://tizemint.com/api/tips/recent
    • Headers: Authorization: Bearer tzmnt_your_token
  3. Add an IF node to check if any new tips have arrived since the last poll (compare timestamps).
  4. Add your notification or action nodes.

To track which tips you've already processed, use n8n's Static Data feature or a small database node to store the last-seen timestamp.


Event Reference

Event TypeWhen It Fires
tip:receivedA new tip arrives
tip:goal-completedA tip completes a goal
tip:overflow-chainOverflow amount starts a new goal
tip:queue-updatedGoal queue order changes

Troubleshooting

Bridge connects but n8n never fires Check that your n8n Webhook node is set to Listen (green indicator). In production workflows, webhooks only activate on saved, active workflows.

Events arrive but amount looks wrong Amounts are in cents. 500 = $5.00. Divide by 100 before displaying.

Bridge disconnects frequently The Tizemint stream sends a keep-alive ping every ~30 seconds. The reconnect handler in the bridge script reconnects automatically. If you see rapid reconnects, verify your token is valid and hasn't been rotated.