{
  "kind": "open-flow-workflow",
  "version": 1,
  "name": "Gmail: New Message Received",
  "content": {
    "modelVersion": 14,
    "document": {
      "bindings": {},
      "graph": {
        "nodes": {
          "inbox": {
            "name": "New inbox messages",
            "kind": "poll",
            "connectionId": "docs-example-gmail",
            "config": {},
            "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": "every",
                "unit": "minute",
                "value": 5
              }
            ]
          },
          "process": {
            "inputs": {},
            "name": "Process new messages",
            "kind": "task",
            "task": {
              "inputs": [],
              "outputs": [
                {
                  "jsonSchema": {
                    "type": "string"
                  },
                  "nullable": false,
                  "handle": "message"
                }
              ],
              "name": "Process new messages",
              "moduleId": "process-module",
              "capabilities": [
                {
                  "kind": "connector",
                  "mode": "independent",
                  "actions": []
                }
              ]
            }
          }
        },
        "edges": [
          {
            "source": "inbox",
            "target": "process"
          }
        ]
      }
    },
    "modules": {
      "process-module": {
        "name": "Process new messages",
        "imports": [],
        "source": "export default () => ({ message: \"New messages are ready for processing\" });"
      }
    }
  },
  "presentation": {
    "designer": {
      "version": 1,
      "flow": {
        "nodes": {
          "inbox": {
            "x": 0,
            "y": 0
          },
          "process": {
            "x": 340,
            "y": 0
          }
        }
      }
    }
  }
}
