{ "kind": "open-flow-workflow", "version": 1, "name": "Save Orlen Invoices to Drive", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_cac02c44ded4aae7": { "name": "Start manually", "kind": "start", "inputDefs": [] }, "n_f2ef3215c9999868": { "name": "Every day at 23:45 UTC", "kind": "cron", "cronTimes": [ { "type": "cron", "expression": "45 23 * * *", "timezone": "UTC" } ] }, "n_7f8c3727aee661ff": { "inputs": { "root": { "kind": "value", "value": "YOUR_DRIVE_FOLDER_ID" }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7f8c3727aee661ff", "output": "state" } ] } }, "name": "Find year and month folders", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "root" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previous" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "folderId" } ], "name": "Find year and month folders", "moduleId": "n_479dacae36732652", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [ { "action": "googledrive.files.list" } ] } ] } }, "n_5ef31931fa5194db": { "inputs": {}, "name": "More folder pages?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "read", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_7f8c3727aee661ff", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_82a1c9b81d75670a": { "inputs": { "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_82a1c9b81d75670a", "output": "state" } ] }, "messages": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2706ad301c3b51c6", "output": "messages" } ] }, "nextPageToken": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_2706ad301c3b51c6", "output": "nextPageToken" } ] } }, "name": "Collect unread invoice IDs", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previous" }, { "jsonSchema": { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "messageId": { "type": "string", "description": "Gmail message ID." }, "threadId": { "type": "string", "description": "Gmail thread ID." } }, "required": [ "messageId", "threadId" ], "additionalProperties": false, "description": "A union variant." }, { "type": "object", "properties": { "historyId": { "type": "string", "description": "The message history ID." }, "internalDate": { "type": "string", "description": "The internal timestamp in milliseconds." }, "sizeEstimate": { "type": "integer", "description": "The estimated message size in bytes." }, "snippet": { "type": "string", "description": "The message snippet." }, "messageId": { "type": "string", "description": "Gmail message ID." }, "threadId": { "type": "string", "description": "Gmail thread ID." }, "labelIds": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs applied to the message." }, "subject": { "type": "string", "description": "Normalized message subject line." }, "sender": { "type": "string", "description": "Normalized sender value." }, "to": { "type": "string", "description": "Normalized To header value." }, "messageTimestamp": { "type": "string", "description": "Message timestamp returned by Gmail." } }, "required": [ "messageId", "threadId", "labelIds", "subject", "sender", "to", "messageTimestamp" ], "additionalProperties": false, "description": "Schema for gmailMessageSummarySchema." }, { "type": "object", "properties": { "historyId": { "type": "string", "description": "The message history ID." }, "internalDate": { "type": "string", "description": "The internal timestamp in milliseconds." }, "sizeEstimate": { "type": "integer", "description": "The estimated message size in bytes." }, "snippet": { "type": "string", "description": "The message snippet." }, "messageId": { "type": "string", "description": "Gmail message ID." }, "threadId": { "type": "string", "description": "Gmail thread ID." }, "labelIds": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs applied to the message." }, "subject": { "type": "string", "description": "Normalized message subject line." }, "sender": { "type": "string", "description": "Normalized sender value." }, "to": { "type": "string", "description": "Normalized To header value." }, "preview": { "type": "object", "properties": { "subject": { "type": "string", "description": "Preview subject extracted from the message." }, "body": { "type": "string", "description": "Preview body text extracted from the message." } }, "required": [ "subject", "body" ], "additionalProperties": false, "description": "Short preview of the message subject and body." }, "payload": { "type": [ "object", "null" ], "additionalProperties": { "description": "A record value." }, "description": "Raw Gmail payload object, or null when it was not included." }, "messageText": { "type": "string", "description": "Best-effort plain-text representation of the message body." }, "attachmentList": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": [ "string", "null" ], "description": "Attachment ID, or null when Gmail inlines the body." }, "filename": { "type": "string", "description": "Attachment filename." }, "mimeType": { "type": "string", "description": "Attachment MIME type." }, "size": { "type": "integer", "description": "Attachment size in bytes." }, "partId": { "type": [ "string", "null" ], "description": "Gmail MIME part ID, when supplied." }, "contentId": { "type": [ "string", "null" ], "description": "Bare Content-ID, when supplied." }, "disposition": { "type": [ "string", "null" ], "enum": [ "inline", "attachment", null ], "description": "Content-Disposition, when supplied." } }, "required": [ "attachmentId", "filename", "mimeType", "size", "partId", "contentId", "disposition" ], "additionalProperties": false, "description": "Schema for gmailAttachmentSchema." }, "description": "Normalized attachment summaries." }, "messageTimestamp": { "type": "string", "description": "Message timestamp returned by Gmail." }, "raw": { "type": "string", "description": "Raw RFC 2822 message content when Gmail returns it." } }, "required": [ "messageId", "threadId", "labelIds", "subject", "sender", "to", "preview", "payload", "messageText", "attachmentList", "messageTimestamp" ], "additionalProperties": false, "description": "Schema for gmailMessageSchema." } ], "description": "An array item." }, "description": "Messages returned by Gmail as lightweight references, lightweight summaries, or full normalized payloads." }, "nullable": true, "handle": "messages" }, { "jsonSchema": { "type": [ "string", "null" ], "description": "Opaque token for the next page, or null when there are no more results." }, "nullable": true, "handle": "nextPageToken" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string", "description": "Opaque pagination token returned by a previous Gmail response." }, "nullable": true, "handle": "pageToken" }, { "jsonSchema": { "type": "array", "items": { "type": "string" } }, "nullable": false, "handle": "ids" } ], "name": "Collect unread invoice IDs", "moduleId": "n_950371d09652ea03", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_247c40e677f6a495": { "inputs": {}, "name": "More Gmail pages?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "read", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_82a1c9b81d75670a", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_2706ad301c3b51c6": { "inputs": { "query": { "kind": "value", "value": "from:(orlenpay@orlen.pl) has:attachment is:unread" }, "maxResults": { "kind": "value", "value": 100 }, "detail": { "kind": "value", "value": "ids" }, "includeSpamTrash": { "kind": "value", "value": false }, "pageToken": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_82a1c9b81d75670a", "output": "pageToken" } ] } }, "name": "Search unread Orlen invoices", "kind": "task", "task": { "inputs": [ { "description": "Gmail search query.", "jsonSchema": { "type": "string", "description": "Gmail search query." }, "nullable": true, "handle": "query", "value": null }, { "description": "Maximum number of results to return.", "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 500, "description": "Maximum number of results to return.", "default": 20 }, "nullable": true, "handle": "maxResults", "value": 20 }, { "description": "Label IDs that messages must match.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs that messages must match." }, "nullable": true, "handle": "labelIds", "value": null }, { "description": "Opaque pagination token returned by a previous Gmail response.", "jsonSchema": { "type": "string", "description": "Opaque pagination token returned by a previous Gmail response." }, "nullable": true, "handle": "pageToken", "value": null }, { "description": "Whether to include messages from Spam and Trash.", "jsonSchema": { "type": "boolean", "description": "Whether to include messages from Spam and Trash." }, "nullable": true, "handle": "includeSpamTrash", "value": null }, { "description": "How much message detail to return: identifiers only, lightweight summaries, or full normalized messages.", "jsonSchema": { "type": "string", "enum": [ "ids", "summary", "full" ], "description": "How much message detail to return: identifiers only, lightweight summaries, or full normalized messages.", "default": "summary" }, "nullable": true, "handle": "detail", "value": "summary" } ], "outputs": [ { "description": "Messages returned by Gmail as lightweight references, lightweight summaries, or full normalized payloads.", "jsonSchema": { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "messageId": { "type": "string", "description": "Gmail message ID." }, "threadId": { "type": "string", "description": "Gmail thread ID." } }, "required": [ "messageId", "threadId" ], "additionalProperties": false, "description": "A union variant." }, { "type": "object", "properties": { "historyId": { "type": "string", "description": "The message history ID." }, "internalDate": { "type": "string", "description": "The internal timestamp in milliseconds." }, "sizeEstimate": { "type": "integer", "description": "The estimated message size in bytes." }, "snippet": { "type": "string", "description": "The message snippet." }, "messageId": { "type": "string", "description": "Gmail message ID." }, "threadId": { "type": "string", "description": "Gmail thread ID." }, "labelIds": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs applied to the message." }, "subject": { "type": "string", "description": "Normalized message subject line." }, "sender": { "type": "string", "description": "Normalized sender value." }, "to": { "type": "string", "description": "Normalized To header value." }, "messageTimestamp": { "type": "string", "description": "Message timestamp returned by Gmail." } }, "required": [ "messageId", "threadId", "labelIds", "subject", "sender", "to", "messageTimestamp" ], "additionalProperties": false, "description": "Schema for gmailMessageSummarySchema." }, { "type": "object", "properties": { "historyId": { "type": "string", "description": "The message history ID." }, "internalDate": { "type": "string", "description": "The internal timestamp in milliseconds." }, "sizeEstimate": { "type": "integer", "description": "The estimated message size in bytes." }, "snippet": { "type": "string", "description": "The message snippet." }, "messageId": { "type": "string", "description": "Gmail message ID." }, "threadId": { "type": "string", "description": "Gmail thread ID." }, "labelIds": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs applied to the message." }, "subject": { "type": "string", "description": "Normalized message subject line." }, "sender": { "type": "string", "description": "Normalized sender value." }, "to": { "type": "string", "description": "Normalized To header value." }, "preview": { "type": "object", "properties": { "subject": { "type": "string", "description": "Preview subject extracted from the message." }, "body": { "type": "string", "description": "Preview body text extracted from the message." } }, "required": [ "subject", "body" ], "additionalProperties": false, "description": "Short preview of the message subject and body." }, "payload": { "type": [ "object", "null" ], "additionalProperties": { "description": "A record value." }, "description": "Raw Gmail payload object, or null when it was not included." }, "messageText": { "type": "string", "description": "Best-effort plain-text representation of the message body." }, "attachmentList": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": [ "string", "null" ], "description": "Attachment ID, or null when Gmail inlines the body." }, "filename": { "type": "string", "description": "Attachment filename." }, "mimeType": { "type": "string", "description": "Attachment MIME type." }, "size": { "type": "integer", "description": "Attachment size in bytes." }, "partId": { "type": [ "string", "null" ], "description": "Gmail MIME part ID, when supplied." }, "contentId": { "type": [ "string", "null" ], "description": "Bare Content-ID, when supplied." }, "disposition": { "type": [ "string", "null" ], "enum": [ "inline", "attachment", null ], "description": "Content-Disposition, when supplied." } }, "required": [ "attachmentId", "filename", "mimeType", "size", "partId", "contentId", "disposition" ], "additionalProperties": false, "description": "Schema for gmailAttachmentSchema." }, "description": "Normalized attachment summaries." }, "messageTimestamp": { "type": "string", "description": "Message timestamp returned by Gmail." }, "raw": { "type": "string", "description": "Raw RFC 2822 message content when Gmail returns it." } }, "required": [ "messageId", "threadId", "labelIds", "subject", "sender", "to", "preview", "payload", "messageText", "attachmentList", "messageTimestamp" ], "additionalProperties": false, "description": "Schema for gmailMessageSchema." } ], "description": "An array item." }, "description": "Messages returned by Gmail as lightweight references, lightweight summaries, or full normalized payloads." }, "nullable": false, "handle": "messages" }, { "description": "Opaque token for the next page, or null when there are no more results.", "jsonSchema": { "type": [ "string", "null" ], "description": "Opaque token for the next page, or null when there are no more results." }, "nullable": true, "handle": "nextPageToken" }, { "description": "Approximate number of matching results reported by Gmail.", "jsonSchema": { "type": "integer", "description": "Approximate number of matching results reported by Gmail." }, "nullable": false, "handle": "resultSizeEstimate" } ], "name": "Search unread Orlen invoices", "executor": { "kind": "connector", "action": "gmail.fetch_emails" } } }, "n_c39b5e21cd6b5e5d": { "inputs": { "ids": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_82a1c9b81d75670a", "output": "ids" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c39b5e21cd6b5e5d", "output": "state" } ] }, "attachment": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a9a1559e3d47f46a", "output": "attachment" } ] } }, "name": "Prepare the next email", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "string" } }, "nullable": false, "handle": "ids" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previous" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "attachment" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "messageId" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "files" } ], "name": "Prepare the next email", "moduleId": "n_87d216207e4db1b9", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_7e3610a7172a1160": { "inputs": {}, "name": "More emails?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "read", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_c39b5e21cd6b5e5d", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_056d35ab6864c726": { "inputs": { "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c39b5e21cd6b5e5d", "output": "messageId" } ] }, "format": { "kind": "value", "value": "full" } }, "name": "Read the email", "kind": "task", "task": { "inputs": [ { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "description": "Gmail response format to request.", "jsonSchema": { "type": "string", "enum": [ "minimal", "full", "raw", "metadata" ], "description": "Gmail response format to request." }, "nullable": true, "handle": "format", "value": null } ], "outputs": [ { "description": "The message history ID.", "jsonSchema": { "type": "string", "description": "The message history ID." }, "nullable": true, "handle": "historyId" }, { "description": "The internal timestamp in milliseconds.", "jsonSchema": { "type": "string", "description": "The internal timestamp in milliseconds." }, "nullable": true, "handle": "internalDate" }, { "description": "The estimated message size in bytes.", "jsonSchema": { "type": "integer", "description": "The estimated message size in bytes." }, "nullable": true, "handle": "sizeEstimate" }, { "description": "The message snippet.", "jsonSchema": { "type": "string", "description": "The message snippet." }, "nullable": true, "handle": "snippet" }, { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "description": "Gmail thread ID.", "jsonSchema": { "type": "string", "description": "Gmail thread ID." }, "nullable": false, "handle": "threadId" }, { "description": "Label IDs applied to the message.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs applied to the message." }, "nullable": false, "handle": "labelIds" }, { "description": "Normalized message subject line.", "jsonSchema": { "type": "string", "description": "Normalized message subject line." }, "nullable": false, "handle": "subject" }, { "description": "Normalized sender value.", "jsonSchema": { "type": "string", "description": "Normalized sender value." }, "nullable": false, "handle": "sender" }, { "description": "Normalized To header value.", "jsonSchema": { "type": "string", "description": "Normalized To header value." }, "nullable": false, "handle": "to" }, { "description": "Short preview of the message subject and body.", "jsonSchema": { "type": "object", "properties": { "subject": { "type": "string", "description": "Preview subject extracted from the message." }, "body": { "type": "string", "description": "Preview body text extracted from the message." } }, "required": [ "subject", "body" ], "additionalProperties": false, "description": "Short preview of the message subject and body." }, "nullable": false, "handle": "preview" }, { "description": "Raw Gmail payload object, or null when it was not included.", "jsonSchema": { "type": [ "object", "null" ], "additionalProperties": { "description": "A record value." }, "description": "Raw Gmail payload object, or null when it was not included." }, "nullable": true, "handle": "payload" }, { "description": "Best-effort plain-text representation of the message body.", "jsonSchema": { "type": "string", "description": "Best-effort plain-text representation of the message body." }, "nullable": false, "handle": "messageText" }, { "description": "Normalized attachment summaries.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": [ "string", "null" ], "description": "Attachment ID, or null when Gmail inlines the body." }, "filename": { "type": "string", "description": "Attachment filename." }, "mimeType": { "type": "string", "description": "Attachment MIME type." }, "size": { "type": "integer", "description": "Attachment size in bytes." }, "partId": { "type": [ "string", "null" ], "description": "Gmail MIME part ID, when supplied." }, "contentId": { "type": [ "string", "null" ], "description": "Bare Content-ID, when supplied." }, "disposition": { "type": [ "string", "null" ], "enum": [ "inline", "attachment", null ], "description": "Content-Disposition, when supplied." } }, "required": [ "attachmentId", "filename", "mimeType", "size", "partId", "contentId", "disposition" ], "additionalProperties": false, "description": "Schema for gmailAttachmentSchema." }, "description": "Normalized attachment summaries." }, "nullable": false, "handle": "attachmentList" }, { "description": "Message timestamp returned by Gmail.", "jsonSchema": { "type": "string", "description": "Message timestamp returned by Gmail." }, "nullable": false, "handle": "messageTimestamp" }, { "description": "Raw RFC 2822 message content when Gmail returns it.", "jsonSchema": { "type": "string", "description": "Raw RFC 2822 message content when Gmail returns it." }, "nullable": true, "handle": "raw" } ], "name": "Read the email", "executor": { "kind": "connector", "action": "gmail.fetch_message_by_message_id" } } }, "n_f9b87eb448df6ebc": { "inputs": { "expectedId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c39b5e21cd6b5e5d", "output": "messageId" } ] }, "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_056d35ab6864c726", "output": "messageId" } ] }, "attachmentList": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_056d35ab6864c726", "output": "attachmentList" } ] }, "payload": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_056d35ab6864c726", "output": "payload" } ] } }, "name": "Select the first attachment", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "expectedId" }, { "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": [ "string", "null" ], "description": "Attachment ID, or null when Gmail inlines the body." }, "filename": { "type": "string", "description": "Attachment filename." }, "mimeType": { "type": "string", "description": "Attachment MIME type." }, "size": { "type": "integer", "description": "Attachment size in bytes." }, "partId": { "type": [ "string", "null" ], "description": "Gmail MIME part ID, when supplied." }, "contentId": { "type": [ "string", "null" ], "description": "Bare Content-ID, when supplied." }, "disposition": { "type": [ "string", "null" ], "enum": [ "inline", "attachment", null ], "description": "Content-Disposition, when supplied." } }, "required": [ "attachmentId", "filename", "mimeType", "size", "partId", "contentId", "disposition" ], "additionalProperties": false, "description": "Schema for gmailAttachmentSchema." }, "description": "Normalized attachment summaries." }, "nullable": false, "handle": "attachmentList" }, { "jsonSchema": { "type": [ "object", "null" ], "additionalProperties": { "description": "A record value." }, "description": "Raw Gmail payload object, or null when it was not included." }, "nullable": true, "handle": "payload" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "missing" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "remote" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "attachmentId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "filename" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "mimeType" }, { "jsonSchema": { "type": "integer", "minimum": 0, "maximum": 52428800, "description": "Attachment size in bytes returned in message metadata." }, "nullable": false, "handle": "size" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "inline" } ], "name": "Select the first attachment", "moduleId": "n_e06ed71b004c92c9", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_606148a4614b1562": { "inputs": {}, "name": "Download attachment?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "download", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "remote" } }, "operator": "isTrue" } ] } ] } ] }, "n_c532a717a76e261c": { "inputs": { "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c39b5e21cd6b5e5d", "output": "messageId" } ] }, "attachmentId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "attachmentId" } ] }, "filename": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "filename" } ] }, "mimeType": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "mimeType" } ] }, "size": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "size" } ] } }, "name": "Download the attachment", "kind": "task", "task": { "inputs": [ { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "description": "Gmail attachment ID returned in message attachment metadata.", "jsonSchema": { "type": "string", "description": "Gmail attachment ID returned in message attachment metadata." }, "nullable": false, "handle": "attachmentId" }, { "description": "Attachment filename returned in message metadata.", "jsonSchema": { "type": "string", "description": "Attachment filename returned in message metadata." }, "nullable": false, "handle": "filename" }, { "description": "Attachment MIME type returned in message metadata.", "jsonSchema": { "type": "string", "description": "Attachment MIME type returned in message metadata." }, "nullable": false, "handle": "mimeType" }, { "description": "Attachment size in bytes returned in message metadata.", "jsonSchema": { "type": "integer", "minimum": 0, "maximum": 52428800, "description": "Attachment size in bytes returned in message metadata." }, "nullable": false, "handle": "size" } ], "outputs": [ { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "description": "Gmail attachment ID returned in message attachment metadata.", "jsonSchema": { "type": "string", "description": "Gmail attachment ID returned in message attachment metadata." }, "nullable": false, "handle": "attachmentId" }, { "description": "Attachment filename returned in message metadata.", "jsonSchema": { "type": "string", "description": "Attachment filename returned in message metadata." }, "nullable": false, "handle": "filename" }, { "description": "Attachment MIME type returned in message metadata.", "jsonSchema": { "type": "string", "description": "Attachment MIME type returned in message metadata." }, "nullable": false, "handle": "mimeType" }, { "description": "Downloaded attachment size in bytes.", "jsonSchema": { "type": "integer", "description": "Downloaded attachment size in bytes." }, "nullable": false, "handle": "sizeBytes" }, { "description": "Temporary Connector file transit URL for downloading the attachment.", "jsonSchema": { "type": "string", "format": "uri", "description": "Temporary Connector file transit URL for downloading the attachment." }, "nullable": false, "handle": "transitUrl" } ], "name": "Download the attachment", "executor": { "kind": "connector", "action": "gmail.download_attachment" } } }, "n_a9a1559e3d47f46a": { "inputs": { "missing": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "missing" } ] }, "remote": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "remote" } ] }, "inline": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "inline" } ] }, "transitUrl": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c532a717a76e261c", "output": "transitUrl" } ] }, "size": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "size" } ] }, "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c39b5e21cd6b5e5d", "output": "messageId" } ] }, "attachmentId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "attachmentId" } ] }, "downloadedMessageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c532a717a76e261c", "output": "messageId" } ] }, "downloadedAttachmentId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c532a717a76e261c", "output": "attachmentId" } ] }, "downloadedSize": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c532a717a76e261c", "output": "sizeBytes" } ] }, "filename": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "filename" } ] }, "mimeType": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_f9b87eb448df6ebc", "output": "mimeType" } ] } }, "name": "Check attachment bytes", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "missing" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "remote" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "inline" }, { "jsonSchema": { "type": "string", "format": "uri", "description": "Temporary Connector file transit URL for downloading the attachment." }, "nullable": true, "handle": "transitUrl" }, { "jsonSchema": { "type": "integer", "minimum": 0 }, "nullable": false, "handle": "size" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "messageId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "attachmentId" }, { "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": true, "handle": "downloadedMessageId" }, { "jsonSchema": { "type": "string", "description": "Gmail attachment ID returned in message attachment metadata." }, "nullable": true, "handle": "downloadedAttachmentId" }, { "jsonSchema": { "type": "integer", "description": "Downloaded attachment size in bytes." }, "nullable": true, "handle": "downloadedSize" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "filename" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "mimeType" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "attachment" } ], "name": "Check attachment bytes", "moduleId": "n_118626f9b78650c4", "capabilities": [ { "kind": "http", "hosts": [ "example.com" ] } ] } }, "n_93e99a7fd0f47b2f": { "inputs": { "files": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c39b5e21cd6b5e5d", "output": "files" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "state" } ] }, "folderId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7f8c3727aee661ff", "output": "folderId" } ] } }, "name": "Prepare the next file", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "files" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "folderId" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": true, "handle": "previous" } ], "outputs": [ { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "state" }, { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "more" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The name of the file." }, "nullable": true, "handle": "name" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "The MIME type of the file." }, "nullable": true, "handle": "mimeType" }, { "jsonSchema": { "type": "string", "minLength": 1, "description": "Connector media upload content encoded as a Base64 string." }, "nullable": true, "handle": "contentBase64" }, { "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Schema for nonEmptyString." }, "minItems": 1, "description": "A list of parent folder IDs to place the file in." }, "nullable": true, "handle": "parents" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "messageId" } ], "name": "Prepare the next file", "moduleId": "n_3b5be1d573bb5966", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_df35612d3b2af1ef": { "inputs": {}, "name": "More files?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "upload", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_4687f5d57b99d1ec": { "inputs": { "name": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "name" } ] }, "mimeType": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "mimeType" } ] }, "contentBase64": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "contentBase64" } ] }, "parents": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "parents" } ] } }, "name": "Upload to Google Drive", "kind": "task", "task": { "inputs": [ { "description": "The name of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The name of the file." }, "nullable": true, "handle": "name", "value": null }, { "description": "The MIME type of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The MIME type of the file." }, "nullable": true, "handle": "mimeType", "value": null }, { "description": "A short description of the file.", "jsonSchema": { "type": "string", "minLength": 1, "description": "A short description of the file." }, "nullable": true, "handle": "description", "value": null }, { "description": "A list of parent folder IDs to place the file in.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1, "description": "Schema for nonEmptyString." }, "minItems": 1, "description": "A list of parent folder IDs to place the file in." }, "nullable": true, "handle": "parents", "value": null }, { "description": "Whether the user has starred the file.", "jsonSchema": { "type": "boolean", "description": "Whether the user has starred the file." }, "nullable": true, "handle": "starred", "value": null }, { "description": "A collection of arbitrary key-value pairs which are private to the requesting app.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "A collection of arbitrary key-value pairs which are private to the requesting app." }, "nullable": true, "handle": "appProperties", "value": null }, { "description": "A collection of arbitrary key-value pairs which are visible to all apps.", "jsonSchema": { "type": "object", "additionalProperties": { "type": "string", "description": "A record value." }, "description": "A collection of arbitrary key-value pairs which are visible to all apps." }, "nullable": true, "handle": "properties", "value": null }, { "description": "Connector media upload content encoded as a Base64 string.", "jsonSchema": { "type": "string", "minLength": 1, "description": "Connector media upload content encoded as a Base64 string." }, "nullable": true, "handle": "contentBase64", "value": null }, { "description": "Connector text media upload content.", "jsonSchema": { "type": "string", "description": "Connector text media upload content." }, "nullable": true, "handle": "text", "value": null } ], "outputs": [ { "description": "The unique identifier of the file.", "jsonSchema": { "type": "string", "description": "The unique identifier of the file." }, "nullable": false, "handle": "id" }, { "description": "The name of the file.", "jsonSchema": { "type": "string", "description": "The name of the file." }, "nullable": false, "handle": "name" }, { "description": "The MIME type of the file.", "jsonSchema": { "type": "string", "description": "The MIME type of the file." }, "nullable": false, "handle": "mimeType" }, { "description": "A link for opening the file in a relevant Google editor or viewer in a browser.", "jsonSchema": { "type": [ "string", "null" ], "description": "A link for opening the file in a relevant Google editor or viewer in a browser." }, "nullable": true, "handle": "webViewLink" }, { "description": "The time at which the file was created (RFC 3339 date-time).", "jsonSchema": { "type": [ "string", "null" ], "description": "The time at which the file was created (RFC 3339 date-time)." }, "nullable": true, "handle": "createdTime" }, { "description": "The last time the file was modified by anyone (RFC 3339 date-time).", "jsonSchema": { "type": [ "string", "null" ], "description": "The last time the file was modified by anyone (RFC 3339 date-time)." }, "nullable": true, "handle": "modifiedTime" }, { "description": "The size of the file's content in bytes.", "jsonSchema": { "type": [ "integer", "null" ], "description": "The size of the file's content in bytes." }, "nullable": true, "handle": "sizeBytes" }, { "description": "The ID of the shared drive the file belongs to.", "jsonSchema": { "type": [ "string", "null" ], "description": "The ID of the shared drive the file belongs to." }, "nullable": true, "handle": "driveId" }, { "description": "The IDs of the parent folders containing the file.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "The IDs of the parent folders containing the file." }, "nullable": true, "handle": "parents" }, { "description": "The owners of the file.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "displayName": { "type": [ "string", "null" ], "description": "The display name of the owner." }, "emailAddress": { "type": [ "string", "null" ], "description": "The email address of the owner." }, "permissionId": { "type": [ "string", "null" ], "description": "The permission ID of the owner." }, "photoLink": { "type": [ "string", "null" ], "description": "A link to the owner's profile photo." } }, "required": [ "displayName", "emailAddress", "permissionId", "photoLink" ], "additionalProperties": false, "description": "Schema for driveOwnerSchema." }, "description": "The owners of the file." }, "nullable": true, "handle": "owners" }, { "description": "Whether the file has been shared.", "jsonSchema": { "type": "boolean", "description": "Whether the file has been shared." }, "nullable": true, "handle": "shared" }, { "description": "Whether the user has starred the file.", "jsonSchema": { "type": "boolean", "description": "Whether the user has starred the file." }, "nullable": true, "handle": "starred" }, { "description": "Whether the file has been trashed.", "jsonSchema": { "type": "boolean", "description": "Whether the file has been trashed." }, "nullable": true, "handle": "trashed" }, { "description": "Whether the authenticated user owns the file.", "jsonSchema": { "type": "boolean", "description": "Whether the authenticated user owns the file." }, "nullable": true, "handle": "ownedByMe" }, { "description": "The projected Drive capabilities for the authenticated user.", "jsonSchema": { "type": "object", "properties": { "canShare": { "type": "boolean", "description": "Whether the authenticated user may modify sharing settings." } }, "required": [ "canShare" ], "additionalProperties": false, "description": "The projected Drive capabilities for the authenticated user." }, "nullable": true, "handle": "capabilities" } ], "name": "Upload to Google Drive", "executor": { "kind": "connector", "action": "googledrive.files.create" } } }, "n_aa42f2c02ee23f70": { "inputs": { "id": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4687f5d57b99d1ec", "output": "id" } ] }, "webViewLink": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4687f5d57b99d1ec", "output": "webViewLink" } ] } }, "name": "Confirm Drive link", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "description": "The unique identifier of the file." }, "nullable": false, "handle": "id" }, { "jsonSchema": { "type": [ "string", "null" ], "description": "A link for opening the file in a relevant Google editor or viewer in a browser." }, "nullable": true, "handle": "webViewLink" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "link" } ], "name": "Confirm Drive link", "moduleId": "n_e65ccda3fbf687d4", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_7cf115ad40306ee9": { "inputs": { "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "messageId" } ] }, "removeLabelIds": { "kind": "value", "value": [ "UNREAD" ] } }, "name": "Mark invoice as read", "kind": "task", "task": { "inputs": [ { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "description": "Gmail user ID. Omit to use the connected mailbox.", "jsonSchema": { "type": "string", "description": "Gmail user ID. Omit to use the connected mailbox." }, "nullable": true, "handle": "userId", "value": null }, { "description": "Label IDs to add.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs to add." }, "nullable": true, "handle": "addLabelIds", "value": null }, { "description": "Label IDs to remove.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs to remove." }, "nullable": true, "handle": "removeLabelIds", "value": null } ], "outputs": [ { "description": "The message history ID.", "jsonSchema": { "type": "string", "description": "The message history ID." }, "nullable": true, "handle": "historyId" }, { "description": "The internal timestamp in milliseconds.", "jsonSchema": { "type": "string", "description": "The internal timestamp in milliseconds." }, "nullable": true, "handle": "internalDate" }, { "description": "The estimated message size in bytes.", "jsonSchema": { "type": "integer", "description": "The estimated message size in bytes." }, "nullable": true, "handle": "sizeEstimate" }, { "description": "The message snippet.", "jsonSchema": { "type": "string", "description": "The message snippet." }, "nullable": true, "handle": "snippet" }, { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "description": "Gmail thread ID.", "jsonSchema": { "type": "string", "description": "Gmail thread ID." }, "nullable": false, "handle": "threadId" }, { "description": "Label IDs applied to the message.", "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs applied to the message." }, "nullable": false, "handle": "labelIds" }, { "description": "Normalized message subject line.", "jsonSchema": { "type": "string", "description": "Normalized message subject line." }, "nullable": false, "handle": "subject" }, { "description": "Normalized sender value.", "jsonSchema": { "type": "string", "description": "Normalized sender value." }, "nullable": false, "handle": "sender" }, { "description": "Normalized To header value.", "jsonSchema": { "type": "string", "description": "Normalized To header value." }, "nullable": false, "handle": "to" }, { "description": "Short preview of the message subject and body.", "jsonSchema": { "type": "object", "properties": { "subject": { "type": "string", "description": "Preview subject extracted from the message." }, "body": { "type": "string", "description": "Preview body text extracted from the message." } }, "required": [ "subject", "body" ], "additionalProperties": false, "description": "Short preview of the message subject and body." }, "nullable": false, "handle": "preview" }, { "description": "Raw Gmail payload object, or null when it was not included.", "jsonSchema": { "type": [ "object", "null" ], "additionalProperties": { "description": "A record value." }, "description": "Raw Gmail payload object, or null when it was not included." }, "nullable": true, "handle": "payload" }, { "description": "Best-effort plain-text representation of the message body.", "jsonSchema": { "type": "string", "description": "Best-effort plain-text representation of the message body." }, "nullable": false, "handle": "messageText" }, { "description": "Normalized attachment summaries.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "attachmentId": { "type": [ "string", "null" ], "description": "Attachment ID, or null when Gmail inlines the body." }, "filename": { "type": "string", "description": "Attachment filename." }, "mimeType": { "type": "string", "description": "Attachment MIME type." }, "size": { "type": "integer", "description": "Attachment size in bytes." }, "partId": { "type": [ "string", "null" ], "description": "Gmail MIME part ID, when supplied." }, "contentId": { "type": [ "string", "null" ], "description": "Bare Content-ID, when supplied." }, "disposition": { "type": [ "string", "null" ], "enum": [ "inline", "attachment", null ], "description": "Content-Disposition, when supplied." } }, "required": [ "attachmentId", "filename", "mimeType", "size", "partId", "contentId", "disposition" ], "additionalProperties": false, "description": "Schema for gmailAttachmentSchema." }, "description": "Normalized attachment summaries." }, "nullable": false, "handle": "attachmentList" }, { "description": "Message timestamp returned by Gmail.", "jsonSchema": { "type": "string", "description": "Message timestamp returned by Gmail." }, "nullable": false, "handle": "messageTimestamp" }, { "description": "Raw RFC 2822 message content when Gmail returns it.", "jsonSchema": { "type": "string", "description": "Raw RFC 2822 message content when Gmail returns it." }, "nullable": true, "handle": "raw" } ], "name": "Mark invoice as read", "executor": { "kind": "connector", "action": "gmail.add_label_to_email" } } }, "n_9bfb479993b7e80f": { "inputs": { "expectedId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "messageId" } ] }, "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7cf115ad40306ee9", "output": "messageId" } ] }, "labelIds": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_7cf115ad40306ee9", "output": "labelIds" } ] } }, "name": "Confirm the email is read", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "expectedId" }, { "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" }, { "jsonSchema": { "type": "array", "items": { "type": "string", "description": "An array item." }, "description": "Label IDs applied to the message." }, "nullable": false, "handle": "labelIds" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "ok" } ], "name": "Confirm the email is read", "moduleId": "n_adc07f64a9f28fed", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_abcfae7e8c74abee": { "inputs": { "channelId": { "kind": "value", "value": "YOUR_SLACK_CHANNEL_ID" }, "text": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_93e99a7fd0f47b2f", "output": "name" } ] } }, "name": "Notify Slack", "kind": "task", "task": { "inputs": [ { "description": "The Slack conversation or channel ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The Slack conversation or channel ID." }, "nullable": false, "handle": "channelId" }, { "description": "Plain text message content. When blocks are provided, Slack uses this as notification and accessibility fallback text.", "jsonSchema": { "type": "string", "description": "Plain text message content. When blocks are provided, Slack uses this as notification and accessibility fallback text." }, "nullable": true, "handle": "text", "value": null }, { "description": "Slack Block Kit blocks to render in the message.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Slack Block Kit block object. Pass the block exactly as Slack documents it." }, "minItems": 1, "description": "Slack Block Kit blocks to render in the message." }, "nullable": true, "handle": "blocks", "value": null }, { "description": "Slack legacy attachments to include in the message.", "jsonSchema": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true, "description": "A Slack legacy attachment object. Prefer blocks for new messages when possible." }, "minItems": 1, "description": "Slack legacy attachments to include in the message." }, "nullable": true, "handle": "attachments", "value": null }, { "description": "Whether Slack should unfurl links in the message.", "jsonSchema": { "type": "boolean", "description": "Whether Slack should unfurl links in the message." }, "nullable": true, "handle": "unfurlLinks", "value": null }, { "description": "Whether Slack should unfurl media in the message.", "jsonSchema": { "type": "boolean", "description": "Whether Slack should unfurl media in the message." }, "nullable": true, "handle": "unfurlMedia", "value": null }, { "description": "Slack message metadata to attach to the message.", "jsonSchema": { "type": "object", "properties": {}, "additionalProperties": true, "description": "Slack message metadata to attach to the message." }, "nullable": true, "handle": "metadata", "value": null } ], "outputs": [ { "description": "The timestamp identifier of the posted message.", "jsonSchema": { "type": "string", "description": "The timestamp identifier of the posted message." }, "nullable": false, "handle": "ts" }, { "description": "The channel ID where the message was posted.", "jsonSchema": { "type": "string", "description": "The channel ID where the message was posted." }, "nullable": false, "handle": "channelId" } ], "name": "Notify Slack", "executor": { "kind": "connector", "action": "slack.post_message" } } } }, "edges": [ { "source": "n_cac02c44ded4aae7", "target": "n_7f8c3727aee661ff" }, { "source": "n_f2ef3215c9999868", "target": "n_7f8c3727aee661ff" }, { "source": "n_7f8c3727aee661ff", "target": "n_5ef31931fa5194db" }, { "source": "n_5ef31931fa5194db", "target": "n_7f8c3727aee661ff", "sourceHandle": "read" }, { "source": "n_5ef31931fa5194db", "target": "n_82a1c9b81d75670a", "sourceHandle": "otherwise" }, { "source": "n_82a1c9b81d75670a", "target": "n_247c40e677f6a495" }, { "source": "n_247c40e677f6a495", "target": "n_2706ad301c3b51c6", "sourceHandle": "read" }, { "source": "n_2706ad301c3b51c6", "target": "n_82a1c9b81d75670a" }, { "source": "n_247c40e677f6a495", "target": "n_c39b5e21cd6b5e5d", "sourceHandle": "otherwise" }, { "source": "n_c39b5e21cd6b5e5d", "target": "n_7e3610a7172a1160" }, { "source": "n_7e3610a7172a1160", "target": "n_056d35ab6864c726", "sourceHandle": "read" }, { "source": "n_056d35ab6864c726", "target": "n_f9b87eb448df6ebc" }, { "source": "n_f9b87eb448df6ebc", "target": "n_606148a4614b1562" }, { "source": "n_606148a4614b1562", "target": "n_c532a717a76e261c", "sourceHandle": "download" }, { "source": "n_606148a4614b1562", "target": "n_a9a1559e3d47f46a", "sourceHandle": "otherwise" }, { "source": "n_c532a717a76e261c", "target": "n_a9a1559e3d47f46a" }, { "source": "n_a9a1559e3d47f46a", "target": "n_c39b5e21cd6b5e5d" }, { "source": "n_7e3610a7172a1160", "target": "n_93e99a7fd0f47b2f", "sourceHandle": "otherwise" }, { "source": "n_93e99a7fd0f47b2f", "target": "n_df35612d3b2af1ef" }, { "source": "n_df35612d3b2af1ef", "target": "n_4687f5d57b99d1ec", "sourceHandle": "upload" }, { "source": "n_4687f5d57b99d1ec", "target": "n_aa42f2c02ee23f70" }, { "source": "n_aa42f2c02ee23f70", "target": "n_7cf115ad40306ee9" }, { "source": "n_7cf115ad40306ee9", "target": "n_9bfb479993b7e80f" }, { "source": "n_9bfb479993b7e80f", "target": "n_abcfae7e8c74abee" }, { "source": "n_abcfae7e8c74abee", "target": "n_93e99a7fd0f47b2f" } ] } }, "modules": { "n_479dacae36732652": { "name": "Find year and month folders", "imports": [], "source": "export default async function folder({root,previous},context){if(typeof root!=='string'||!root||root.startsWith('YOUR_'))throw Error('Configure the parent Drive folder');const now=new Date(),year=String(now.getUTCFullYear()),month=String(now.getUTCMonth()+1).padStart(2,'0');let s=previous??{phase:'year',parent:root,token:null,seen:[],found:null,year,month};if(!['year','month'].includes(s.phase)||!s.parent)throw Error('Invalid folder state');const name=s.phase==='year'?s.year:s.month,esc=x=>x.replace(/\\\\/g,'\\\\\\\\').replace(/'/g,\"\\\\'\");const q=`mimeType = 'application/vnd.google-apps.folder' and trashed = false and name = '${esc(name)}' and '${esc(s.parent)}' in parents`;const p=await context.actions.call('googledrive.files.list',{q,pageSize:1000,...(s.token?{pageToken:s.token}:{})});if(!Array.isArray(p.files))throw Error('Invalid folder results');let found=s.found;for(const f of p.files){if(!f.id||f.name!==name||f.mimeType!=='application/vnd.google-apps.folder'||found)throw Error('Ambiguous folder');found=f.id}const t=p.nextPageToken;if(t!==null&&(typeof t!=='string'||!t||s.seen.includes(t)))throw Error('Invalid folder cursor');if(t)return{state:{...s,token:t,found,seen:[...s.seen,t]},more:true,folderId:''};if(!found)throw Error('Required year or month folder not found');if(s.phase==='year')return{state:{...s,phase:'month',parent:found,found:null,token:null,seen:[]},more:true,folderId:''};return{state:s,more:false,folderId:found}}\n" }, "n_950371d09652ea03": { "name": "Collect unread invoice IDs", "imports": [], "source": "export default function pages({previous,messages,nextPageToken}){let s=previous??{ids:[],cursors:[],pages:0};if(messages!=null){if(!Array.isArray(messages)||messages.some(m=>typeof m?.messageId!=='string'||!m.messageId))throw Error('Invalid Gmail page');const ids=[...s.ids,...messages.map(x=>x.messageId)];if(new Set(ids).size!==ids.length||ids.length>5000)throw Error('Duplicate or excessive Gmail results');if(nextPageToken!==null&&typeof nextPageToken!=='string')throw Error('Invalid Gmail cursor');if(nextPageToken&&s.cursors.includes(nextPageToken))throw Error('Repeated Gmail cursor');s={ids,cursors:nextPageToken?[...s.cursors,nextPageToken]:s.cursors,pages:s.pages+1};if(s.pages>=100&&nextPageToken)throw Error('Gmail page limit reached');return{state:s,more:!!nextPageToken,pageToken:nextPageToken||null,ids:s.ids}}return{state:s,more:true,pageToken:null,ids:s.ids}}\n" }, "n_87d216207e4db1b9": { "name": "Prepare the next email", "imports": [], "source": "export default function next({ids,previous,attachment}){if(!Array.isArray(ids)||ids.length>5000||ids.some(x=>typeof x!=='string'||!x)||new Set(ids).size!==ids.length)throw Error('Invalid messages');let s=previous??{index:0,files:[]};if(attachment!=null){if(s.index>=ids.length||attachment.messageId!==ids[s.index])throw Error('Message association failed');s={index:s.index+1,files:[...s.files,attachment]}}if(s.index>ids.length||s.files.length!==s.index)throw Error('Invalid progress');return{state:s,more:s.index52428800||typeof a.filename!=='string')throw Error('Invalid attachment');let inline='';if(!a.attachmentId){const found=[];const walk=p=>{if(!p||typeof p!=='object')return;if(p.partId===a.partId&&typeof p.body?.data==='string')found.push(p.body.data);for(const c of p.parts||[])walk(c)};if(a.partId==null)throw Error('Missing part ID');walk(payload);if(found.length!==1)throw Error('Missing or ambiguous inline part');inline=found[0]}return{missing:false,remote:!!a.attachmentId,attachmentId:a.attachmentId||'',filename:a.filename,mimeType:a.mimeType||'application/octet-stream',size:a.size,inline}}\n" }, "n_118626f9b78650c4": { "name": "Check attachment bytes", "imports": [], "source": "import{Buffer}from'node:buffer';\nexport default async function stage({missing,remote,inline,transitUrl,size,messageId,attachmentId,downloadedMessageId,downloadedAttachmentId,downloadedSize,filename,mimeType},context){if(missing)return{attachment:{messageId,missing:true}};let bytes;if(remote){if(downloadedMessageId!==messageId||downloadedAttachmentId!==attachmentId||downloadedSize!==size||typeof transitUrl!=='string'||!/^https:\\/\\//.test(transitUrl))throw Error('Attachment association failed');const r=await context.fetch(transitUrl,{method:'GET'});if(!r.ok)throw Error('Attachment download failed');bytes=Buffer.from(await r.arrayBuffer())}else{if(typeof inline!=='string'||!/^[A-Za-z0-9_-]*={0,2}$/.test(inline))throw Error('Invalid inline content');const s=inline.replace(/-/g,'+').replace(/_/g,'/').replace(/=+$/,'');bytes=Buffer.from(s,'base64');if(bytes.toString('base64').replace(/=+$/,'')!==s)throw Error('Invalid base64')}if(bytes.length!==size)throw Error('Incomplete attachment');return{attachment:{messageId,missing:false,filename,mimeType,contentBase64:bytes.length?bytes.toString('base64'):null}}}\n" }, "n_3b5be1d573bb5966": { "name": "Prepare the next file", "imports": [], "source": "export default function next({files,previous,folderId}){if(!Array.isArray(files))throw Error('Invalid files');const i=previous==null?0:previous.index+1;if(!Number.isInteger(i)||i<0||i>files.length)throw Error('Invalid progress');const f=files[i];if(f?.missing)throw Error('Message has no first attachment');if(f&&(!folderId||!f.messageId))throw Error('Missing folder or message');return{state:{index:i},more:!!f,messageId:f?.messageId||'',name:f?`Orlen ${f.filename||'attachment'}`:'attachment',mimeType:f?.mimeType||'application/octet-stream',contentBase64:f?.contentBase64??null,parents:[folderId]}}\n" }, "n_e65ccda3fbf687d4": { "name": "Confirm Drive link", "imports": [], "source": "export default function receipt({id,webViewLink}){if(!id)throw Error('Drive did not return a file ID');return {link:webViewLink ?? null}}" }, "n_adc07f64a9f28fed": { "name": "Confirm the email is read", "imports": [], "source": "export default function confirm({expectedId,messageId,labelIds}){if(messageId!==expectedId||!Array.isArray(labelIds)||labelIds.includes('UNREAD'))throw Error('Gmail did not confirm mark as read');return {ok:true}}" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }