---
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` object[], required — Array of key-value filters to match incoming messages (only matching messages trigger the script)
    - `key` string, required
    - `value` unknown, required
  - `filter_logic` 'and' | 'or' — Logic to apply when evaluating filters. 'and' requires all filters to match, 'or' requires any filter to match.
  - `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.dev/windmill/apis/windmill-api.md) · [All operations](https://skmtc.dev/windmill/apis/windmill-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/windmill/windmill-api/revisions/d64d91d392b3/schema)
