Skip to content
LogoLogo

Labels

A label is a name and a value on a lead, a project, a workflow run, an app installation or an organization. A workflow sets and removes labels with tool nodes. A label can expire, a write can be conditional, and a node can increment a number label.

Name, type and value

PartFormat
Namespace1 to 64 characters. Each character is a lowercase letter, a digit, _ or -.
Key1 to 64 characters. Each character is a lowercase letter, a digit, _ or -.
Typetext, number, boolean or json. It tells how to read the value.
ValueText. A number label holds a number, a boolean label holds true or false, and a json label holds a JSON document.

The lead, the project, the run, the installation or the organization that has a label is the owner of the label. An owner has one label for each namespace and key.

Owners

OwnerWhere the labels stayScope to read the labelsScope to set and remove the labels
LeadUntil you delete the lead. Picked deletes the labels of a lead with the lead.ORGANIZATION_LEADS_READORGANIZATION_LEADS_UPDATE
ProjectPicked keeps the labels when you delete the project. These labels hold data for all the runs of the project.ORGANIZATION_PROJECTS_READORGANIZATION_PROJECTS_UPDATE
Workflow runWith the run. Picked does not delete a run.ORGANIZATION_WORKSPACE_READORGANIZATION_PROJECTS_UPDATE
App installationUntil you uninstall the app. Picked deletes the labels of an installation with the installation.ORGANIZATION_APPS_READORGANIZATION_APPS_UPDATE
OrganizationPicked keeps the labels when you delete the organization. All the projects of the organization share these labels.ORGANIZATION_READORGANIZATION_UPDATE

A run reads, sets and removes its own labels without a scope. An app installation reads, sets and removes its own labels with its own token, without a scope. The owner type of an app installation in the API is APP_INSTALLATION.

Organization labels

The labels of an organization are not in a project. All the projects of the organization read and write the same labels. Use them for data that more than one project must share, for example:

  • A counter of the calls that one call center takes in a day, for all the brands of the organization.
  • A label that only one run at a time can hold for one visitor, across all the brands of the organization.

The owner type of an organization in the API is ORGANIZATION, and the owner ID is the ID of the organization.

All the members of an organization have ORGANIZATION_READ for it, and can read its labels. To change the labels, you must have ORGANIZATION_UPDATE for all the organization. The scope for one project is not enough. Do not keep data in an organization label that some members must not see.

A workflow run can read and write only the labels of its own organization. To save a workflow that uses Set organization labels or Remove organization labels, you must have ORGANIZATION_UPDATE for all the organization. An API key for one project cannot read or write organization labels.

All the projects of the organization use the same namespaces and keys. Two projects that set the same namespace and key change the same label.

When a run changes an organization label, its task records the operation. When you change an organization label in the dashboard or with the API, Picked does not record an operation.

Secret labels

Only the labels of an app installation can be secret. A secret label has secret: true.

  • Only a text or a json label can be secret.
  • A row that sets a secret label cannot have increment or onlyIfAbsent.
  • The value of a secret label is empty. Only the installation reads the value, with its own token.

An installation has a limit on the number of its labels and on the size of each value. Refer to How to store data for an installation.

Labels in the dashboard

The Labels card shows the labels of one owner, in one section for each namespace.

PageWhere the card showsScope to change the labels
LeadNext to the responses, or below them on a medium screen. On a narrow screen, it is on the Labels tab.ORGANIZATION_LEADS_UPDATE
Project labelsAt …/<project>/settings/labels. The page opens for ORGANIZATION_PROJECTS_READ.ORGANIZATION_PROJECTS_UPDATE
Organization labelsAt /<organization>/settings/labels. The page opens for ORGANIZATION_READ.ORGANIZATION_UPDATE
RunBelow the details of the run. On a narrow screen, the card is on the Labels tab.ORGANIZATION_PROJECTS_UPDATE

The project settings have a Labels link to the Project labels page. To open the project settings, you must have ORGANIZATION_PROJECTS_UPDATE. The organization settings have a Labels link to the Organization labels page.

Without the scope, the card shows the labels, and you cannot change them.

With the scope, the card has these controls:

ControlResult
The valueChanges the value of the label.
Add labelAdds a label with a namespace, a key, a type and a value. This label does not expire.
×Removes the label.
SaveSets and removes the labels that you changed. Picked does not change a label before Save.
DiscardRemoves your changes.

A label with an expiry shows the time until it expires. You can remove it, but you cannot change its value.

