{ "kind": "open-flow-workflow", "version": 1, "name": "Send Uber Eats Receipts to Slack", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_175cc8da105d99f0": { "name": "Read matching receipts", "kind": "start", "inputDefs": [] }, "n_9aac6b8e7f3bd013": { "name": "New receipts at half past the hour", "kind": "poll", "config": { "labelNamesOrIds": { "kind": "value", "value": [] }, "readStatus": { "kind": "value", "value": "All" }, "search": { "kind": "value", "value": "subject:透過 Uber Eats 系統送出的訂單" }, "sender": { "kind": "value", "value": "" }, "includeDrafts": { "kind": "value", "value": false }, "includeSpamAndTrash": { "kind": "value", "value": false }, "maxMessagesPerPoll": { "kind": "value", "value": 100 } }, "definition": { "configInputs": [ { "description": "Only trigger on messages carrying all of these labels, referenced by name or ID.", "jsonSchema": { "type": "array", "items": { "type": "string", "minLength": 1 } }, "nullable": false, "handle": "labelNamesOrIds", "value": [] }, { "jsonSchema": { "type": "string", "enum": [ "Read", "Unread", "All" ] }, "nullable": false, "handle": "readStatus", "value": "All" }, { "description": "Gmail search-syntax query the message must match.", "jsonSchema": { "type": "string" }, "nullable": false, "handle": "search", "value": "" }, { "description": "Only trigger on messages whose sender matches this address or name.", "jsonSchema": { "type": "string" }, "nullable": false, "handle": "sender", "value": "" }, { "collapsed": true, "group": "Advanced settings" }, { "description": "Also trigger on draft messages.", "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "includeDrafts", "value": false }, { "description": "Also trigger on messages in SPAM and TRASH.", "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "includeSpamAndTrash", "value": false }, { "jsonSchema": { "type": "integer", "minimum": 1, "maximum": 100 }, "nullable": false, "handle": "maxMessagesPerPoll", "value": 25 } ], "definitionVersion": 2, "description": "Polls the Gmail mailbox and triggers when a new message is received.", "displayName": "New Message Received", "key": "gmail.on_message_received", "name": "on_message_received", "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "historyId": { "type": [ "string", "null" ] }, "labelIds": { "type": "array", "items": { "type": "string" } }, "messageId": { "type": "string" }, "messageTimestamp": { "type": "string" }, "sender": { "type": "string" }, "subject": { "type": "string" }, "threadId": { "type": "string" }, "to": { "type": "string" } }, "additionalProperties": false, "required": [ "messageId", "threadId", "historyId", "labelIds", "subject", "sender", "to", "messageTimestamp" ] } }, "nullable": false, "handle": "events" } ], "provider": "gmail", "type": "poll" }, "pollTimes": [ { "type": "cron", "expression": "30 * * * *", "timezone": "UTC" } ] }, "n_117bed1d62856c56": { "inputs": { "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_117bed1d62856c56", "output": "state" } ] }, "messages": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ff43c281fc28b31e", "output": "messages" } ] }, "nextPageToken": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_ff43c281fc28b31e", "output": "nextPageToken" } ] } }, "name": "Collect matching message 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" }, "nullable": false, "handle": "token" }, { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "records" } ], "name": "Collect matching message IDs", "moduleId": "n_9b8e095704d892eb", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_7125f0e445b9c5d1": { "inputs": {}, "name": "More Gmail pages?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_117bed1d62856c56", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_ff43c281fc28b31e": { "inputs": { "query": { "kind": "value", "value": "subject:透過 Uber Eats 系統送出的訂單" }, "maxResults": { "kind": "value", "value": 500 }, "detail": { "kind": "value", "value": "ids" }, "pageToken": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_117bed1d62856c56", "output": "token" } ] } }, "name": "Read matching Gmail IDs", "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": "Read matching Gmail IDs", "executor": { "kind": "connector", "action": "gmail.fetch_emails" } } }, "n_ced49db4fef77073": { "inputs": { "events": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_9aac6b8e7f3bd013", "output": "events" } ] } }, "name": "Collect new message IDs", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "properties": { "historyId": { "type": [ "string", "null" ] }, "labelIds": { "type": "array", "items": { "type": "string" } }, "messageId": { "type": "string" }, "messageTimestamp": { "type": "string" }, "sender": { "type": "string" }, "subject": { "type": "string" }, "threadId": { "type": "string" }, "to": { "type": "string" } }, "additionalProperties": false, "required": [ "messageId", "threadId", "historyId", "labelIds", "subject", "sender", "to", "messageTimestamp" ] } }, "nullable": false, "handle": "events" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "records" } ], "name": "Collect new message IDs", "moduleId": "n_ae7b602aed363668", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_85cb9e9140d58981": { "inputs": { "records": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_117bed1d62856c56", "output": "records" }, { "kind": "node", "nodeId": "n_ced49db4fef77073", "output": "records" } ] }, "previous": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_85cb9e9140d58981", "output": "state" } ] } }, "name": "Select the next receipt", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "nullable": false, "handle": "records" }, { "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 }, "nullable": false, "handle": "id" } ], "name": "Select the next receipt", "moduleId": "n_95c8cfc4dba1ac3d", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_9a973d16f331eeff": { "inputs": {}, "name": "More receipts?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_85cb9e9140d58981", "output": "more" } }, "operator": "isTrue" } ] } ] } ] }, "n_a503b4f6952f22ed": { "inputs": { "messageId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_85cb9e9140d58981", "output": "id" } ] } }, "name": "Read the receipt text", "kind": "task", "task": { "inputs": [ { "description": "Gmail message ID.", "jsonSchema": { "type": "string", "description": "Gmail message ID." }, "nullable": false, "handle": "messageId" } ], "outputs": [ { "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": "Normalized message subject line.", "jsonSchema": { "type": "string", "description": "Normalized message subject line." }, "nullable": false, "handle": "subject" }, { "description": "Normalized From header value.", "jsonSchema": { "type": "string", "description": "Normalized From header value." }, "nullable": false, "handle": "from" }, { "description": "Normalized To header value.", "jsonSchema": { "type": "string", "description": "Normalized To header value." }, "nullable": false, "handle": "to" }, { "description": "Message date string returned by Gmail.", "jsonSchema": { "type": "string", "description": "Message date string returned by Gmail." }, "nullable": false, "handle": "date" }, { "description": "Best-effort plain-text message body.", "jsonSchema": { "type": "string", "description": "Best-effort plain-text message body." }, "nullable": false, "handle": "body" } ], "name": "Read the receipt text", "executor": { "kind": "connector", "action": "gmail.get_message" } } }, "n_c842d67983233967": { "inputs": { "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_a503b4f6952f22ed", "output": "body" } ] } }, "name": "Extract receipt and prepare Slack message", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string", "description": "Best-effort plain-text message body." }, "nullable": false, "handle": "body" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "text" }, { "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" } ], "name": "Extract receipt and prepare Slack message", "moduleId": "n_10e78b3821cd60a3", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_31f21cfe5c207d89": { "inputs": { "channelId": { "kind": "value", "value": "YOUR_SLACK_CHANNEL_ID" }, "text": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c842d67983233967", "output": "text" } ] }, "blocks": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c842d67983233967", "output": "blocks" } ] } }, "name": "Send receipt to 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": "Send receipt to Slack", "executor": { "kind": "connector", "action": "slack.post_message" } } } }, "edges": [ { "source": "n_175cc8da105d99f0", "target": "n_117bed1d62856c56" }, { "source": "n_117bed1d62856c56", "target": "n_7125f0e445b9c5d1" }, { "source": "n_7125f0e445b9c5d1", "target": "n_ff43c281fc28b31e", "sourceHandle": "yes" }, { "source": "n_ff43c281fc28b31e", "target": "n_117bed1d62856c56" }, { "source": "n_7125f0e445b9c5d1", "target": "n_85cb9e9140d58981", "sourceHandle": "otherwise" }, { "source": "n_9aac6b8e7f3bd013", "target": "n_ced49db4fef77073" }, { "source": "n_ced49db4fef77073", "target": "n_85cb9e9140d58981" }, { "source": "n_85cb9e9140d58981", "target": "n_9a973d16f331eeff" }, { "source": "n_9a973d16f331eeff", "target": "n_a503b4f6952f22ed", "sourceHandle": "yes" }, { "source": "n_a503b4f6952f22ed", "target": "n_c842d67983233967" }, { "source": "n_c842d67983233967", "target": "n_31f21cfe5c207d89" }, { "source": "n_31f21cfe5c207d89", "target": "n_85cb9e9140d58981" } ] } }, "modules": { "n_9b8e095704d892eb": { "name": "Collect matching message IDs", "imports": [], "source": "export default function pages({previous,messages,nextPageToken}){const s=previous??{ids:[],tokens:[],awaiting:false};if(s.awaiting){if(!Array.isArray(messages))throw Error('Missing Gmail page');for(const m of messages){if(!m||typeof m.messageId!=='string')throw Error('Invalid Gmail message');s.ids.push({id:m.messageId})}if(nextPageToken){if(s.tokens.includes(nextPageToken))throw Error('Gmail pagination repeated');s.tokens.push(nextPageToken);s.token=nextPageToken}else{s.done=true} }if(s.done)return{state:s,more:false,token:'',records:s.ids};s.awaiting=true;return{state:s,more:true,token:s.token??'',records:s.ids};}\n" }, "n_ae7b602aed363668": { "name": "Collect new message IDs", "imports": [], "source": "export default function events({events}){if(!Array.isArray(events))throw Error('Invalid Gmail events');return{records:events.map(x=>{if(!x||typeof x.messageId!=='string')throw Error('Invalid Gmail event');return{id:x.messageId}})};}\n" }, "n_95c8cfc4dba1ac3d": { "name": "Select the next receipt", "imports": [], "source": "export default function next({records,previous}){const index=(previous?.index??-1)+1;return{state:{index},more:indexencodeURIComponent(k)+'='+encodeURIComponent(v)).join('&');const esc=x=>x.replaceAll('&','&').replaceAll('<','<').replaceAll('>','>');const text=`Ubereat 訂餐資訊:\\n商家: ${shop}\\n金額: ${amount}\\n日期: ${day}\\n記帳網址: ${link}`,blocks=[{type:'section',text:{type:'mrkdwn',text:`Ubereat 訂餐資訊:\\n\\n*商家:* ${esc(shop)}\\n*金額:* ${amount}\\n*日期:* ${day}`}},{type:'divider'},{type:'section',text:{type:'mrkdwn',text:'Moze 記帳請點我'},accessory:{type:'button',text:{type:'plain_text',text:'記帳'},value:'click',url:link,action_id:'button-action'}}];return{text,blocks};}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }