{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "D7C9BE5B-9351-49E3-967A-8269DA4EE9F0",
    "name": "Dovetail: weekly digest of new research docs"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -69.45273631840796,
        "y": -178.90547263681592,
        "zoom": 1
      },
      "autoSave": false,
      "descriptions": {
        "flow": "On its weekly schedule, lists the Dovetail docs created in the last seven days. Each one is exported as Markdown and published as a page in the research wiki in Notion, with a link back to the doc in Dovetail. Then one message goes to the product channel in Slack with every title and its wiki link. A week with no new docs gets a short note in the channel instead.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "On its weekly schedule, lists the Dovetail docs created in the last seven days, exports each as Markdown and publishes it to the research wiki in Notion, then posts one digest with the titles and wiki links to the product channel in Slack. A week with no new docs is announced too.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Returns a doc's content body as Markdown or HTML.",
          "elementId": "EXTENSION:::SHARED:::default:::dovetail:::exportDoc",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Export the doc as Markdown Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::dovetail:::exportDoc",
          "legacyElementId": null,
          "methodName": "exportDoc",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "0490214A-DE65-49D2-854A-FB3566BE90C9",
        "groupId": "444084B7-0D02-4FFC-869A-86BB6163409F",
        "id": "3303D009-425A-4B04-AF81-80EA5C5CB67E",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "projectId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "docId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "444084B7-0D02-4FFC-869A-86BB6163409F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "format",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "markdown"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "includeFileContent",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "exportDoc",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Doc export",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "dovetail",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Export the doc as Markdown",
        "nextElementIds": [
          "4EBD7CFD-02F8-4000-9ADC-C63070776728"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": true,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "links"
          },
          "position": {
            "x": 1243,
            "y": 49
          }
        },
        "flowElementId": "993E00C1-74C8-4143-843D-CDA04BFD6214",
        "groupId": "444084B7-0D02-4FFC-869A-86BB6163409F",
        "id": "1A8C124F-6A88-4ECE-86CE-2E817A07CAFA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "links",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - links",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.links",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "links",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "title",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "title",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "444084B7-0D02-4FFC-869A-86BB6163409F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "wikiUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Wiki page",
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "AC4D9496-7D29-4072-AB93-EB9D2B504450"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dovetailUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "444084B7-0D02-4FFC-869A-86BB6163409F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = Array.isArray(links) ? links.slice() : [];\nlist.push({ title: String(title || 'Untitled doc'), url: wikiUrl, dovetailUrl });\nreturn list;"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Digest links",
          "retryPolicy": null,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "links"
          },
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Add the wiki link to the digest",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Post the digest to the product channel Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 414,
            "y": 520
          }
        },
        "flowElementId": "44A1A76D-6CFB-44A5-8ECB-942DB7618ED7",
        "groupId": null,
        "id": "F5133A02-BC0F-4907-88EE-63B6319BCBC7",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Digest",
                    "subPathSegments": [
                      {
                        "key": "text",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6EDA5E72-D58C-4AFC-8919-A9A99F531687"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Digest",
                    "subPathSegments": [
                      {
                        "key": "blocks",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "6EDA5E72-D58C-4AFC-8919-A9A99F531687"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Digest post",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Post the digest to the product channel",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Turn the doc into Notion blocks Result"
          },
          "position": {
            "x": 465,
            "y": 49
          }
        },
        "flowElementId": "6F44CB86-07C4-4CB5-BD48-A69ACBA6D859",
        "groupId": "444084B7-0D02-4FFC-869A-86BB6163409F",
        "id": "4EBD7CFD-02F8-4000-9ADC-C63070776728",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "title",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "title",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "444084B7-0D02-4FFC-869A-86BB6163409F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "markdown",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Doc export",
                    "subPathSegments": [
                      {
                        "key": "data",
                        "optional": false
                      },
                      {
                        "key": "content_markdown",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "3303D009-425A-4B04-AF81-80EA5C5CB67E"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "dovetailUrl",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "url",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "444084B7-0D02-4FFC-869A-86BB6163409F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const MAX = 2000;\nconst clean = s => String(s || '').replace(/\\*\\*(.*?)\\*\\*/g, '$1').replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1');\nconst rt = s => {\n  const out = [];\n  let t = clean(s);\n  while (t.length) { out.push({ type: 'text', text: { content: t.slice(0, MAX) } }); t = t.slice(MAX); }\n  return out.length ? out : [{ type: 'text', text: { content: ' ' } }];\n};\nconst blocks = [];\nlet para = [];\nconst flush = () => {\n  if (para.length) { blocks.push({ object: 'block', type: 'paragraph', paragraph: { rich_text: rt(para.join(' ')) } }); para = []; }\n};\nfor (const raw of String(markdown || '').split(/\\r?\\n/)) {\n  const line = raw.trimEnd();\n  let m;\n  if (!line.trim()) { flush(); continue; }\n  if ((m = line.match(/^(#{1,3})\\s+(.*)$/))) { flush(); const type = `heading_${m[1].length}`; blocks.push({ object: 'block', type, [type]: { rich_text: rt(m[2]) } }); continue; }\n  if ((m = line.match(/^#{4,6}\\s+(.*)$/))) { flush(); blocks.push({ object: 'block', type: 'heading_3', heading_3: { rich_text: rt(m[1]) } }); continue; }\n  if ((m = line.match(/^\\s*[-*]\\s+(.*)$/))) { flush(); blocks.push({ object: 'block', type: 'bulleted_list_item', bulleted_list_item: { rich_text: rt(m[1]) } }); continue; }\n  if ((m = line.match(/^\\s*\\d+[.)]\\s+(.*)$/))) { flush(); blocks.push({ object: 'block', type: 'numbered_list_item', numbered_list_item: { rich_text: rt(m[1]) } }); continue; }\n  if ((m = line.match(/^>\\s?(.*)$/))) { flush(); blocks.push({ object: 'block', type: 'quote', quote: { rich_text: rt(m[1]) } }); continue; }\n  para.push(line.trim());\n}\nflush();\nconst sourceLine = { object: 'block', type: 'paragraph', paragraph: { rich_text: [{ type: 'text', text: { content: 'Source: this doc in Dovetail', link: { url: dovetailUrl } } }] } };\nlet children = [sourceLine, ...blocks];\nif (children.length > 100) {\n  children = children.slice(0, 99);\n  children.push({ object: 'block', type: 'paragraph', paragraph: { rich_text: [{ type: 'text', text: { content: 'The doc continues in Dovetail.', link: { url: dovetailUrl } } }] } });\n}\nreturn {\n  properties: { title: { title: [{ type: 'text', text: { content: String(title || 'Untitled doc').slice(0, MAX) } }] } },\n  children,\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Notion page content",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Turn the doc into Notion blocks",
        "nextElementIds": [
          "AC4D9496-7D29-4072-AB93-EB9D2B504450"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends messages to Slack channels with optional Block Kit rich layouts. Supports plain text with Slack formatting, or advanced Block Kit JSON for buttons, menus, and interactive elements. Returns the message timestamp and channel ID for later updates or tracking.",
          "elementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Say the week had no new docs Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::slack:::sendMessageToChannel",
          "legacyElementId": "JS###v1###Slack###sendMessageToChannel",
          "methodName": "sendMessageToChannel",
          "position": {
            "x": 1167,
            "y": 220
          }
        },
        "flowElementId": "4EE067CC-4485-400B-8CB4-4EDD8BBFF343",
        "groupId": null,
        "id": "62DC44C9-C81F-491A-9C2C-FB23B904F516",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "channelId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "messageText",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "No new research docs in Dovetail, "
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Week",
                    "subPathSegments": [
                      {
                        "key": "label",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BEB86DB5-B1AC-4C91-8F7A-3894539FC404"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": ". Nothing was added to the wiki this week."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "threadId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sendAsBot",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botName",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "botIcon",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyBroadcast",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "imageURL",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "blocks",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessageToChannel",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Quiet week note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "slack",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Say the week had no new docs",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Write the digest Result"
          },
          "position": {
            "x": 851,
            "y": 529
          }
        },
        "flowElementId": "C09D0DAB-4B9F-4E82-8CEF-C759F03AE2DF",
        "groupId": null,
        "id": "6EDA5E72-D58C-4AFC-8919-A9A99F531687",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "links",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - links",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.links",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "links",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "weekLabel",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Week",
                    "subPathSegments": [
                      {
                        "key": "label",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BEB86DB5-B1AC-4C91-8F7A-3894539FC404"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const items = Array.isArray(links) ? links : [];\nconst n = items.length;\nconst headline = `${n} new research doc${n === 1 ? '' : 's'} in Dovetail, ${weekLabel}`;\nconst lines = items.map((d, i) => `${i + 1}. <${d.url}|${d.title}> (<${d.dovetailUrl}|in Dovetail>)`);\nconst sections = [];\nlet chunk = [];\nlet size = 0;\nfor (const line of lines) {\n  if (size + line.length + 1 > 2800 && chunk.length) { sections.push(chunk.join('\\n')); chunk = []; size = 0; }\n  chunk.push(line);\n  size += line.length + 1;\n}\nif (chunk.length) sections.push(chunk.join('\\n'));\nreturn {\n  text: headline,\n  blocks: [\n    { type: 'section', text: { type: 'mrkdwn', text: `*${headline}*\\nPublished to the research wiki:` } },\n    ...sections.map(text => ({ type: 'section', text: { type: 'mrkdwn', text } })),\n  ],\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Digest",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Write the digest",
        "nextElementIds": [
          "F5133A02-BC0F-4907-88EE-63B6319BCBC7"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Lists docs (research reports and write-ups), one page at a time, with their metadata. Use Export Doc to read a doc's content.",
          "elementId": "EXTENSION:::SHARED:::default:::dovetail:::listDocs",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "List the week's new docs Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::dovetail:::listDocs",
          "legacyElementId": null,
          "methodName": "listDocs",
          "position": {
            "x": 459,
            "y": 350
          }
        },
        "flowElementId": "3632E377-EBDA-4110-BA69-CC8367C8269A",
        "groupId": null,
        "id": "24EAAECE-9129-4A03-817F-245955FFBEA0",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "projectId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "folderId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "titleContains",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "createdAfter",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Week",
                    "subPathSegments": [
                      {
                        "key": "since",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "BEB86DB5-B1AC-4C91-8F7A-3894539FC404"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "createdBefore",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sort",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "created_at:asc"
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "limit",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 100
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listDocs",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New docs",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "dovetail",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "List the week's new docs",
        "nextElementIds": [
          "B67B80B5-61F0-47F1-9803-D48040C869CD"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a new page in Notion as a child of an existing page. Supports rich content blocks including text, headings, lists, and embeds. The page properties and content can be formatted with Notion's rich text capabilities for comprehensive page creation.",
          "elementId": "EXTENSION:::SHARED:::default:::notion:::createPage",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Publish the doc to the research wiki Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::notion:::createPage",
          "legacyElementId": "JS###v1###Notion###createPage",
          "methodName": "createPage",
          "position": {
            "x": 840,
            "y": 40
          }
        },
        "flowElementId": "B991D3C5-1D86-4B05-A087-29AF336533EE",
        "groupId": "444084B7-0D02-4FFC-869A-86BB6163409F",
        "id": "AC4D9496-7D29-4072-AB93-EB9D2B504450",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "pageId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Research wiki page",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Research wiki page"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "properties",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Notion page content",
                    "subPathSegments": [
                      {
                        "key": "properties",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4EBD7CFD-02F8-4000-9ADC-C63070776728"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "children",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Notion page content",
                    "subPathSegments": [
                      {
                        "key": "children",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4EBD7CFD-02F8-4000-9ADC-C63070776728"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Publish the doc to the research wiki', Error: The placeholder \"Research wiki page\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createPage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Wiki page",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "notion",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Publish the doc to the research wiki",
        "nextElementIds": [
          "1A8C124F-6A88-4ECE-86CE-2E817A07CAFA"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 835,
            "y": 359
          }
        },
        "flowElementId": "8E633098-4797-4F94-836F-BE94A218DBCD",
        "groupId": null,
        "id": "B67B80B5-61F0-47F1-9803-D48040C869CD",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "c6f1142e-d129-4ad9-b0d1-67be935edf5c",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "New docs",
                      "subPathSegments": [
                        {
                          "key": "page",
                          "optional": false
                        },
                        {
                          "key": "total_count",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "24EAAECE-9129-4A03-817F-245955FFBEA0"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "c6f1142e-d129-4ad9-b0d1-67be935edf5c"
            ]
          },
          "elseComponent": {
            "componentId": "62DC44C9-C81F-491A-9C2C-FB23B904F516",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Any new docs",
          "storeResult": false,
          "thenComponent": {
            "componentId": "BF030BDF-92C2-4E82-B4C6-7FA90C418695",
            "componentType": "ELEMENT"
          }
        },
        "name": "Any new docs this week?",
        "nextElementIds": [
          "62DC44C9-C81F-491A-9C2C-FB23B904F516",
          "BF030BDF-92C2-4E82-B4C6-7FA90C418695"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "links": "acd4c9cf-e0a2-4c24-ae42-4d2c97db4978"
          },
          "position": {
            "x": 1188,
            "y": 359
          }
        },
        "flowElementId": "A6A82B9F-1D5B-4201-9F06-4FC9F22A9D14",
        "groupId": null,
        "id": "BF030BDF-92C2-4E82-B4C6-7FA90C418695",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "links",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_LIST",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "arrays.create()"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Wiki links",
          "storeResult": true
        },
        "name": "Start the list of wiki links",
        "nextElementIds": [],
        "nextGroupIds": [
          "444084B7-0D02-4FFC-869A-86BB6163409F"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": true,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Set the week's dates Result"
          },
          "position": {
            "x": 110,
            "y": 359
          }
        },
        "flowElementId": "84E87EEA-3E83-45FD-AFAD-110ED77EA99D",
        "groupId": null,
        "id": "BEB86DB5-B1AC-4C91-8F7A-3894539FC404",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "days",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Days to look back",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Days to look back"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const n = Number(days) > 0 ? Number(days) : 7;\nconst now = new Date();\nconst since = new Date(now.getTime() - n * 86400000);\nconst fmt = d => d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' });\nreturn {\n  since: since.toISOString(),\n  label: `${fmt(since)} to ${fmt(now)}, ${now.getUTCFullYear()}`,\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Week",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Set the week's dates",
        "nextElementIds": [
          "24EAAECE-9129-4A03-817F-245955FFBEA0"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "BEB86DB5-B1AC-4C91-8F7A-3894539FC404",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -64.40677966101696,
            "y": 2.0338983050847474,
            "zoom": 0.95
          },
          "position": {
            "x": 1202,
            "y": 529
          }
        },
        "flowElementId": "1F666B46-38DF-4FEA-96FF-A47341598E4F",
        "groupId": null,
        "id": "444084B7-0D02-4FFC-869A-86BB6163409F",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'For each new doc', Error: Children have error",
            "valid": false
          },
          "enabled": true,
          "firstElementId": "3303D009-425A-4B04-AF81-80EA5C5CB67E",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "New docs",
                "subPathSegments": [
                  {
                    "key": "data",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "24EAAECE-9129-4A03-817F-245955FFBEA0"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "Each new doc",
          "storeResult": true
        },
        "name": "For each new doc",
        "nextElementIds": [
          "6EDA5E72-D58C-4AFC-8919-A9A99F531687"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "43E4A58D-3684-4D9A-95A8-71FBE1D8E946",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
      "executionStaticData": [
        {
          "description": "The ID of the Notion page the research wiki lives under. Each new Dovetail doc becomes a page inside it.",
          "error": null,
          "name": "Research wiki page",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "How many days of new docs each digest covers. 7 for a weekly digest.",
          "error": null,
          "name": "Days to look back",
          "type": "INT",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-12-02T08:42:31.051Z"
}