Visitor data in project, run and organization labels

The labels of a project, of a run and of an organization stay after Picked deletes a lead. Picked does not delete visitor data in these labels with the lead. Visitor data is, for example, an email address, a phone number or a Picked ID.

A project label, a run label or an organization label can have the sha256 hash of a visitor identifier as its key. With a hash, a workflow can hold a label for one visitor across runs. An organization label with a hash connects one visitor across all the projects of the organization. Use expiresIn to set how long the label stays. Refer to Example: one run at a time for each visitor.

Tools

ToolName in the editorOwnerOutputScopes
set_lead_labelsSet lead labelsThe lead in its lead argumentlead and countORGANIZATION_LEADS_UPDATE and ORGANIZATION_LEADS_READ
remove_lead_labelsRemove lead labelsThe lead in its lead argumentlead and removedORGANIZATION_LEADS_UPDATE and ORGANIZATION_LEADS_READ
create_leadCreate leadThe lead that it makeslead, created and labelCountORGANIZATION_LEADS_CREATE, ORGANIZATION_LEADS_READ and ORGANIZATION_LEADS_UPDATE
set_project_labelsSet project labelsThe project of the runproject and countORGANIZATION_PROJECTS_UPDATE and ORGANIZATION_PROJECTS_READ
remove_project_labelsRemove project labelsThe project of the runproject and removedORGANIZATION_PROJECTS_UPDATE and ORGANIZATION_PROJECTS_READ
get_projectGet projectThe project of the runprojectORGANIZATION_PROJECTS_READ
set_organization_labelsSet organization labelsThe organization of the runorganization and countORGANIZATION_UPDATE and ORGANIZATION_READ
remove_organization_labelsRemove organization labelsThe organization of the runorganization and removedORGANIZATION_UPDATE and ORGANIZATION_READ
get_organizationGet organizationThe organization of the runorganizationORGANIZATION_READ
set_run_labelsSet run labelsThe runrun and countNone
remove_run_labelsRemove run labelsThe runrun and removedNone
get_runGet runThe runrunNone

The project, organization and run tools have no argument for the owner.

The lead, project, organization and run outputs hold the labels of the owner. They show the labels when a later node reads them, as labels.<namespace>.<key>:

OutputFields
leadThe lead, and labels
projectid, name and labels
organizationid, name and labels
runid and labels

For example, {{ nodes.project.project.labels.cms.sent_today }} reads the label cms.sent_today of the project.

When Picked refuses the labels of a node, or cannot find the owner, the node fails with the code tool_failed. Its reason is the error code in lowercase, such as label_write_invalid, value_invalid_for_type or owner_not_found. An edge on the error exit of the node can continue the run. Refer to the workflow runs reference.

Labels in a test run

For the run tools in a test run, refer to What runs.

A row that sets a label

The labels argument of Set lead labels, Set project labels, Set organization labels, Set run labels and Create lead is a list of rows. Each row sets one label.

FieldTypeDefaultDescription
namespaceText—The namespace of the label.
keyText—The key of the label.
typeTextnumber with increment, else textThe type of the label.
valueText—The value of the label.
incrementNumber—An amount to add to the value of a number label. Refer to Increments.
expiresInNumberNo expiryThe number of seconds until the label expires, from 1 to 31536000. Refer to Expiry.
onlyIfAbsenttrue or falsefalseWhen true, the row sets the label only when the owner does not have it. Refer to Conditional rows.

A row has value or increment. It cannot have both. When you save a workflow, Picked refuses a row that has both, or neither.

A row with a value and no expiresIn sets a label that does not expire. If the label had an expiry, the row removes it.

The namespace, the key, value, increment and expiresIn can have a template. Refer to Workflow templates.

Rows in the workflow editor

In the workflow editor, each row has an Operation list:

OperationFieldsThe row that Picked saves
SetValuevalue
IncrementAmount: a number or a templateincrement with the amount

To make the value smaller, give a negative amount. For example, the amount -3 saves increment: -3, and the amount -{{ trigger.cost }} saves increment: "-{{ trigger.cost }}".

With Increment, the type is always number. When you change the operation to Increment, the editor removes value and onlyIfAbsent and sets the amount to 1. When you change it to Set, the editor removes increment.

Expires after (seconds) sets expiresIn. It accepts a number or a template. When the field is empty, the row has no expiresIn.

With Set, the Only while the owner does not hold it checkbox sets onlyIfAbsent: true. When the checkbox is clear, the row has no onlyIfAbsent.

