{ "kind": "open-flow-workflow", "version": 1, "name": "Clockify Invoice to Notion", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_bfc4a1b7fe8f7614": { "name": "Receive the invoice", "kind": "webhook", "bodyFields": [ { "jsonSchema": { "type": [ "string", "number" ] }, "nullable": false, "handle": "number" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "issuedDate" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "dueDate" }, { "jsonSchema": { "type": "number" }, "nullable": false, "handle": "amount" } ], "method": "POST", "options": {} }, "n_9a33b41a402e62e8": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_bfc4a1b7fe8f7614", "output": "body" } ] }, "dataSourceId": { "kind": "value", "value": "YOUR_NOTION_DATA_SOURCE_ID" } }, "name": "Prepare invoice properties", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" }, { "jsonSchema": { "type": "string", "minLength": 1 }, "nullable": false, "handle": "dataSourceId" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "parent" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "properties" } ], "name": "Prepare invoice properties", "moduleId": "n_d7b4c90e559b2c61", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b69c10dced3e0012": { "inputs": { "parent": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9a33b41a402e62e8", "output": "parent" } ] }, "properties": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9a33b41a402e62e8", "output": "properties" } ] } }, "name": "Create the invoice page", "kind": "task", "task": { "inputs": [ { "description": "The parent page ID.", "jsonSchema": { "type": "string", "description": "The parent page ID." }, "nullable": true, "handle": "parentId", "value": null }, { "description": "The page title.", "jsonSchema": { "type": "string", "description": "The page title." }, "nullable": true, "handle": "title", "value": null }, { "description": "The official Notion parent object payload. Use { page_id: \"...\" } for a child page under an existing page, { data_source_id: \"...\" } for a data source row, or { workspace: true } to create a workspace-level private page when the credential is an OAuth public integration. When parent is provided, do not use the top-level title field; set the title through properties.title instead. Internal integration secrets usually cannot create workspace-level private pages and should use a parent page or data source.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A Notion parent field value." }, "description": "The official Notion parent object payload. Use { page_id: \"...\" } for a child page under an existing page, { data_source_id: \"...\" } for a data source row, or { workspace: true } to create a workspace-level private page when the credential is an OAuth public integration. When parent is provided, do not use the top-level title field; set the title through properties.title instead. Internal integration secrets usually cannot create workspace-level private pages and should use a parent page or data source." }, "nullable": true, "handle": "parent", "value": null }, { "description": "The page properties.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A Notion page property value." }, "description": "The page properties." }, "nullable": true, "handle": "properties", "value": null }, { "description": "The child blocks to add.", "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": { "description": "A Notion API field value." }, "description": "A Notion block object." }, "description": "The child blocks to add." }, "nullable": true, "handle": "children", "value": null }, { "description": "Enhanced Markdown content to create page content. Mutually exclusive with children. Markdown-only private pages without parent are supported only for OAuth public connections or personal access tokens; internal integration secrets should provide a parent page or data source.", "jsonSchema": { "type": "string", "description": "Enhanced Markdown content to create page content. Mutually exclusive with children. Markdown-only private pages without parent are supported only for OAuth public connections or personal access tokens; internal integration secrets should provide a parent page or data source." }, "nullable": true, "handle": "markdown", "value": null }, { "description": "The data source template payload to apply to the created page.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A Notion template field value." }, "description": "The data source template payload to apply to the created page." }, "nullable": true, "handle": "template", "value": null }, { "description": "The page icon object.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A Notion icon field value." }, "description": "The page icon object." }, "nullable": true, "handle": "icon", "value": null }, { "description": "The page cover object.", "jsonSchema": { "type": "object", "additionalProperties": { "description": "A Notion cover field value." }, "description": "The page cover object." }, "nullable": true, "handle": "cover", "value": null } ], "outputs": [ { "description": "The created Notion page object returned by the API.", "jsonSchema": { "type": "object", "properties": { "object": { "const": "page", "description": "The Notion object type." }, "id": { "type": "string", "description": "The page ID." }, "created_time": { "type": "string", "format": "date-time", "description": "The time when the page was created." }, "last_edited_time": { "type": "string", "format": "date-time", "description": "The time when the page was last edited." }, "created_by": { "type": "object", "properties": { "object": { "const": "user", "description": "The Notion object type." }, "id": { "type": "string", "description": "The Notion user ID." }, "name": { "type": [ "string", "null" ], "description": "The user's display name, or null when unavailable." }, "avatar_url": { "type": [ "string", "null" ], "description": "The user's avatar URL, or null when unavailable." }, "type": { "type": "string", "enum": [ "person", "bot" ], "description": "The user type returned by Notion." }, "person": { "type": "object", "properties": { "email": { "type": "string", "format": "email", "description": "The person's email address." } }, "additionalProperties": true, "description": "Details about a person user." }, "bot": { "type": "object", "additionalProperties": { "description": "A Notion API field value." }, "description": "Details about a bot user." } }, "additionalProperties": true, "description": "A Notion user reference." }, "last_edited_by": { "type": "object", "properties": { "object": { "const": "user", "description": "The Notion object type." }, "id": { "type": "string", "description": "The Notion user ID." }, "name": { "type": [ "string", "null" ], "description": "The user's display name, or null when unavailable." }, "avatar_url": { "type": [ "string", "null" ], "description": "The user's avatar URL, or null when unavailable." }, "type": { "type": "string", "enum": [ "person", "bot" ], "description": "The user type returned by Notion." }, "person": { "type": "object", "properties": { "email": { "type": "string", "format": "email", "description": "The person's email address." } }, "additionalProperties": true, "description": "Details about a person user." }, "bot": { "type": "object", "additionalProperties": { "description": "A Notion API field value." }, "description": "Details about a bot user." } }, "additionalProperties": true, "description": "A Notion user reference." }, "cover": { "type": [ "object", "null" ], "additionalProperties": { "description": "A Notion API field value." }, "description": "The page cover object, or null when the page has no cover." }, "icon": { "type": [ "object", "null" ], "additionalProperties": { "description": "A Notion API field value." }, "description": "The page icon object, or null when the page has no icon." }, "parent": { "type": "object", "properties": { "type": { "type": "string", "description": "The parent type, such as workspace, page_id, data_source_id, database_id, or block_id." } }, "additionalProperties": true, "description": "The parent object that contains this Notion object." }, "is_archived": { "type": "boolean", "description": "Whether the page has been archived." }, "in_trash": { "type": "boolean", "description": "Whether the page is in the trash." }, "is_locked": { "type": "boolean", "description": "Whether the page is locked." }, "properties": { "type": "object", "additionalProperties": { "description": "A Notion property value or property schema object." }, "description": "The Notion page, database, or data source properties keyed by property name." }, "url": { "type": "string", "format": "uri", "description": "The canonical Notion URL for the page." }, "public_url": { "type": [ "string", "null" ], "format": "uri", "description": "The public Notion URL if the page is published to the web." } }, "additionalProperties": true, "description": "The created Notion page object returned by the API." }, "nullable": false, "handle": "output" } ], "name": "Create the invoice page", "executor": { "kind": "connector", "action": "notion.create_page", "outputMode": "value" } } } }, "edges": [ { "source": "n_bfc4a1b7fe8f7614", "target": "n_9a33b41a402e62e8" }, { "source": "n_9a33b41a402e62e8", "target": "n_b69c10dced3e0012" } ] } }, "modules": { "n_d7b4c90e559b2c61": { "name": "Prepare invoice properties", "imports": [], "source": "export default function invoiceToNotion({body,dataSourceId}) {\n if (!body || typeof body !== 'object' || !dataSourceId || dataSourceId.startsWith('YOUR_')) throw new Error('Configure the Notion data source and provide an invoice');\n const {number,issuedDate,dueDate,amount}=body;\n if ((typeof number !== 'string' && typeof number !== 'number') || String(number).trim()==='' || typeof issuedDate !== 'string' || !issuedDate || typeof dueDate !== 'string' || !dueDate || typeof amount !== 'number' || !Number.isFinite(amount)) throw new Error('Invoice needs number, issuedDate, dueDate and numeric amount');\n const issue = new Date(issuedDate), due = new Date(dueDate);\n if (Number.isNaN(issue.getTime()) || Number.isNaN(due.getTime())) throw new Error('Invoice dates must be valid');\n return {parent:{data_source_id:dataSourceId},properties:{'Invoice number':{title:[{text:{content:String(number)}}]},'Issue date':{date:{start:issue.toISOString().slice(0,10)}},'Due date':{date:{start:due.toISOString().slice(0,10)}},Amount:{number:amount}}};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }