{ "kind": "open-flow-workflow", "version": 1, "name": "Segment Event Tracker", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_3fcd8de81a1628c9": { "name": "Enter event details", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "Name of the action the user performed." }, "nullable": false, "handle": "event" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "userId" } ] }, "n_5e6682f6f4590ffc": { "inputs": { "userId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3fcd8de81a1628c9", "output": "userId" } ] } }, "name": "Select user or anonymous identity", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "userId" } ], "outputs": [ { "jsonSchema": { "type": "string", "minLength": 1, "description": "Unique identifier for the user in your database." }, "nullable": true, "handle": "userId" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "Pseudo-unique anonymous identifier for the user." }, "nullable": true, "handle": "anonymousId" } ], "name": "Select user or anonymous identity", "moduleId": "n_d9ba7da2d93f3576", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_4f5632076347dbf1": { "inputs": { "event": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3fcd8de81a1628c9", "output": "event" } ] }, "userId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5e6682f6f4590ffc", "output": "userId" } ] }, "anonymousId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_5e6682f6f4590ffc", "output": "anonymousId" } ] } }, "name": "Track event in Segment", "kind": "task", "task": { "inputs": [ { "description": "Unique identifier for the user in your database.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Unique identifier for the user in your database." }, "nullable": true, "handle": "userId", "value": null }, { "description": "Pseudo-unique anonymous identifier for the user.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Pseudo-unique anonymous identifier for the user." }, "nullable": true, "handle": "anonymousId", "value": null }, { "description": "Segment context object with extra information about the event.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A JSON-compatible Segment field value." }, "description": "Segment context object with extra information about the event." }, "nullable": true, "handle": "context", "value": null }, { "description": "Segment destination flags keyed by destination name.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A JSON-compatible Segment field value." }, "description": "Segment destination flags keyed by destination name." }, "nullable": true, "handle": "integrations", "value": null }, { "description": "Timestamp when the message took place, in ISO 8601 format.", "jsonSchema": { "type": "string", "format": "date-time", "description": "Timestamp when the message took place, in ISO 8601 format." }, "nullable": true, "handle": "timestamp", "value": null }, { "description": "Timestamp when the message was sent to Segment, in ISO 8601 format.", "jsonSchema": { "type": "string", "format": "date-time", "description": "Timestamp when the message was sent to Segment, in ISO 8601 format." }, "nullable": true, "handle": "sentAt", "value": null }, { "description": "Unique message identifier used by Segment for deduplication.", "jsonSchema": { "type": "string", "maxLength": 100, "minLength": 1, "description": "Unique message identifier used by Segment for deduplication." }, "nullable": true, "handle": "messageId", "value": null }, { "description": "Name of the action the user performed.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Name of the action the user performed." }, "nullable": false, "handle": "event" }, { "description": "Free-form properties associated with the event.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A JSON-compatible Segment field value." }, "description": "Free-form properties associated with the event." }, "nullable": true, "handle": "properties", "value": null } ], "outputs": [ { "description": "Whether Segment accepted the HTTP request.", "jsonSchema": { "type": "boolean", "description": "Whether Segment accepted the HTTP request." }, "nullable": false, "handle": "accepted" }, { "description": "HTTP status returned by Segment.", "jsonSchema": { "type": "integer", "description": "HTTP status returned by Segment." }, "nullable": false, "handle": "status" }, { "description": "Raw response payload returned by Segment, or null when the body is empty.", "jsonSchema": { "description": "Raw response payload returned by Segment, or null when the body is empty." }, "nullable": false, "handle": "raw" } ], "name": "Track event in Segment", "executor": { "kind": "connector", "action": "segment.track" } } }, "n_7457b8d9c29e811d": { "name": "HTTP acceptance response", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "boolean", "description": "Whether Segment accepted the HTTP request." }, "nullable": false, "handle": "accepted" }, { "jsonSchema": { "type": "integer", "description": "HTTP status returned by Segment." }, "nullable": false, "handle": "status" }, { "jsonSchema": { "description": "Raw response payload returned by Segment, or null when the body is empty." }, "nullable": false, "handle": "raw" } ], "outputMappings": { "accepted": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4f5632076347dbf1", "output": "accepted" } ] }, "status": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4f5632076347dbf1", "output": "status" } ] }, "raw": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4f5632076347dbf1", "output": "raw" } ] } } } }, "edges": [ { "source": "n_3fcd8de81a1628c9", "target": "n_5e6682f6f4590ffc" }, { "source": "n_5e6682f6f4590ffc", "target": "n_4f5632076347dbf1" }, { "source": "n_4f5632076347dbf1", "target": "n_7457b8d9c29e811d" } ] } }, "modules": { "n_d9ba7da2d93f3576": { "name": "Select user or anonymous identity", "imports": [], "source": "import { randomUUID } from 'node:crypto';\n\nexport default function selectIdentity({ userId }) {\n if (userId !== null && typeof userId !== 'string') throw new Error('User ID must be text or left empty');\n return userId ? { userId, anonymousId: null } : { userId: null, anonymousId: randomUUID() };\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }