picked 0.0.101-next.2 → 0.0.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +27 -12
  2. package/docs/explanation/conditions-and-the-logic-engine.md +94 -0
  3. package/docs/explanation/content-references.md +99 -0
  4. package/docs/explanation/feature-flag-allocation.md +218 -0
  5. package/docs/explanation/how-picked-works.md +124 -0
  6. package/docs/explanation/how-pickedql-works.md +76 -0
  7. package/docs/explanation/pages-and-flows.md +64 -0
  8. package/docs/explanation/the-content-model.md +87 -0
  9. package/docs/explanation/the-two-apis.md +68 -0
  10. package/docs/explanation/why-server-side-rendering.md +76 -0
  11. package/docs/explanation/workspaces-and-versions.md +71 -0
  12. package/docs/how-to/add-a-step-field-or-action.md +56 -0
  13. package/docs/how-to/analytics/index.md +324 -0
  14. package/docs/how-to/archive-or-delete-a-workspace.md +59 -0
  15. package/docs/how-to/authenticate-the-cli.md +101 -0
  16. package/docs/how-to/authenticate-with-a-magic-link.md +56 -0
  17. package/docs/how-to/authenticate-with-a-password.md +68 -0
  18. package/docs/how-to/authenticate-with-an-api-key.md +60 -0
  19. package/docs/how-to/authenticate-with-oauth.md +49 -0
  20. package/docs/how-to/build-a-flow.md +106 -0
  21. package/docs/how-to/call-an-external-api-from-a-workflow.md +116 -0
  22. package/docs/how-to/connect-the-mcp-server.md +46 -0
  23. package/docs/how-to/create-a-content-entry.md +58 -0
  24. package/docs/how-to/create-a-project.md +40 -0
  25. package/docs/how-to/create-an-experience.md +51 -0
  26. package/docs/how-to/create-and-revoke-an-api-key.md +54 -0
  27. package/docs/how-to/debug-with-the-chrome-extension.md +57 -0
  28. package/docs/how-to/define-a-page-layout.md +54 -0
  29. package/docs/how-to/fill-and-publish-a-page.md +82 -0
  30. package/docs/how-to/install-the-gtm-template.md +84 -0
  31. package/docs/how-to/install-the-sdk.md +93 -0
  32. package/docs/how-to/install-the-vite-plugin.md +69 -0
  33. package/docs/how-to/invite-and-remove-members.md +45 -0
  34. package/docs/how-to/point-one-entry-at-another.md +75 -0
  35. package/docs/how-to/preview-a-workspace.md +39 -0
  36. package/docs/how-to/publish-a-workspace.md +42 -0
  37. package/docs/how-to/read-a-feature-flag.md +113 -0
  38. package/docs/how-to/read-a-referenced-entry.md +109 -0
  39. package/docs/how-to/register-a-component.md +55 -0
  40. package/docs/how-to/register-an-action-handler.md +85 -0
  41. package/docs/how-to/register-an-api-that-uses-oauth2.md +107 -0
  42. package/docs/how-to/render-a-step-form.md +131 -0
  43. package/docs/how-to/render-an-unpublished-preview.md +41 -0
  44. package/docs/how-to/retry-a-failed-call-with-a-loop.md +81 -0
  45. package/docs/how-to/reuse-a-section.md +64 -0
  46. package/docs/how-to/reuse-a-step-field-or-action.md +39 -0
  47. package/docs/how-to/roll-back-a-published-version.md +39 -0
  48. package/docs/how-to/run-an-ab-test.md +59 -0
  49. package/docs/how-to/run-code-on-a-form-submission.md +125 -0
  50. package/docs/how-to/server-render-a-page.md +81 -0
  51. package/docs/how-to/set-a-content-security-policy.md +32 -0
  52. package/docs/how-to/set-up-mfa.md +126 -0
  53. package/docs/how-to/switch-workspaces.md +122 -0
  54. package/docs/how-to/upload-and-use-an-asset.mdx +87 -0
  55. package/docs/how-to/validate-a-field.md +52 -0
  56. package/docs/how-to/wait-for-an-action-response.md +182 -0
  57. package/docs/how-to/write-a-condition.md +57 -0
  58. package/docs/how-to/write-a-predicate.md +60 -0
  59. package/docs/index.md +59 -0
  60. package/docs/reference/dashboard/actions.mdx +65 -0
  61. package/docs/reference/dashboard/api-keys.mdx +47 -0
  62. package/docs/reference/dashboard/conditions.mdx +51 -0
  63. package/docs/reference/dashboard/content/asset-library.mdx +74 -0
  64. package/docs/reference/dashboard/content/blocks.mdx +66 -0
  65. package/docs/reference/dashboard/content/content-entries.mdx +109 -0
  66. package/docs/reference/dashboard/content/models.mdx +119 -0
  67. package/docs/reference/dashboard/content/pages.mdx +72 -0
  68. package/docs/reference/dashboard/experiences.mdx +61 -0
  69. package/docs/reference/dashboard/external-apis.md +182 -0
  70. package/docs/reference/dashboard/features.mdx +165 -0
  71. package/docs/reference/dashboard/fields.mdx +120 -0
  72. package/docs/reference/dashboard/flow-builder/canvas.mdx +58 -0
  73. package/docs/reference/dashboard/flow-builder/condition-builder.md +69 -0
  74. package/docs/reference/dashboard/flow-builder/keyboard-shortcuts.md +72 -0
  75. package/docs/reference/dashboard/flow-builder/nodes.md +74 -0
  76. package/docs/reference/dashboard/labels.md +321 -0
  77. package/docs/reference/dashboard/lead-search.md +235 -0
  78. package/docs/reference/dashboard/projects.mdx +53 -0
  79. package/docs/reference/dashboard/reports.mdx +53 -0
  80. package/docs/reference/dashboard/steps.mdx +47 -0
  81. package/docs/reference/dashboard/team-management.md +38 -0
  82. package/docs/reference/dashboard/workflow-runs.md +157 -0
  83. package/docs/reference/dashboard/workflow-templates.md +182 -0
  84. package/docs/reference/dashboard/workflow-test-runs.md +85 -0
  85. package/docs/reference/dashboard/workspace-versioning.mdx +42 -0
  86. package/docs/reference/dashboard/workspaces.mdx +91 -0
  87. package/docs/reference/delivery-api/experience-content.md +152 -0
  88. package/docs/reference/delivery-api/index.md +45 -0
  89. package/docs/reference/delivery-api/preview-caching-crawling.md +79 -0
  90. package/docs/reference/delivery-api/project-config.md +65 -0
  91. package/docs/reference/delivery-api/workspace-schema.md +107 -0
  92. package/docs/reference/glossary.md +201 -0
  93. package/docs/reference/management-api/authentication.md +87 -0
  94. package/docs/reference/management-api/authorization-and-scopes.md +291 -0
  95. package/docs/reference/management-api/error-handling.md +232 -0
  96. package/docs/reference/management-api/pagination.md +192 -0
  97. package/docs/reference/management-api/schema/action.md +261 -0
  98. package/docs/reference/management-api/schema/analytics-session.md +363 -0
  99. package/docs/reference/management-api/schema/analytics.md +73 -0
  100. package/docs/reference/management-api/schema/api-key.md +170 -0
  101. package/docs/reference/management-api/schema/auth.md +1177 -0
  102. package/docs/reference/management-api/schema/cms-fields.md +954 -0
  103. package/docs/reference/management-api/schema/cms-models.md +1155 -0
  104. package/docs/reference/management-api/schema/common.md +362 -0
  105. package/docs/reference/management-api/schema/condition.md +254 -0
  106. package/docs/reference/management-api/schema/design-system.md +199 -0
  107. package/docs/reference/management-api/schema/experience.md +1098 -0
  108. package/docs/reference/management-api/schema/external-api.md +637 -0
  109. package/docs/reference/management-api/schema/feature.md +350 -0
  110. package/docs/reference/management-api/schema/feedback.md +103 -0
  111. package/docs/reference/management-api/schema/field.md +400 -0
  112. package/docs/reference/management-api/schema/index.md +243 -0
  113. package/docs/reference/management-api/schema/integration.md +272 -0
  114. package/docs/reference/management-api/schema/label.md +349 -0
  115. package/docs/reference/management-api/schema/lead.md +340 -0
  116. package/docs/reference/management-api/schema/mcp-server.md +299 -0
  117. package/docs/reference/management-api/schema/metric.md +223 -0
  118. package/docs/reference/management-api/schema/operation.md +96 -0
  119. package/docs/reference/management-api/schema/organization.md +749 -0
  120. package/docs/reference/management-api/schema/project.md +607 -0
  121. package/docs/reference/management-api/schema/report.md +243 -0
  122. package/docs/reference/management-api/schema/saved-view.md +288 -0
  123. package/docs/reference/management-api/schema/shopify.md +795 -0
  124. package/docs/reference/management-api/schema/step.md +273 -0
  125. package/docs/reference/management-api/schema/tenant-branding.md +185 -0
  126. package/docs/reference/management-api/schema/workbench.md +246 -0
  127. package/docs/reference/management-api/schema/workflow-run.md +263 -0
  128. package/docs/reference/management-api/schema/workflow.md +1110 -0
  129. package/docs/reference/management-api/schema/workspace-version.md +823 -0
  130. package/docs/reference/management-api/schema/workspace.md +917 -0
  131. package/docs/reference/pickedql/data-sources.md +174 -0
  132. package/docs/reference/pickedql/dimensions.md +103 -0
  133. package/docs/reference/pickedql/filtering.md +64 -0
  134. package/docs/reference/pickedql/index.md +18 -0
  135. package/docs/reference/pickedql/schema.md +172 -0
  136. package/docs/reference/pickedql/virtual-functions.md +248 -0
  137. package/docs/reference/sdk/actions.md +154 -0
  138. package/docs/reference/sdk/analytics-events.md +453 -0
  139. package/docs/reference/sdk/conditions.md +147 -0
  140. package/docs/reference/sdk/content-security-policy.md +21 -0
  141. package/docs/reference/sdk/content.md +253 -0
  142. package/docs/reference/sdk/experiences.md +51 -0
  143. package/docs/reference/sdk/features.md +256 -0
  144. package/docs/reference/sdk/fields.md +255 -0
  145. package/docs/reference/sdk/index.md +68 -0
  146. package/docs/reference/sdk/plugins/create-experience.md +123 -0
  147. package/docs/reference/sdk/plugins/dynamic-experiences.md +74 -0
  148. package/docs/reference/sdk/plugins/fingerprintjs.md +39 -0
  149. package/docs/reference/sdk/plugins/hotjar.md +60 -0
  150. package/docs/reference/sdk/plugins/index.md +33 -0
  151. package/docs/reference/sdk/plugins/sentry.md +51 -0
  152. package/docs/reference/sdk/plugins/shopify.md +109 -0
  153. package/docs/reference/sdk/plugins/window-object.md +25 -0
  154. package/docs/reference/sdk/predicates.md +43 -0
  155. package/docs/reference/sdk/react.md +61 -0
  156. package/docs/reference/sdk/ssr/index.md +33 -0
  157. package/docs/reference/sdk/ssr/rendering-and-hydration.md +103 -0
  158. package/docs/reference/sdk/ssr/serialize.md +80 -0
  159. package/docs/reference/sdk/ssr/slots-and-placements.md +113 -0
  160. package/docs/reference/sdk/steps.md +86 -0
  161. package/docs/reference/sdk/svelte.md +74 -0
  162. package/docs/reference/sdk/type-generation.md +265 -0
  163. package/docs/reference/tools/admin-api-client.md +89 -0
  164. package/docs/reference/tools/chrome-extension.md +16 -0
  165. package/docs/reference/tools/cli.md +319 -0
  166. package/docs/reference/tools/delivery-api-client.md +60 -0
  167. package/docs/reference/tools/image-optimisation-service.md +104 -0
  168. package/docs/reference/tools/mcp-run.md +121 -0
  169. package/docs/reference/tools/mcp.md +391 -0
  170. package/docs/reference/tools/vite-plugin.md +163 -0
  171. package/docs/tutorials/first-api-call.md +253 -0
  172. package/docs/tutorials/first-experience-in-the-dashboard.mdx +160 -0
  173. package/docs/tutorials/first-experience.mdx +254 -0
  174. package/docs/tutorials/first-server-rendered-page.mdx +186 -0
  175. package/package.json +8 -7
