---
title: "Start the routine from a message in a connected chat [write]"
method: PUT
path: "/routines/{id}/channel-trigger"
---

# Start the routine from a message in a connected chat \[write\]

`PUT /routines/{id}/channel-trigger`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/routines/{id}/channel-trigger`
- Auth: HTTP bearer

A message starts a run when it is on the connection, in `thread_id` when one is given, and starts with `text_prefix` when one is given (leading mentions of the bot and letter case are ignored). Only messages from the person the routine belongs to start a run: the person who connected the chat, or a chat identity they linked to the same account. Anyone else's message is routed as if there were no trigger. The text after the prefix is added to the run's first message under the label "Input for this run:". The run is a task of the routine's creator (trigger_context {type:"channel", connection_id, thread_id}), and when its turn ends its last message is posted, once, in the conversation the message came from, with a link to the run. A message that started a run is sent nowhere else. One message starts at most one run; when several routines match, the one naming a thread and then the longest prefix wins. A paused or archived routine starts nothing, and more than 30 runs of one routine in a minute are dropped. Only the routine's creator can set the trigger (403 otherwise), on a connected chat of their own in this workspace (404 otherwise). `thread_id` must be a conversation on that connection and `text_prefix` 1 to 200 characters (400 otherwise). Setting a trigger replaces the earlier one. An archived routine answers 409.

## Path parameters

- `id` string, required

## Request body

- object
  - `connection_id` string, required
  - `thread_id` string
  - `text_prefix` string

## Response `200`

OK

- object
  - `channel_trigger` object, required
    - `routine_id` string, required
    - `connection_id` string, required
    - `thread_id` string, nullable, required: The one conversation whose messages start a run; null for every conversation on the connection
    - `text_prefix` string, nullable, required: What a message has to start with to start a run; null for every message
    - `created_at` string, required
    - `last_matched_at` string, nullable, required

## Other responses

- `default`: Error — { error: { code, message, request_id } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/routines/:id/channel-trigger/put.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/0d435187cd55?raw)