The full labels argument can also be one template. The editor then shows the template, and it shows no rows. Replace with rows removes the template after you confirm it.

Expiry

A label with expiresIn expires that number of seconds after the node sets it. Picked does not show an expired label:

  • The lead, project, organization or run output of a tool does not have it.
  • A lead search clause does not match it. A negative clause, such as -cms.status:*, matches the lead.
  • A lead sorts as if it does not have the label.
  • The pages of the dashboard do not show it.

A row that sets an expired label makes a new label, with a new ID. The task records it as created.

Picked deletes an expired label within 15 minutes after it expires. This delete does not record an operation.

Conditional rows

A row with onlyIfAbsent: true sets its label only when the owner does not have a label with its namespace and key. An expired label does not count. Picked does the check and the write in one step. When two nodes set the same absent label at the same time, only one of them sets it.

When the owner has the label already:

The label hasResult
The type and the value of the rowThe node takes the label. Picked does not change it and does not record an operation.
A different type or valueThe node does not take the label. Picked does not change it, its value or its expiry.

When the value is an ID unique to one run, such as {{ run.id }}, only one run can hold the label at a time. When Picked starts a node again after the node set its label, the node takes the label again with the same result.

A row with increment cannot have onlyIfAbsent.

Atomic writes

Set lead labels, Set project labels, Set organization labels and Set run labels have an atomic argument. In the workflow editor, it is the Atomic checkbox. When it is true, the node takes all of its labels or none of them. If one conditional row does not take its label, the node sets no label, records no operation, and gives a count of 0.

Two nodes with atomic can run at the same time. If both nodes set the same label with onlyIfAbsent and a value unique to each node, one node at most takes its labels.

Increments

A row with increment adds that amount to the value of a number label. When the owner does not have the label, or the label expired, the value starts at 0. When many nodes add to the same label at the same time, the label counts each amount.

RuleDescription
TypeThe 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.
A label of a different typeThe node fails with the code tool_failed and the reason value_invalid_for_type. Picked does not change the label.
ExpiryThe 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.
OperationsEach row with increment records an operation.

When Picked starts a node again after it added its amount, the node adds the amount again.

A row that removes a label

The labels argument of Remove lead labels, Remove project labels, Remove organization labels and Remove run labels is a list of rows. Each row removes one label.

FieldTypeDefaultDescription
namespaceText—The namespace of the label.
keyText—The key of the label.
ifValueTextAny valueWhen it is set, the row removes the label only when the value of the label is equal to ifValue.

Picked does the check and the remove in one step. A row with ifValue: "{{ run.id }}" removes the label only while this run holds it. It does not remove the label when a different run holds it.

In the workflow editor, Only while its value is sets ifValue. It accepts text or a template. When the field is empty, the row has no ifValue.

A row that names a label that the owner does not have removes nothing. An expired label counts as no label.

Count and removed

OutputValue
countThe 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.
labelCountThe same as count, for Create lead.
removedThe number of labels that the node removed.

Example: one run at a time

This Set lead labels node holds a label for one hour, unless a different run holds it:

{
  "lead": "{{ nodes.lead.lead }}",
  "labels": [
    {
      "namespace": "cms",
      "key": "request-callback",
      "value": "{{ run.id }}",
      "onlyIfAbsent": true,
      "expiresIn": 3600
    }
  ]
}

When count is 1, the run holds the label. This Remove lead labels node removes the label only while the run holds it:

{
  "lead": "{{ nodes.lead.lead }}",
  "labels": [{ "namespace": "cms", "key": "request-callback", "ifValue": "{{ run.id }}" }]
}

Example: one run at a time for each visitor

This Set project labels node holds a label for the visitor of the run for one hour, unless a different run holds it. The key is the sha256 hash of the Picked ID, and the label expires. Refer to the rule for visitor data.

{
  "labels": [
    {
      "namespace": "cms-lock-visitor",
      "key": "{{ trigger.action.pickedId | default: run.id | sha256 }}",
      "value": "{{ run.id }}",
      "onlyIfAbsent": true,
      "expiresIn": 3600
    }
  ]
}

When count is 1, the run holds the label. This Remove project labels node removes the label only while the run holds it:

{
  "labels": [
    {
      "namespace": "cms-lock-visitor",
      "key": "{{ trigger.action.pickedId | default: run.id | sha256 }}",
      "ifValue": "{{ run.id }}"
    }
  ]
}