@@ -0,0 +1,72 @@
1
+ ---
2
+ type: reference
3
+ layout: docs
4
+ ---
5
+
6
+ # Keyboard shortcuts
7
+
8
+ These shortcuts work when the canvas of the flow builder holds the keyboard input.
9
+
10
+ ## Canvas tools
11
+
12
+ | Shortcut (Mac) | Shortcut (PC) | Action |
13
+ | --- | --- | --- |
14
+ | `V` | `V` | The choose tool |
15
+ | `H` | `H` | The hand tool, which pans the view |
16
+ | `Space`, held | `Space`, held | The hand tool, while you hold the key |
17
+
18
+ ## Layout
19
+
20
+ | Shortcut (Mac) | Shortcut (PC) | Action |
21
+ | --- | --- | --- |
22
+ | `Shift+L` | `Shift+L` | Auto-layout |
23
+
24
+ ## Choice
25
+
26
+ | Shortcut (Mac) | Shortcut (PC) | Action |
27
+ | --- | --- | --- |
28
+ | `Cmd+A` | `Ctrl+A` | Choose every node |
29
+ | `Escape` | `Escape` | Choose no node |
30
+
31
+ ## Edits
32
+
33
+ | Shortcut (Mac) | Shortcut (PC) | Action |
34
+ | --- | --- | --- |
35
+ | `Cmd+D` | `Ctrl+D` | Make a copy of each chosen node |
36
+ | `Delete` or `Backspace` | `Delete` or `Backspace` | Delete each chosen node |
37
+ | `Cmd+Z` | `Ctrl+Z` | Undo |
38
+ | `Cmd+Shift+Z` | `Ctrl+Shift+Z` | Redo |
39
+
40
+ ## Movement
41
+
42
+ | Shortcut (Mac) | Shortcut (PC) | Action |
43
+ | --- | --- | --- |
44
+ | Arrow keys | Arrow keys | Move each chosen node a small distance |
45
+ | `Shift` and an arrow key | `Shift` and an arrow key | Move each chosen node further |
46
+
47
+ ## Zoom
48
+
49
+ | Shortcut (Mac) | Shortcut (PC) | Action |
50
+ | --- | --- | --- |
51
+ | Scroll | Scroll | Zoom in or out |
52
+ | Pinch | Pinch | Zoom in or out, on a trackpad |
53
+ | `Cmd+=` | `Ctrl+=` | Zoom in |
54
+ | `Cmd+-` | `Ctrl+-` | Zoom out |
55
+ | `Shift+1` | `Shift+1` | Fit the flow to the view |
56
+ | `Shift+0` | `Shift+0` | Zoom to 100% |
57
+
58
+ ## Panels
59
+
60
+ | Shortcut (Mac) | Shortcut (PC) | Action |
61
+ | --- | --- | --- |
62
+ | `Cmd+\` | `Ctrl+\` | Turn both side panels on or off |
63
+ | `?` | `?` | Turn this shortcut list on or off |
64
+
65
+ ---
66
+
67
+ [Overview](/reference/dashboard/flow-builder/canvas) · [Nodes](/reference/dashboard/flow-builder/nodes) · [Build Flows](/how-to/build-a-flow) · **Keyboard Shortcuts** · [Condition Builder](/reference/dashboard/flow-builder/condition-builder)
68
+
69
+ ## Related
70
+
71
+ - [How to build a flow](/how-to/build-a-flow)
72
+ - [Canvas](/reference/dashboard/flow-builder/canvas) — the panels and the view controls.
@@ -0,0 +1,74 @@
1
+ ---
2
+ type: reference
3
+ layout: docs
4
+ ---
5
+
6
+ # Nodes
7
+
8
+ A node is one part of a flow. Each node stands for a block in your experience. There
9
+ are four node types.
10
+
11
+ ## Origin
12
+
13
+ Every flow starts with an origin node. It is a gray circle on the left side of the
14
+ canvas, and it has one output handle on its right side.
15
+
16
+ You cannot move the origin, delete it, or make a copy of it. It is always there.
17
+
18
+ ## Step
19
+
20
+ A step node stands for a screen that a visitor sees. It appears as a blue rectangle
21
+ on the canvas.
22
+
23
+ A step holds fields. Drag a field from the library onto a step node to assign
24
+ it. The subtitle of the node gives the number of assigned fields.
25
+
26
+ Each step has a `layoutName`. It tells the SDK which visual layout to use for this
27
+ step. Set the layout name in the inspector.
28
+
29
+ ## Action
30
+
31
+ An action node stands for a side effect. A side effect happens where the visitor
32
+ cannot see it. The node appears as a green rectangle.
33
+
34
+ An action runs when the flow reaches it. Use an action to record an event, to send
35
+ data, or to start an integration.
36
+
37
+ ## Condition
38
+
39
+ A condition node stands for a point where the flow splits. It appears as an amber
40
+ rectangle.
41
+
42
+ A condition node has two output handles, and not one. The green handle at the top
43
+ right connects to the path for a true result. The red handle at the bottom right
44
+ connects to the path for a false result.
45
+
46
+ Define the rule in the inspector, with the visual condition builder. See
47
+ [Conditions](/reference/dashboard/conditions) for more detail.
48
+
49
+ ## Handles
50
+
51
+ A handle is a connection point on a node. An input handle is on the left. An output
52
+ handle is on the right. Drag from an output handle to an input handle to connect two
53
+ nodes.
54
+
55
+ ---
56
+
57
+ [Overview](/reference/dashboard/flow-builder/canvas) · **Nodes** · [Build Flows](/how-to/build-a-flow) · [Keyboard Shortcuts](/reference/dashboard/flow-builder/keyboard-shortcuts) · [Condition Builder](/reference/dashboard/flow-builder/condition-builder)
58
+
59
+ ## API and MCP
60
+
61
+ You can also do this task with the [Management API](/reference/management-api/schema), the [MCP server](/reference/tools/mcp), or code that you send to [`picked_run`](/reference/tools/mcp-run).
62
+
63
+ | Task | GraphQL | MCP tool | Run |
64
+ | --- | --- | --- | --- |
65
+ | Assign fields to a step | [`stepUpdate`](/reference/management-api/schema/step#stepupdate), [`experienceFlowUpdate`](/reference/management-api/schema/experience#experienceflowupdate) | [`update_experience_flow`](/reference/tools/mcp#update_experience_flow) | `tools.update_experience_flow({ experience_id, workspace_id, update_steps })` |
66
+ | Set the layout name of a step | [`stepUpdate`](/reference/management-api/schema/step#stepupdate), [`experienceFlowUpdate`](/reference/management-api/schema/experience#experienceflowupdate) | [`update_experience_flow`](/reference/tools/mcp#update_experience_flow) | `tools.update_experience_flow({ experience_id, workspace_id, update_steps })` |
67
+ | Set the rule of a condition | [`conditionUpdate`](/reference/management-api/schema/condition#conditionupdate), [`experienceFlowUpdate`](/reference/management-api/schema/experience#experienceflowupdate) | [`update_experience_flow`](/reference/tools/mcp#update_experience_flow) | `tools.update_experience_flow({ experience_id, workspace_id, update_conditions })` |
68
+ | Connect two nodes | [`experienceFlowUpdate`](/reference/management-api/schema/experience#experienceflowupdate) | [`update_experience_flow`](/reference/tools/mcp#update_experience_flow) | `tools.update_experience_flow({ experience_id, workspace_id, create_edges })` |
69
+
70
+ ## Related
71
+
72
+ - [How to build a flow](/how-to/build-a-flow)
73
+ - [Canvas](/reference/dashboard/flow-builder/canvas)
74
+ - [About how Picked works](/explanation/how-picked-works) — why a flow is a graph.
@@ -0,0 +1,321 @@
1
+ ---
2
+ type: reference
3
+ layout: docs
4
+ ---
5
+
6
+ # Labels
7
+
8
+ A label is a name and a value on a lead, a project or a workflow run. A workflow sets and
9
+ removes labels with tool nodes. A label can expire, a write can be conditional, and a node
10
+ can increment a `number` label.
11
+
12
+ ## Name, type and value
13
+
14
+ | Part | Format |
15
+ | --------- | --------------------------------------------------------------------------------------------------------------------------- |
16
+ | Namespace | 1 to 64 characters. Each character is a lowercase letter, a digit, `_` or `-`. |
17
+ | Key | 1 to 64 characters. Each character is a lowercase letter, a digit, `_` or `-`. |
18
+ | Type | `text`, `number`, `boolean` or `json`. It tells how to read the value. |
19
+ | Value | Text. A `number` label holds a number, a `boolean` label holds `true` or `false`, and a `json` label holds a JSON document. |
20
+
21
+ The lead, the project or the run that has a label is the owner of the label. An owner has
22
+ one label for each namespace and key.
23
+
24
+ ## Owners
25
+
26
+ | Owner | Where the labels stay | Scope to read the labels | Scope to set and remove the labels |
27
+ | ------------ | ------------------------------------------------------------------------------------------------------------ | ---------------------------- | ---------------------------------- |
28
+ | Lead | Until you delete the lead. Picked deletes the labels of a lead with the lead. | `ORGANIZATION_LEADS_READ` | `ORGANIZATION_LEADS_UPDATE` |
29
+ | Project | Picked keeps the labels when you delete the project. These labels hold data for all the runs of the project. | `ORGANIZATION_PROJECTS_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
30
+ | Workflow run | With the run. Picked does not delete a run. | `ORGANIZATION_PROJECTS_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
31
+
32
+ A run reads, sets and removes its own labels without a scope.
33
+
34
+ ## Labels in the dashboard
35
+
36
+ The **Labels** card shows the labels of one owner, in one section for each namespace.
37
+
38
+ | Page | Where the card shows | Scope to change the labels |
39
+ | -------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------ |
40
+ | Lead | Next to the responses, or below them on a medium screen. On a narrow screen, it is on the **Labels** tab. | `ORGANIZATION_LEADS_UPDATE` |
41
+ | Project labels | At `…/<project>/labels`. **Project labels** in the project menu opens the page for `ORGANIZATION_PROJECTS_READ`. | `ORGANIZATION_PROJECTS_UPDATE` |
42
+ | Run | Below the details of the run. On a narrow screen, the card is on the **Labels** tab. | `ORGANIZATION_PROJECTS_UPDATE` |
43
+
44
+ The project settings also have a **Labels** link to the Project labels page. To open the project
45
+ settings, you must have `ORGANIZATION_PROJECTS_UPDATE`.
46
+
47
+ Without the scope, the card shows the labels, and you cannot change them.
48
+
49
+ With the scope, the card has these controls:
50
+
51
+ | Control | Result |
52
+ | ------------- | --------------------------------------------------------------------------------------------- |
53
+ | The value | Changes the value of the label. |
54
+ | **Add label** | Adds a label with a namespace, a key, a type and a value. This label does not expire. |
55
+ | **×** | Removes the label. |
56
+ | **Save** | Sets and removes the labels that you changed. Picked does not change a label before **Save**. |
57
+ | **Discard** | Removes your changes. |
58
+
59
+ A label with an expiry shows the time until it expires. You can remove it, but you cannot
60
+ change its value.
61
+
62
+ ## Visitor data in project and run labels
63
+
64
+ The labels of a project and of a run stay after Picked deletes a lead. Picked does not delete
65
+ visitor data in a project label or a run label with the lead. Visitor data is, for example, an
66
+ email address, a phone number or a visitor ID.
67
+
68
+ A project label or a run label can have the `sha256` hash of a visitor identifier as its key.
69
+ With a hash, a workflow can hold a label for one visitor across runs. Use `expiresIn` to set
70
+ how long the label stays. Refer to [Example: one run at a time for each visitor](#example-one-run-at-a-time-for-each-visitor).
71
+
72
+ ## Tools
73
+
74
+ | Tool | Name in the editor | Owner | Output | Scopes |
75
+ | ----------------------- | ------------------------- | ------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------- |
76
+ | `set_lead_labels` | **Set lead labels** | The lead in its `lead` argument | `lead` and `count` | `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ` |
77
+ | `remove_lead_labels` | **Remove lead labels** | The lead in its `lead` argument | `lead` and `removed` | `ORGANIZATION_LEADS_UPDATE` and `ORGANIZATION_LEADS_READ` |
78
+ | `create_lead` | **Create lead** | The lead that it makes | `lead`, `created` and `labelCount` | `ORGANIZATION_LEADS_CREATE`, `ORGANIZATION_LEADS_READ` and `ORGANIZATION_LEADS_UPDATE` |
79
+ | `set_project_labels` | **Set project labels** | The project of the run | `project` and `count` | `ORGANIZATION_PROJECTS_UPDATE` and `ORGANIZATION_PROJECTS_READ` |
80
+ | `remove_project_labels` | **Remove project labels** | The project of the run | `project` and `removed` | `ORGANIZATION_PROJECTS_UPDATE` and `ORGANIZATION_PROJECTS_READ` |
81
+ | `get_project` | **Get project** | The project of the run | `project` | `ORGANIZATION_PROJECTS_READ` |
82
+ | `set_run_labels` | **Set run labels** | The run | `run` and `count` | None |
83
+ | `remove_run_labels` | **Remove run labels** | The run | `run` and `removed` | None |
84
+ | `get_run` | **Get run** | The run | `run` | None |
85
+
86
+ **Set project labels**, **Remove project labels**, **Set run labels**, **Remove run labels**,
87
+ **Get project** and **Get run** have no argument for the owner.
88
+
89
+ The `lead`, `project` and `run` outputs hold the labels of the owner at the time that a later
90
+ node reads them, as `labels.<namespace>.<key>`:
91
+
92
+ | Output | Fields |
93
+ | --------- | ------------------------- |
94
+ | `lead` | The lead, and `labels` |
95
+ | `project` | `id`, `name` and `labels` |
96
+ | `run` | `id` and `labels` |
97
+
98
+ For example, `{{ nodes.project.project.labels.cms.sent_today }}` reads the label
99
+ `cms.sent_today` of the project.
100
+
101
+ When Picked refuses the labels of a node, or cannot find the owner, the node fails with the
102
+ code `tool_failed`. Its reason is the error code in lowercase, such as `label_write_invalid`,
103
+ `value_invalid_for_type` or `owner_not_found`. An edge on the error exit of the node can
104
+ continue the run. Refer to the [workflow runs reference](/reference/dashboard/workflow-runs#run-status).
105
+
106
+ ## Labels in a test run
107
+
108
+ For the run tools in a test run, refer to
109
+ [What runs](/reference/dashboard/workflow-test-runs#what-runs).
110
+
111
+ ## A row that sets a label
112
+
113
+ The `labels` argument of **Set lead labels**, **Set project labels**, **Set run labels** and
114
+ **Create lead** is a list of rows. Each row sets one label.
115
+
116
+ | Field | Type | Default | Description |
117
+ | -------------- | ----------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
118
+ | `namespace` | Text | — | The namespace of the label. |
119
+ | `key` | Text | — | The key of the label. |
120
+ | `type` | Text | `number` with `increment`, else `text` | The type of the label. |
121
+ | `value` | Text | — | The value of the label. |
122
+ | `increment` | Number | — | An amount to add to the value of a `number` label. Refer to [Increments](#increments). |
123
+ | `expiresIn` | Number | No expiry | The number of seconds until the label expires, from 1 to 31536000. Refer to [Expiry](#expiry). |
124
+ | `onlyIfAbsent` | `true` or `false` | `false` | When `true`, the row sets the label only when the owner does not have it. Refer to [Conditional rows](#conditional-rows). |
125
+
126
+ A row has `value` or `increment`. It cannot have both. When you save a workflow, Picked
127
+ refuses a row that has both, or neither.
128
+
129
+ A row with a `value` and no `expiresIn` sets a label that does not expire. If the label had
130
+ an expiry, the row removes it.
131
+
132
+ The namespace, the key, `value`, `increment` and `expiresIn` can have a template. Refer to
133
+ [Workflow templates](/reference/dashboard/workflow-templates).
134
+
135
+ ### Rows in the workflow editor
136
+
137
+ In the workflow editor, each row has an **Operation** list:
138
+
139
+ | Operation | Fields | The row that Picked saves |
140
+ | ------------- | ---------------------------------- | --------------------------- |
141
+ | **Set** | **Value** | `value` |
142
+ | **Increment** | **Amount**: a number or a template | `increment` with the amount |
143
+
144
+ To make the value smaller, give a negative amount. For example, the amount `-3` saves `increment: -3`, and
145
+ the amount `-{{ trigger.cost }}` saves `increment: "-{{ trigger.cost }}"`.
146
+
147
+ With **Increment**, the type is always `number`. When you change the operation to
148
+ **Increment**, the editor removes `value` and `onlyIfAbsent` and sets the amount to 1. When you
149
+ change it to **Set**, the editor removes `increment`.
150
+
151
+ **Expires after (seconds)** sets `expiresIn`. It accepts a number or a template. When the
152
+ field is empty, the row has no `expiresIn`.
153
+
154
+ With **Set**, the **Only while the owner does not hold it** checkbox sets `onlyIfAbsent: true`.
155
+ When the checkbox is clear, the row has no `onlyIfAbsent`.
156
+
157
+ The full `labels` argument can also be one template. The editor then shows the template, and
158
+ it shows no rows. **Replace with rows** removes the template after you confirm it.
159
+
160
+ ## Expiry
161
+
162
+ A label with `expiresIn` expires that number of seconds after the node sets it. Picked does
163
+ not show an expired label:
164
+
165
+ - The `lead`, `project` or `run` output of a tool does not have it.
166
+ - A lead search clause does not match it. A negative clause, such as `-cms.status:*`, matches
167
+ the lead.
168
+ - A lead sorts as if it does not have the label.
169
+ - The pages of the dashboard do not show it.
170
+
171
+ A row that sets an expired label makes a new label, with a new ID. The task records it as
172
+ created.
173
+
174
+ Picked deletes an expired label within 15 minutes after it expires. This delete does not
175
+ record an operation.
176
+
177
+ ## Conditional rows
178
+
179
+ A row with `onlyIfAbsent: true` sets its label only when the owner does not have a label with
180
+ its namespace and key. An expired label does not count. Picked does the check and the write in
181
+ one step. When two nodes set the same absent label at the same time, only one of them sets it.
182
+
183
+ When the owner has the label already:
184
+
185
+ | The label has | Result |
186
+ | --------------------------------- | ------------------------------------------------------------------------------------- |
187
+ | The type and the value of the row | The node takes the label. Picked does not change it and does not record an operation. |
188
+ | A different type or value | The node does not take the label. Picked does not change it, its value or its expiry. |
189
+
190
+ When the value is an ID unique to one run, such as `{{ run.id }}`, only one run can hold the
191
+ label at a time. When Picked starts a node again after the node set its label, the node takes
192
+ the label again with the same result.
193
+
194
+ A row with `increment` cannot have `onlyIfAbsent`.
195
+
196
+ ## Atomic writes
197
+
198
+ **Set lead labels**, **Set project labels** and **Set run labels** have an `atomic`
199
+ argument. In the workflow editor, it is the **Atomic** checkbox. When it is `true`, the node
200
+ takes all of its labels or none of them. If one conditional row does not take its label, the
201
+ node sets no label, records no operation, and gives a `count` of 0.
202
+
203
+ Two nodes with `atomic` can run at the same time. If both nodes set the same label with
204
+ `onlyIfAbsent` and a value unique to each node, one node at most takes its labels.
205
+
206
+ ## Increments
207
+
208
+ A row with `increment` adds that amount to the value of a `number` label. When the owner does
209
+ not have the label, or the label expired, the value starts at 0. When many nodes add to the
210
+ same label at the same time, the label counts each amount.
211
+
212
+ | Rule | Description |
213
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
214
+ | Type | The row must be of type `number`, which is the default with `increment`. When you save a workflow, Picked refuses a row with a different type. |
215
+ | A label of a different type | The node fails with the code `tool_failed` and the reason `value_invalid_for_type`. Picked does not change the label. |
216
+ | Expiry | The label keeps its expiry. The `expiresIn` of the row applies only when the row makes the label. So the label expires at a fixed time after the first row that made it. |
217
+ | Operations | Each row with `increment` records an operation. |
218
+
219
+ When Picked starts a node again after it added its amount, the node adds the amount again.
220
+
221
+ ## A row that removes a label
222
+
223
+ The `labels` argument of **Remove lead labels**, **Remove project labels** and **Remove run
224
+ labels** is a list of rows. Each row removes one label.
225
+
226
+ | Field | Type | Default | Description |
227
+ | ----------- | ---- | --------- | ------------------------------------------------------------------------------------------------- |
228
+ | `namespace` | Text | — | The namespace of the label. |
229
+ | `key` | Text | — | The key of the label. |
230
+ | `ifValue` | Text | Any value | When it is set, the row removes the label only when the value of the label is equal to `ifValue`. |
231
+
232
+ Picked does the check and the remove in one step. A row with `ifValue: "{{ run.id }}"`
233
+ removes the label only while this run holds it. It does not remove the label when a different
234
+ run holds it.
235
+
236
+ In the workflow editor, **Only while its value is** sets `ifValue`. It accepts text or a
237
+ template. When the field is empty, the row has no `ifValue`.
238
+
239
+ A row that names a label that the owner does not have removes nothing. An expired label counts
240
+ as no label.
241
+
242
+ ## Count and removed
243
+
244
+ | Output | Value |
245
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
246
+ | `count` | The number of labels that the node took. The node takes a label when it sets it, or when a conditional row finds the label with its own type and value. |
247
+ | `labelCount` | The same as `count`, for **Create lead**. |
248
+ | `removed` | The number of labels that the node removed. |
249
+
250
+ ## Example: one run at a time
251
+
252
+ This **Set lead labels** node holds a label for one hour, unless a different run holds it:
253
+
254
+ ```json
255
+ {
256
+ "lead": "{{ nodes.lead.lead }}",
257
+ "labels": [
258
+ {
259
+ "namespace": "cms",
260
+ "key": "request-callback",
261
+ "value": "{{ run.id }}",
262
+ "onlyIfAbsent": true,
263
+ "expiresIn": 3600
264
+ }
265
+ ]
266
+ }
267
+ ```
268
+
269
+ When `count` is 1, the run holds the label. This **Remove lead labels** node removes the label
270
+ only while the run holds it:
271
+
272
+ ```json
273
+ {
274
+ "lead": "{{ nodes.lead.lead }}",
275
+ "labels": [{ "namespace": "cms", "key": "request-callback", "ifValue": "{{ run.id }}" }]
276
+ }
277
+ ```
278
+
279
+ ## Example: one run at a time for each visitor
280
+
281
+ This **Set project labels** node holds a label for the visitor of the run for one hour,
282
+ unless a different run holds it. The key is the `sha256` hash of the visitor ID, and the label
283
+ expires. Refer to [the rule for visitor data](#visitor-data-in-project-and-run-labels).
284
+
285
+ ```json
286
+ {
287
+ "labels": [
288
+ {
289
+ "namespace": "cms-lock-visitor",
290
+ "key": "{{ trigger.action.userId | default: run.id | sha256 }}",
291
+ "value": "{{ run.id }}",
292
+ "onlyIfAbsent": true,
293
+ "expiresIn": 3600
294
+ }
295
+ ]
296
+ }
297
+ ```
298
+
299
+ When `count` is 1, the run holds the label. This **Remove project labels** node removes the
300
+ label only while the run holds it:
301
+
302
+ ```json
303
+ {
304
+ "labels": [
305
+ {
306
+ "namespace": "cms-lock-visitor",
307
+ "key": "{{ trigger.action.userId | default: run.id | sha256 }}",
308
+ "ifValue": "{{ run.id }}"
309
+ }
310
+ ]
311
+ }
312
+ ```
313
+
314
+ ## Related
315
+
316
+ - [Workflow runs](/reference/dashboard/workflow-runs) — the error exit of a node, and the
317
+ operations that a task records.
318
+ - [Workflow templates](/reference/dashboard/workflow-templates) — the `sha256` filter and the
319
+ `run.id` variable.
320
+ - [Lead search](/reference/dashboard/lead-search) — clauses on labels.
321
+ - [Glossary](/reference/glossary) — label, namespace and label type.