Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.prisme.ai/llms.txt

Use this file to discover all available pages before exploring further.

Builder Automations Interface
Automations are the core server-side processes that power your Builder applications. They define what to do and when to do it, allowing you to create sophisticated workflows, integrate with external systems, and build intelligent applications.

Understanding Automations

In simple words, automations describe what to do and when:
  • What to do: A sequence of instructions that process data and perform actions
  • When to do it: Triggers that activate the automation when specific conditions are met
Example:A HubspotDealsOnSlack automation might send a notification message on Slack every time a new Hubspot deal is created:
  • The what would be a fetch instruction calling Slack API to send a message
  • The when would be a URL (webhook) trigger that Hubspot calls whenever a new deal is opened

Automation YAML Syntax

Every automation is a YAML file. The visual editor reads and writes that same file, so understanding the syntax is what unlocks the rest of the platform.

File anatomy

A minimal automation:
slug: hello
name: Hello World
when:
  endpoint: true
do:
  - set:
      name: greeting
      value: "Hello, {{body.name}}"
output: "{{greeting}}"
Top-level keyPurpose
slugURL-safe identifier. Must be unique inside the workspace. Used in API paths and event sources.
nameHuman-readable label shown in the sidebar.
descriptionOptional free text shown in the workspace overview and app store.
argumentsSchema for the inputs the automation expects when called directly (see Arguments).
whenTrigger configuration: endpoint, events, schedules (see Triggers).
doOrdered list of instructions to execute.
outputExpression returned to the caller after do completes.
validateArgumentsWhen true, the runtime rejects calls whose inputs do not match the arguments schema.
privateWhen true, the automation cannot be called from outside the workspace (only via runWorkflow from another automation).
disabledWhen true, the automation is registered but never executes.
labelsFree-form tags used for organization.

Indentation and structure rules

YAML structure is significant. Three rules cover 95 % of the mistakes the editor will surface.
  1. Indentation is spaces, not tabs. Two spaces per level is the convention used everywhere in this documentation. Mixing tabs and spaces fails parsing.
  2. A list item starts with - at the parent’s indentation level. The contents of the item are indented one more level.
  3. A key always ends with : and a single space before its value (except when the value is on the next line).
do:                          # 0 spaces — top-level key
  - set:                     # 2 spaces — list item, starts with "- "
      name: counter          # 6 spaces — value of "set" (4 for the list item's indent + 2 more for the nested map)
      value: 0
  - emit:
      event: started
