---
title: "update websocket trigger"
method: POST
path: "/w/{workspace}/websocket_triggers/update/{path}"
tags: ["websocket_trigger"]
---

# update websocket trigger

`POST /w/{workspace}/websocket_triggers/update/{path}`

## Path parameters

- `workspace` string, required
- `path` string, required

## Request body

- EditWebsocketTrigger
  - `url` string, required — The WebSocket URL to connect to (can be a static URL or computed by a runnable)
  - `path` string, required — The unique Windmill path for this trigger. Must be of the form `u/<user>/<path>` or `f/<folder>/<path>`. This is the trigger object path, not the HTTP route path.
  - `script_path` string, required — Path to the script or flow to execute when a message is received
  - `is_flow` boolean, required — True if script_path points to a flow, false if it points to a script
  - `filters` TriggerFilter[], required — Filters to match incoming messages (only matching messages trigger the script). Each entry is either a leaf `{key, value}` (top-level field) or `{path, value}` (dotted path into nested objects), or a group `{any_of: [...]}` / `{all_of: [...]}` / `{none_of: [...]}` nesting more entries. Entries at the top level are combined with `filter_logic`.
    - union — Either a leaf filter, matching a field of the message (parsed as JSON) against a value by equality (or superset, when the value is an object or array) — addressed by `key` for a top-level field or `path` for a dotted path into nested objects — or a group nesting sub-filters under a boolean operator (`none_of` matches when none of its sub-filters do).
      - object
        - `key` string, required
        - `value` unknown, required
      - object
        - `path` string, required — Dotted path into nested objects, e.g. `a.b.c`. Does not traverse arrays.
        - `value` unknown, required
      - object
        - `any_of` TriggerFilter[], required
      - object
        - `all_of` TriggerFilter[], required
      - object
        - `none_of` TriggerFilter[], required
  - `filter_logic` 'and' | 'or' — Logic to apply when evaluating the top-level filters. 'and' requires all of them to match, 'or' requires any of them to match. Nested `any_of`/`all_of`/`none_of` groups carry their own logic.
  - `initial_messages` WebsocketTriggerInitialMessage[], nullable — Messages to send immediately after connecting (can be raw strings or computed by runnables)
    - union
      - object
        - `raw_message` string, required
      - object
        - `runnable_result` object, required
          - `path` string, required
          - `args` ScriptArgs, required — The arguments to pass to the script or flow
          - `is_flow` boolean, required
  - `url_runnable_args` ScriptArgs — The arguments to pass to the script or flow
  - `can_return_message` boolean, required — If true, the script can return a message to send back through the WebSocket
  - `can_return_error_result` boolean, required — If true, error results are sent back through the WebSocket
  - `heartbeat` WebsocketHeartbeat
    - `interval_secs` integer, required — Interval in seconds between heartbeat messages
    - `message` string, required — Message to send as heartbeat. Use {{state}} as a placeholder for a value extracted from incoming messages (see state_field).
    - `state_field` string — Optional. Top-level JSON field to extract from incoming messages. The extracted value replaces {{state}} in the heartbeat message.
  - `error_handler_path` string — Path to a script or flow to run when the triggered job fails
  - `error_handler_args` ScriptArgs — The arguments to pass to the script or flow
  - `retry` Retry — unresolved $ref
  - `permissioned_as` string — The user or group this trigger runs as. Used during deployment to preserve the original trigger owner.
  - `preserve_permissioned_as` boolean — When true and the caller is a member of the 'wm_deployers' group, preserves the original permissioned_as value instead of overwriting it.
  - `labels` string[]

## Response `200`

websocket trigger updated

---

[API](https://skmtc.net/windmill/apis/windmill-api.md) · [All operations](https://skmtc.net/windmill/apis/windmill-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/windmill/windmill-api/revisions/096d6a8830b7/schema)