If a value contains characters YAML would otherwise interpret (:, #, {, [, &, *, !, |, >, ', ", %, @, `` `), wrap it in single or double quotes.
- set:
    name: message
    value: "Status: ready"   # the colon forces quoting
- set:
    name: pattern
    value: '^[A-Z]:.*'       # backslashes survive better in single quotes

Naming and casing conventions

ElementConventionExamples
slugkebab-case or camelCase, no spacessend-welcome, sendWelcome
namefree textSend welcome email
Variable names (set: name: …)camelCaseuserEmail, nextStep
Event names (emit: event: …)dot-separated, lowercaseapp.greeting.requested
Module names in runlowercasesecrets, collections, accessManager, text
The platform does not enforce most of these, but the visual editor, the Activity view, and the SDK all assume them — sticking to the conventions keeps tooling consistent.

Interpreted keywords

Inside do: and other instruction lists, these keys are interpreted by the runtime. Any other key is treated as an app or workspace automation call (see Visual Editor and YAML Mapping).
KeywordEffect
setAssign a variable.
deleteRemove a variable.
emitPublish an event.
fetchMake an HTTP request.
waitPause until an event arrives or a timeout elapses.
conditionsBranch on expressions. The keys of the map are the conditions themselves; default runs if none match.
repeatLoop over a collection (on:) or a fixed count (until:).
breakExit the current loop or the whole automation.
allExecute child branches in parallel.
try / catchCatch errors raised by child instructions.
runCall a built-in runtime module function.
runWorkflowCall another automation in the workspace.
commentFree-form annotation, ignored at runtime.
rateLimit, auth, createUserTopic, joinUserTopicSpecialized runtime instructions; see the table in Visual Editor and YAML Mapping.

Expressions: {{ … }} and {% … %}

Anywhere a value is expected, you can interpolate an expression.
  • {{ … }} evaluates and substitutes a single expression. The whole value is replaced by the result.
  • {% … %} evaluates an arithmetic or logical sub-expression while keeping the rest of the string.
- set:
    name: greeting
    value: "Hello, {{body.name}}"          # → "Hello, Alice"

- set:
    name: nextIndex
    value: "{% {{$index}} + 1 %}"          # → "3" when $index is 2

- conditions:
    "{{user.age}} >= 18":
      - set: { name: status, value: adult }
    default:
      - set: { name: status, value: minor }
The full expression and condition grammar is documented in Condition and Expression syntax — it covers comparison and logical operators, regular expressions, MongoDB-style matches, deep-merge, and the built-in helpers for dates, math, strings, and URL parsing.

Variable scopes

Variables live in different scopes with different lifetimes. Each scope is exposed as a top-level object in expressions.
ScopePrefix in expressionsLifetimeUse it for
Run / temporarynone ({{myVar}})One automation runLocal working values inside do.
Session{{session.x}}One user sessionState shared across runs of the same user session.
User{{user.x}}One userPer-user persistent state.
Global / workspace{{global.x}}Workspace, all usersShared counters, caches, feature flags.
Config{{config.x}}Workspace static configNon-sensitive parameters defined in the workspace index.yml.
Secret{{secret.x}}Workspace, encryptedSensitive values from Settings → Secrets.
Trigger input{{body}}, {{headers}}, {{query}}, {{pathParams}}, {{method}}, {{event}}One runInputs from the request or event that triggered the automation.
See Memory Architecture for the full picture, including persistence guarantees.

What the YAML editor reports

The Builder’s Monaco editor validates the YAML as you type, using the same schema the runtime applies on save.
  • Indentation / parsing errors are flagged on the offending line. Fix them before save — the editor blocks the save button.
  • Schema errors (unknown keyword, wrong type for a field) are surfaced with the path of the offending field.
  • Lint warnings (e.g. an unused variable, a duplicate slug) appear inline but do not block saving.
When in doubt, switch to the visual graph: nodes that the editor cannot render correspond to YAML the runtime would reject.

Triggers

Automations can be activated through different types of triggers, configured at the top of the automation graph:
When an automation activates its URL trigger, it becomes publicly available through a URL which you can copy from your Workspace graph or source code. You can then use this URL in external services that support webhooks.From inside the automation, 5 variables give access to input HTTP requests:
  • body: Request body
  • headers: Request headers
  • method: HTTP method (GET, POST, etc.)
  • query: URL query parameters
  • pathParams: Extracted path parameter values (when using path parameters like :id)
For multipart/form-data requests, uploaded files will be detailed within a body.<fileKey> object variable.
Example :
  {
    "originalname": "filename.pdf",
    "encoding": "7bit",
    "mimetype": "application/pdf",
    "size": 375966,
    "base64": "<file base 64>"
  }
By default, these HTTP requests will receive the automation output as a response body. However, an $http variable available inside the automation gives full control over the response:
- set:
    name: $http
    value:
      headers:
        content-type: application/json
      status: 200
You can also use this variable to implement Server-Sent Events (SSE) for streaming responses:
- set:
    name: $http
    value:
      chunk: # Data object that will be sent as an SSE event
        partial: "First part of response"
- set:
    name: $http
    value:
      chunk: # Another chunk
        partial: "Second part of response"
  • $http is only available in the URL-triggered automation (not in children calls)
  • Headers cannot be set after the first chunk is sent
  • When using SSE events, the automation output will also be sent as the last event
  • SSE automatically sets appropriate headers (Content-Type, Cache-Control, Connection)
For long-running SSE endpoints, you can configure a keep-alive to avoid timeouts:
- set:
    name: $http
    value:
      sseKeepAlive: 5000 # Keep-alive interval in milliseconds (minimum 5000ms)
After this instruction, a data: {"keepAlive": true} chunk will be regularly emitted until the connection ends.

Path Parameters

Webhook endpoints support path parameters for building RESTful APIs. Path parameters allow you to define dynamic URL segments that extract values from incoming requests.Basic Usage:
get-user
when:
  endpoint: "v1/users/:id"
do:
  - set:
      name: output
      value:
        userId: "{{pathParams.id}}"
When a request is made to /webhooks/{workspaceSlug}/v1/users/123, the automation receives:
  • pathParams.id = "123"
Multiple Parameters:
get-user-post
when:
  endpoint: "v1/users/:userId/posts/:postId"
do:
  - set:
      name: output
      value:
        user: "{{pathParams.userId}}"
        post: "{{pathParams.postId}}"
Request to /webhooks/{workspaceSlug}/v1/users/alice/posts/456 results in:
  • pathParams.userId = "alice"
  • pathParams.postId = "456"
Combined with Query and Body:
update-user
when:
  endpoint: "v1/users/:id"
do:
  - fetch:
      url: "{{config.apiUrl}}/users/{{pathParams.id}}"
      method: "{{method}}"
      body:
        name: "{{body.name}}"
        filter: "{{query.filter}}"
Multi-segment Parameters (wildcards):Use *paramName instead of :paramName when the value can contain slashes — for instance, model identifiers like openai/text-embedding-3-large or hierarchical paths.
get-model
when:
  endpoint: "v1/models/*model_id"
do:
  - set:
      name: output
      value:
        modelId: "{{pathParams.model_id}}"
Request to /webhooks/{workspaceSlug}/v1/models/openai/text-embedding-3-large yields:
  • pathParams.model_id = "openai/text-embedding-3-large"
A request to /webhooks/{workspaceSlug}/v1/models/gpt-4o (no slash) matches the same endpoint with pathParams.model_id = "gpt-4o".
Path Parameter Behavior:
  • Single-segment parameters use :paramName syntax (e.g., :id, :userId) — they match one URL segment and reject values containing /
  • Multi-segment parameters use *paramName syntax — they match one or more segments and let you capture values containing /
  • All defined parameters are required - requests missing parameters will not match
  • Parameter values are automatically URL-decoded
  • Exact match endpoints take priority over pattern endpoints
  • When multiple patterns could match, the first defined pattern wins
  • Patterns like message:stream (colon without preceding slash) are treated as exact matches, not patterns
Path parameters must be defined in the endpoint field, not in the automation slug.The automation slug (e.g., get-user) only supports letters, numbers, spaces, underscores, and hyphens. To use path parameters, you must explicitly set the endpoint field to your desired path pattern:
    slug: get-user  # Slug without path parameters
    when:
      endpoint: "v1/users/:id"  # Path parameters defined here
Using endpoint: true will expose the automation at the slug path, but the slug itself cannot contain : characters.
An automation can listen to a list of events. Whenever such events are received, the automation is executed and can access:
  • payload: Event payload data
  • source: Event source information (source IP, correlationId, userId, automation, etc.)
These events can be:
  • Native events: Generated automatically by the platform
  • Custom events: Emitted from automations in the same workspace
  • App events: Emitted from installed Apps
Example configuration:
when:
  events:
    - user-login
    - document-uploaded
Workspaces can only listen to a specific subset of native events. See the Supported Native Events section for details.
An automation can be regularly triggered based on cron expressions:
when:
  schedules:
    - '0 9 * * 1-5' # Run at 9:00 AM on weekdays
  • Automations can be scheduled at most every 15 minutes
  • Schedules use UTC timezone
  • When scheduled, the automation runs “on the hour” (e.g., a 20-minute schedule starting at 3:14 will run at 3:20, 3:40, etc.)
  • When successfully scheduled, a runtime.automations.scheduled event is emitted
A helpful tool for creating cron expressions is crontab.guru.

Memory Architecture

Automations can use and modify data across different memory scopes:
Available only during current execution
Access pattern: {{run.variable}} Run variables include execution context like:
  • run.date: Current timestamp
  • run.ip: Client IP address
  • run.automationSlug: Current automation identifier
  • run.correlationId: Unique ID for tracing related events
  • run.depth: Current automation depth in the stacktrace
  • run.trigger.type: Trigger type (event, endpoint, automation)
  • run.trigger.value: Trigger value (event name, endpoint path, etc.)
  • run.socketId: Current socket ID if connected by websocket
  • run.appSlug: Current app slug if running from an appInstance
  • run.appInstanceSlug: Current appInstance slug if applicable
  • run.parentAppSlug: Parent app slug if parent is also an appInstance
The run context is automatically removed 60 seconds after the last automation run.
Persistent for the authenticated user
Access pattern: {{user.variable}}User variables include:
  • user.id: Unique user identifier
  • user.email: User’s email address
  • user.authData: Authentication information
  • user.role: User’s role in the workspace
  • Custom user-specific data that persists across sessions
Available for the current user session
Access pattern: {{session.variable}}Session variables include:
  • session.id: Current session ID
  • Custom session data
Session variables store temporary user data:
  • Form inputs across multiple steps
  • Wizard progress state
  • Temporary preferences
For authenticated users, session expiration is defined by the Gateway API (default 1 month). For unauthenticated endpoint calls, sessions expire after 1 hour of inactivity.
Shared across all users and executions
Access pattern: {{global.variable}}Global variables include:
  • global.workspaceId: Current workspace ID
  • global.workspaceName: Current workspace name
  • global.apiUrl: Current API instance public URL
  • global.studioUrl: Current studio instance public URL
  • global.pagesUrl: Current workspace pages public URL
  • global.pagesHost: Current pages instance base domain
  • global.endpoints: Map of available endpoint slugs to URLs
  • global.workspacesRegistry: Map of public workspaces
  • Custom workspace-wide variables
Available for the current websocket connection
Access pattern: {{socket.variable}}Socket scope provides a temporary state local to a websocket connection, useful for separating state between multiple browser tabs. This context automatically expires after 6 hours without any updates.
Workspace and app configuration
Access pattern: {{config.variable}}Contains the workspace configuration defined in the workspace settings.
Read-only workspace information
Access pattern: {{$workspace.variable}}This read-only context holds the current workspace definition, allowing access to any of its sections (e.g., installed apps config via $workspace.imports.myApp.config).
Except for $workspace, all these contexts can be written to using the set instruction. Written data will be persisted and available in subsequent requests. However, when setting variables inside session/user contexts from an unauthenticated webhook, they will not be persisted.

Working with Variables

Inside your automation instructions, dynamic data can be injected by surrounding a variable name with double braces: {{some.variable.name}}. Variables can be created and modified using the set instruction and removed using the delete instruction. For objects or arrays, you can access specific properties:
# Basic property access
{{user.profile.name}}

# Dynamic property access using another variable
{{session.myObjectVariable[{{item.field}}]}}
If session.myObjectVariable equals {"mickey": "house"} and item.field equals mickey, the entire expression resolves to house.

Visual Editor and YAML Mapping

Every automation has two equivalent representations:
  • YAML — the source of truth, stored in the workspace and synchronized with Git.
  • Visual graph — a node-based editor that reads and writes the same YAML.
The visual editor never adds extra semantics: each node maps 1-to-1 to a DSUL instruction (or a trigger field). Switching between the two modes does not change the saved file.

Trigger nodes (Start)

The single Start node represents the automation’s when block. Its visual sub-labels reflect which trigger fields are populated.
Visual nodeSub-labelDSUL fieldNotes
Start → Webhook”Webhook”when.endpoint: true (or a custom string slug)Exposes the automation as POST /webhooks/<slug>.
Start → Eventevent names, comma-separatedwhen.events: [eventName, ...]The automation runs whenever a matching event is emitted on the workspace bus.
Start → Schedulecron expressionwhen.schedules: [cron, ...]Standard 5-field cron syntax.
Multiple triggers can coexist on the same Start node — e.g. an automation can be both a webhook and a scheduled job.

Instruction nodes

Each instruction node serializes to a single DSUL key. The table below lists every node available in the editor’s “Add instruction” panel and the YAML it produces.
Visual nodeDSUL keyMain fieldsUse it for
Set Variablesetname, valueAssign or update a variable in any scope.
Delete VariabledeletenameRemove a variable from a scope.
Emit Eventemitevent, payload, optional targetPublish an event on the workspace bus.
HTTP Requestfetchurl, method, headers, body, query, outputCall any HTTP API. Resolves $secret: references automatically.
Waitwaittimeout, oneOfPause until an event arrives or a timeout elapses.
Conditionsconditionsmap of expression: [instructions] plus optional defaultBranching. The visual editor renders one Branch node per key and a Merge node where branches reconverge. Full operator and helper grammar in Condition and Expression syntax.
Repeatrepeaton (collection) or until (count/expression), doIterate over a list or loop a fixed number of times. Inside the body, {{item}} and {{$index}} are available.
Breakbreakscope (automation | repeat), optional payloadExit early from the current loop or automation.
Note (Comment)commentstringDocumentation only — no runtime effect.
Parallel (All)alldo: [instructions]Execute branches concurrently and wait for all of them.
Try / Catchtrydo, catchRecover from errors raised by inner instructions.
Run Modulerunmodule, function, parameters, outputCall a built-in runtime module (e.g. secrets, collections).
Run WorkflowrunWorkflowworkflow, parameters, outputCall another automation in the same workspace.
Rate LimitrateLimitname, limit, window, outputEnforce a sliding-window rate limit.
Auth Tokenauthworkspace (bool), outputIssue a short-lived JWT for the current user or workspace.
Create User TopiccreateUserTopictopic, userIdsCreate a multi-user real-time topic.
Join User TopicjoinUserTopictopicSubscribe the current user to an existing topic.
Endoutput (top-level key)expressionThe single End node maps to the automation’s top-level output field — i.e. the value returned to the caller.

App and workspace automation calls

Beyond the built-in nodes above, the editor also lets you drop any imported app action or any other automation in the same workspace.
  • An imported app action is rendered as <App name> → <action> and serializes to the action’s slug, e.g. mySlackInstance.sendMessage.
  • A workspace automation call uses its slug directly.
In both cases the YAML is just the slug as a key, with parameters as the value:
- mySlackInstance.sendMessage:
    channel: "#general"
    text: "Hello"
The catalog of available app actions is read from the workspace’s installed imports; the catalog of workspace automations is read from the workspace itself.

Visual-only nodes

A few nodes appear in the graph but have no DSUL counterpart — they exist purely to organize the canvas:
  • Branch — one per key inside a conditions block; renders the condition expression.
  • Merge — converges all branches of a conditions or all block.
Switching to Code view is the only way to see these aren’t separate keys: they are computed from the structure of conditions / all.

Instructions

Once triggered, automations execute a sequence of instructions in order. Here are the available instructions:

Logic Instructions

Conditionally execute instructions based on variable values or expressions.
- conditions:
    '{{user.age}} >= 18':
      - set:
          name: status
          value: adult
    '{{user.age}} < 18':
      - set:
          name: status
          value: minor
    default:
      - set:
          name: status
          value: unknown
More details on condition syntax
Loop through items or execute instructions multiple times.
# Iterate through an array
- repeat:
    on: '{{users}}'
    do:
      - set:
          name: processedUsers[]
          value: '{{item.name}}'

# Execute a fixed number of times
- repeat:
    until: 5
    do:
      - set:
          name: counter
          value: '{% {{$index}} + 1 %}'
You can also process batches in parallel:
- repeat:
    on: '{{workQueue}}'
    batch:
      size: 3  # Process 3 items by 3 items  in parallel
      interval: 500  # Pause 500ms between batches
    do:
      - process:
          item: '{{item}}'
Stop execution of the current automation or loop.
- break:
    scope: repeat  # Breaks out of the nearest repeat loop

- break:
    scope: automation  # Stops the current automation

- break:
    scope: all  # Stops all parent automations too
    payload:
      reason: "Operation cancelled"
When break is meant to be handled from a parent automation’s try/catch, scope must be set to all.If using the instruction like this : - break: {}, it will default to scope: automation.
Execute multiple operations in parallel.
- all:
    - automation1: {}
    - automation2: {}
    - fetch:
        url: https://api.example.com/data
Handle errors gracefully.
- try:
    do:
      - riskyOperation: {}
    catch:
      - set:
          name: errorInfo
          value: "{{$error}}"
      - emit:
          event: operation-failed
          payload:
            error: "{{$error}}"
The $error variable is accessible both inside and outside the catch block.

Data Instructions

Create or update variables in different scopes.
# Simple variable assignment
- set:
    name: greeting
    value: "Hello, world!"

# Create or update object property
- set:
    name: user.profile.firstName
    value: "Jane"
Like everywhere else, you can also use expressions in the value parameter:
- set:
    name: counter
    value: '{% {{counter}} + 1 %}'
Remove variables when no longer needed.
- delete:
    name: temporaryData

Integration Instructions

Make HTTP requests to external APIs.
  # Basic GET request
  - fetch:
      url: https://api.example.com/users
      method: GET
      headers:
        Authorization: Bearer {{secret.apiToken}}
      output: apiResponse
  
  # POST request with JSON body
  - fetch:
      url: https://api.example.com/users
      method: POST
      body:
        name: "New User"
        email: "user@example.com"
      output: createResponse
Trigger events for UI updates or other automations.
- emit:
    event: user-registered
    payload:
      userId: "{{user.id}}"
      timestamp: "{{run.date}}"        
Pause execution until a specific event is received.
- emit:
    event: start-processing
    payload:
      documentId: "{{documentId}}"

- wait:
    oneOf:
      - event: processing-complete
        filters:
          payload.documentId: "{{documentId}}"
    timeout: 30  # Defaults to 20 seconds
    output: processingResult
Control resource usage with rate limiting.
- rateLimit:
    name: ExternalAPICall
    window: 60  # In seconds (1 minute)
    limit: 5    # Maximum 5 calls per minute
    consumer: "{{user.id}}"  # Per-user limit
    output: limits
- conditions:
    "{{limits.ok}}":
      - fetch:
          url: https://api.example.com/data
    default:
      - emit:
          event: rate-limit-exceeded
          payload:
            retryAfter: "{{limits.retryAfter}}"
            limit: "{{limits.limit}}"
            window: "{{limits.window}}"
            remaining: "{{limits.remaining}}"
            consumer: "{{limits.consumer}}"

Other Instructions

Generate authentication tokens for internal API calls. This token cannot be used outside of automations, and is specifically intented for fetch consumption (as an Authorization header).
- auth:
    workspace: true
    output: jwt
- fetch:
    url: https://api.studio.prisme.ai/v2/workspaces/123/webhooks/someAutomation
    headers:
      Authorization: Bearer {{jwt.jwt}}
    output: apiResponse
When fetching a Prismeai automation endpoint with such workspace token, a {{run.authenticatedWorkspaceId}} variable (which cannot be manually set) will be made available to securely check calling workspace.
You can also forward source workspace authentication to a subsequent fetch :
- fetch:
    url: https://api.studio.prisme.ai/v2/workspaces/123/webhooks/someAutomation
    auth:
      prismeai:
        forwardWorkspaceAuth: true
    output: apiResponse
Manage user subscription topics.User topics allow sending events to multiple users without knowing who they are in advance, automatically granting them read access to these events without requiring any API Key.
# Create a user topic
- createUserTopic:
    topic: project-updates
    userIds: 
      - "{{user1Id}}"
      - "{{user2Id}}"

# Add users to a topic
- joinUserTopic:
    topic: project-updates
    userIds: # Defaults to current user.id
      - "{{newUserId}}"
User topics allow sending events to multiple users without knowing who they are in advance.

Run instruction

Run is a generic instruction allowing you to call runtime modules.
These are lightweight NodeJS packages offering various methods for use cases needing raw Javascript for better performances than standard automations.
Example :
- run:
    module: collections
    function: create
    parameters:
      collection: 'someCollection'
      data: {}
    onError: break
    output: output
Parameters :
  • module : Module name
  • function : Function name
  • parameters : Function parameters object
  • onError : Exception handling behaviour
    • break will break current automation with given exception (default)
    • emit will emit an error event but continue current automation
    • continue will only return the error and continue current automation

Embed JavaScript or Python with the Custom Code app

Need to run arbitrary code inline (parsing, hashing, reshaping)? Install the Custom Code app and use Custom Code.run to invoke a function you defined in YAML.

Collections

Store, query, and manage structured data with MongoDB-style queries. This module is generally meant to be used through the Collection application.

Collections Module Reference

Functions: create, findMany, updateOne, deleteOne, aggregate, and more

Secrets

Securely store and retrieve sensitive values (API keys, tokens, credentials) at runtime, with automatic redaction from logs.

Secrets Module Reference

Functions: set, get, delete — scopes: workspace, user

Access Manager

Manage organization service account tokens at runtime with in-memory secret caching and event-driven invalidation.

Access Manager Module Reference

Functions: getServiceAccountToken, createServiceAccount, rotateServiceAccountSecret, deleteServiceAccount

Text

Pure-JS text processing utilities for splitting text into chunks with configurable separators and overlap.

Text Module Reference

Functions: splitText

Instruction Reference

Quick lookup tables for every built-in instruction. For each one: the full parameter list (with type, default, and notes), the value left in output (when applicable), the errors it raises, and the related instructions you typically chain it with.

set

Assigns a value to a variable in any scope.
ParameterTypeDefaultDescription
namestring (required)Target variable. Supports dotted paths (user.profile.name) and array append (items[]).
valueany (required)Value to assign. Expressions are evaluated.
typereplace | merge | pushreplacemerge deep-merges objects/arrays; push appends to an array.
lifespannumber (seconds)session/run lifetimeTTL for the variable. After expiry the variable is unset.
Output: none. Raises: none. Often chained with: delete, conditions, emit.

delete

Removes a variable.
ParameterTypeDefaultDescription
namestring (required)Variable to remove. Dotted paths supported.
Output: none. Raises: none.

emit

Publishes an event on the workspace event bus.
ParameterTypeDefaultDescription
eventstring (required)Event name. Convention: app.<thing>.<verb> (dot-separated, lowercase).
payloadobject{}Event data.
target.userTopicstringDeliver only to the named user topic (see createUserTopic).
target.sessionIdstringDeliver only to events streams scoped to that session.
target.userIdstringDeliver only to streams scoped to that user.
target.currentSocketbooleanfalseDeliver only on the socket that triggered this run (useful for SSE replies).
options.persistbooleantrueWhen false, the event is broadcast but not stored — invisible in Activity.
Output: none. Raises: none. Often chained with: wait, runWorkflow.

fetch

Calls an HTTP endpoint.
ParameterTypeDefaultDescription
urlstring (required)Absolute or workspace-relative URL. $secret: references are resolved transparently.
methodGET | POST | PUT | PATCH | DELETEGETHTTP method.
headersobject{}Request headers.
queryobject{}Query string parameters. Merged with any present in url.
bodyanyRequest body. Serialized as JSON unless Content-Type says otherwise.
multipartarrayMultipart/form-data fields (file uploads). See the Fetch accordion above.
auth.basic.user / auth.basic.passwordstringHTTP Basic auth.
auth.awsv4objectAWS SigV4 signing. See the Fetch accordion above.
outputModebody | detailed_response | base64 | data_urlbodyShape of the value left in output.
streamobjectEmit each SSE chunk as an event instead of buffering. See the Fetch accordion above.
emitErrorsbooleanfalseWhen true, HTTP errors are caught and emitted as prismeai.fetch.error events instead of aborting the run.
outputstringVariable name receiving the response.
Output: the response body, or { body, headers, status } if outputMode: detailed_response. Raises: network errors, timeout, non-2xx HTTP (unless emitErrors). Often chained with: set, conditions, repeat (for streams).

wait

Blocks the automation until a matching event arrives or a timeout elapses.
ParameterTypeDefaultDescription
oneOf[].eventstring (required)Event name to wait for.
oneOf[].filtersobject{}Match conditions on the event payload (dotted paths).
timeoutnumber (seconds)20Maximum wait time.
outputstringVariable receiving the matching event ({ event, payload }).
Output: the event, or null if the timeout elapsed. Raises: none. Often chained with: emit (initiate the request, then wait for the reply).

conditions

Branches on expressions. Structure:
- conditions:
    '<expression>':
      - <instructions>
    '<other expression>':
      - <instructions>
    default:
      - <instructions>
Branches are evaluated in declaration order. The first one whose expression is truthy runs; if none match, default runs (if present). See Condition and Expression syntax for operators and helpers. Output: none. Raises: expression evaluation errors. Often chained with: set, emit, break.

repeat

Iterates over a collection or repeats a fixed number of times.
ParameterTypeDefaultDescription
onexpressionCollection to iterate. Exclusive with until.
untilnumber | expressionNumber of iterations, or an expression that stops the loop when truthy. Exclusive with on.
doarray (required)Instructions to execute each iteration.
batch.sizenumber1Items processed in parallel per batch.
batch.intervalnumber (ms)0Pause between batches.
Inside do, {{item}} is the current element and {{$index}} the 0-based index. Output: none. Raises: none. Often chained with: break, all.

break

Exits a loop or the whole automation.
ParameterTypeDefaultDescription
scoperepeat | automation | allautomationrepeat exits the nearest loop; automation ends the current automation; all propagates to parent automations through try/catch.
payloadobjectForwarded as the automation output.

all

Runs branches in parallel.
ParameterTypeDefaultDescription
(positional list)array of instructions (required)Each entry is an independent branch. Run concurrently.
all returns once every branch has completed. Errors in one branch do not cancel the others — wrap with try/catch if you need fail-fast.

try / catch

Catches errors raised by inner instructions.
ParameterTypeDefaultDescription
doarray (required)Protected block.
catcharrayRecovery block. Receives {{$error}} ({ name, message, details }).
If catch is omitted, the error is silently swallowed.

run

Calls a built-in runtime module.
ParameterTypeDefaultDescription
modulestring (required)secrets, collections, accessManager, text. See Modules.
functionstring (required)Module function name.
parametersobject{}Function inputs. Shape depends on the function.
outputstringVariable receiving the return value.
onErrorthrow | continuethrowWhen continue, errors are returned in output as { error: '<code>' } instead of aborting.
Output: the function’s return value (varies). Raises: module-specific errors (not_found, user_required, …). See each module’s reference page.

runWorkflow

Calls another automation in the same workspace.
ParameterTypeDefaultDescription
workflowstring (required)Slug of the target automation.
parametersobject{}Inputs passed to the target’s arguments.
outputstringVariable receiving the target’s output.
waitbooleantrueWhen false, fire-and-forget — the parent continues without waiting.
Output: the target automation’s output. Raises: propagates errors from the target (unless wait: false).

rateLimit

Enforces a sliding-window rate limit.
ParameterTypeDefaultDescription
namestring (required)Identifier shared across automations that should share the limit.
limitnumber (required)Maximum events in the window.
windownumber (seconds, required)Sliding-window size.
consumerexpressionglobalPartition key (e.g. "{{user.id}}" for per-user limits).
outputstringVariable receiving { ok, retryAfter, remaining, limit, window, consumer }.
Output: the limit state. Does not raise — branch on output.ok to decide what to do.

auth

Issues a short-lived JWT for internal calls.
ParameterTypeDefaultDescription
workspacebooleanfalseWhen true, the JWT carries workspace identity. The receiving automation can read {{run.authenticatedWorkspaceId}}.
outputstringVariable receiving { jwt: '<token>' }.
The token is only valid for fetch calls back to the platform — it cannot authenticate against external systems.

createUserTopic / joinUserTopic

Manage real-time delivery topics.
InstructionParameterTypeDescription
createUserTopictopicstringTopic name (workspace-scoped).
createUserTopicuserIdsarray of stringsInitial subscribers.
joinUserTopictopicstringTopic name. The current user is added.
Once a user is subscribed, emit … target: { userTopic: '<topic>' } delivers events to all members in real time.

comment

Free-form annotation. No runtime effect. Renders as a yellow sticky note in the visual editor.
- comment: "Skip processing for test users — see Jira-1234"

Errors raised by all instructions

Any instruction can raise the following platform errors regardless of its own logic:
ErrorWhen
WorkspaceQuotaExceededThe workspace has hit its event/run quota.
WorkflowTimeoutErrorThe whole automation run exceeded its max duration.
ConfigurationErrorAn expression references a variable scope that is unavailable in the current trigger (e.g. {{user}} in a cron).
Wrap calls in try/catch to recover from these.

Condition and Expression syntax

Conditions allow you to execute different instructions based on contextual information. You can use a powerful expression syntax in conditions and anywhere with {% ... %} delimiters.

Basic Operators

# Comparison operators
{{someAge}} > 18
{{someAge}} >= 18
{{someAge}} < 18
{{someAge}} <= 18
{{someAge}} == 18
{{someAge}} = 18
{{cityName}} = "Toulouse"

# Inequality
{{someAge}} !== 18
{{someAge}} != 18

# String matching
"hello" matches "hel"
"hello" matches {{someArray}}

# Variable checking
{{testedVariable}}      # Is this variable defined?
!{{testedVariable}}     # Is this variable empty?

# Membership testing
{{someValue}} in {{someList}}
{{someKey}} in {{someObject}}
{{someKey}} not in {{someObject}}
{{someKey}} not in "my,string,list"

# Type checking
isArray({{someVariable}})
isObject({{someVariable}})
isString({{someVariable}})
isNumber({{someVariable}})

Logical Operators

# AND operators
{{someAge}} >= 18 and {{cityName}} == "Toulouse"
{{someAge}} >= 18 && {{cityName}} == "Toulouse"

# OR operators
{{someAge}} >= 18 or {{cityName}} == "Toulouse"
{{someAge}} >= 18 || {{cityName}} == "Toulouse"

# Grouping with parentheses
{{someCity}} == "Paris" || ({{someAge}} >= 18 && {{cityName}} == "Toulouse")

# Negation
{{someCity}} == "Paris" || ! ({{someAge}} >= 18 && {{cityName}} == "Toulouse")
{{someCity}} == "Paris" || not ({{someAge}} >= 18 && {{cityName}} == "Toulouse")

Regular Expressions

"luke.skywalker@gmail.com" matches regex("luke|skywalker")
"luke.skywalker@gmail.com" matches regex(/luke|skywalker/)

MongoDB-like Conditional Matches

jsonmatch({{object}}, {{condition}})
Example condition:
{
  "$or": [
    {
      "test": "unknown"
    },
    {
      "one": {
        "$eq": "three"
      }
    }
  ]
}

Deep merge objects

This functiun helps deep merge two objects.
deepmerge({{firstObject}}, {{secondObject}})
It also accepts an option object which can slightly modify the merge behaviour.
deepmerge({{firstObject}}, {{secondObject}}, {{options}})
Example options:
{
  "concatStrings": true // Rather than replacing string from the same keys, concatenate them if possible.
}

Date Functions

Parsing and Access

date("2022-04-13T08:00:05.493Z").hour == 8
date({{mydate}}).minute > 34 && date({{mydate}}).minute < 37
date({{mydate}}).second >= 5
date({{mydate}}).date == 23
date({{mydate}}).month >= 6 && date({{mydate}}).month < 10
date({{mydate}}).year == 2022
date({{mydate}}).day == 3
date({{mydate}}).day in {{allowedDays}}
date({{mydate}}).ts == 1649836805493
date({{mydate}}).iso == '2022-04-13T08:00:05.493Z'
Note: Tested values are UTC based, and day starts on 0 for Sunday (so 3 is Wednesday).

Formatting

date("2023-03-31T17:07:23.975Z", "l") == "3/31/2023"
date("2023-03-31T17:07:23.975Z", "DD/MM/YYYY") == "3/31/2023"
date("2023-03-31T17:07:23.975Z", "LT") == "7:07 PM"
date("2023-03-31T17:07:23.975Z", "LT", "fr") == "19:07"
date("2023-03-31T17:07:23.975Z", "lll", "fr") == "31 mars 2023 19:07"
date("2023-03-31T17:07:23.975Z", "l LT") == "3/31/2023 7:07 PM"
date("2023-03-31T17:07:23.975Z", "LT", "fr", "America/New_York") == "13:07"
See all formatting options on Day.js documentation.

Math Functions

Operators

1+1
1+{{someVariable}}
{{firstVar}} * {{secondVar}}
({{firstVar}} * {{secondVar}} + 10) / 2

Functions

rand(50, 150)  # Random number between 50 and 150
rand()  # Random float between 0 and 1

number("42")  # 42 — parse a string to integer

round(10.2)  # 10
round(10.2, 1)  # 10.2
round(10.26, 1)  # 10.3

floor(10.9)  # 10
floor(10.26, 1)  # 10.2

ceil(10.1)  # 11
ceil(10.9)  # 11

min(1, 2, 3)  # 1
max(1, 2, 3)  # 3
min({{numbersArray}})  # smallest value of the array
max(0, {{maybeNegative}})  # clamp to 0 minimum

String Functions

# convert string to lower case
lower({{foo}})

# convert string to upper case
upper({{foo}})

# Truncate string
truncate({{str}})
truncate({{str}}, 42)
truncate({{str}}, 42, ' etc')
truncate({{str}}, {{len}}, {{ellipsis}})

# JSON parsing/stringifying
json('{"foo": "bar"}')  # Object { foo: "bar" }
json({"foo": "bar"})  # String '{"foo":"bar"}'

# Unsafe JSON parsing: never raises exception, try to extract a JSON object or array when surrounded by other text
unsafejson('Voici un tableaux: ["un"] !') # ["un"]
unsafejson('Voici un objet :\n ```{"un": 1}```\n !') # {"un": 1}

# String manipulation
split('one,two,three', ',')  # Array ["one", "two", "three"]
join(['one', 'two', 'three'], ',')  # String "one,two,three"
replace('hello world', 'world', 'there')  # String "hello there"

# Array slicing
slice({{myArray}}, 0, 3)    # First 3 elements
slice({{myArray}}, 2)       # From index 2 to end
slice({{myArray}}, 0, -1)   # All except the last element

# Sanitize html
sanitize('<b>Bonjour <u>toi</u></b> !') # &#60;b&#62;Bonjour &#60;u&#62;toi&#60;/u&#62;&#60;/b&#62; !

# Remove complex unicode characters (non BMP, non UTF16 surrogates)
sanitize('Bonjour 🌍 ! Ça va ? 我爱你 ❤️') # Bonjour  ! Ça va ? 我爱你 ❤️

# Base64 encoding
base64("Hello World")  # String "SGVsbG8gV29ybGQ="
base64({{someBuffer}})  # Base64 encode a buffer variable

# Generate a random UUID (without dashes)
uuid()  # String "550e8400e29b41d4a716446655440000"

URL parsing

Parse URL search params :
URLSearchParams("key1=value1&key2=value2").asJSON  # Object
URLSearchParams({foo: "bar", abc: "xyz"}).asString  # String "foo=bar&abc=xyz"
Or parse a complete URL as an object :
URL("https://user:password@www.google.fr/some/path/?query=string&foo=bar#anchor")
This returns :
{
  href: 'https://user:password@www.google.fr/some/path/?query=string&foo=bar#anchor',
  origin: 'https://www.google.fr',
  protocol: 'https:',
  username: 'user',
  password: 'password',
  host: 'www.google.fr',
  hostname: 'www.google.fr',
  port: '',
  pathname: '/some/path/',
  search: '?query=string&foo=bar',
  searchParams: { "query": "string", "foo": "bar" },
  hash: '#anchor'
}
Or directly access a specific field :
URL("https://user:password@www.google.fr/some/path/?query=string&foo=bar#anchor").hostname # www.google.fr

Arguments

When calling a native instruction or another automation, different arguments can be transmitted. These graphical inputs are not reserved to native instructions, but can also be configured for your own custom automations by specifying expected arguments and their types.
testArguments:  
  do: []  
  name: testArguments
  arguments:
    someString:
      type: string
    someNumber:
      type: number
    someObject:
      type: object
      properties:
        someStringField:
          type: string
    someOtherObject:
      type: object
      properties:
        nestedObject:
          type: object
          properties:
            someField:
              type: number
    someStringArray:
      type: array
      items:
        type: string
    someObjectArray:
      type: array
      items:
        type: object
        properties:
          fieldA:
            type: string
    someRawJSON:
      type: object
      additionalProperties: true          
    someToken:
      type: string        
      secret: true
The someToken argument defined with secret: true is automatically redacted from native runtime events to avoid accidental leaks of sensitive information.

Arguments Validation

Automation arguments can be validated during execution by enabling validateArguments: true:
slug: test
name: test
do: []
when:
  endpoint: true
output: '{{body}}'
arguments:
  body:
    type: object
    required:
      - str
    properties:
      str:
        type: string
      uri:
        type: string
        format: uri
      obj:
        type: object
        required:
          - un
        properties:
          un:
            type: string
            pattern: '^[a-z]+$'
validateArguments: true
Arguments support various validation formats including date, url, time, password, etc. Validation errors immediately stop current and parent automations.

Advanced Automation Patterns

Implement secure webhook endpoints for third-party integrations:
# Webhook automation
slug: hubspot-webhook
name: Hubspot Deal Created
when:
  endpoint: true
do:
  # Validate webhook signature
  - conditions:
      '!{{headers["x-hubspot-signature"]}}':
        - set:
            name: $http
            value:
              status: 401
        - break:
            scope: automation
  
  # Process webhook data
  - set:
      name: newDeal
      value: "{{body.deal}}"
  
  # Notify team on Slack
  - fetch:
      url: "{{config.slackWebhookUrl}}"
      method: POST
      body:
        text: "New deal created: {{newDeal.name}} ({{newDeal.amount}})"
      output: slackResponse
  
  # Return success response
  - set:
      name: output
      value:
        success: true
        message: "Webhook processed successfully"

Supported Native Events

Workspaces can listen to a specific subset of native events:

Best Practices

Create maintainable automation structures:
    Break complex flows into smaller automationsUse events for communication between modulesCreate reusable patterns for common tasksDocument automation purposes and interfaces
Build robust fault tolerance:
    Use try/catch blocks for risky operationsImplement appropriate retry strategiesProvide informative error messagesCreate fallback paths for critical operations
Handle data appropriately across scopes:
    Use appropriate memory scopes for different data needsClean up temporary variables when finishedInitialize variables before using themBe mindful of persistence requirements
Keep your automations secure:
    Store sensitive data in secretsValidate inputs from external sourcesImplement rate limiting for external APIsUse proper authentication for API calls
Ensure efficient execution:
    Use parallel processing for independent operationsImplement batching for large data setsCache results when appropriateMonitor execution times and optimize bottlenecks
Validate automation functionality:
    Test with representative data samplesVerify error handling pathsTest edge cases and unexpected inputsUse Activity view to review execution history

Next Steps

Learn how React pages call endpoints and emit workspace events
Trace automation runs with Activity and correlation IDs
Learn more about deployment strategies