---
title: "Create Trigger Rule"
method: POST
path: "/trigger-rules"
tags: ["trigger-rules"]
---

# Create Trigger Rule

`POST /trigger-rules`

## Request body

- CreateTriggerRuleRequest — Create a platform-agnostic trigger rule. ``channel_id`` is a platform channel identifier or the sentinel ``"all"`` for every channel in the integration.
  - `integration_id` string, required — Slack or Teams integration instance for this rule.
  - `trigger_condition_type` 'MESSAGE_DATA' | 'CHANNEL_JOIN', required — The type of condition for a self-serve trigger.
  - `context_source` 'CHANNEL_TOPIC' | 'CHANNEL_PURPOSE' | 'MESSAGE_CONTENT' | 'MESSAGE_THREAD_CONTENT' | 'ALL', required
  - `channel_id` string, required — Platform channel id, or "all" for every channel.
  - `conditions` TriggerConditionPayload[] — Conditions that must match for the rule to fire.
    - `field` 'sender_email' | 'sender_name' | 'message_text' | 'channel_name' | 'sender_id' | 'channel_topic' | 'channel_purpose', required
    - `operator` 'contains' | 'starts_with' | 'ends_with' | 'equals' | 'not_equals' | 'does_not_contain', required
    - `value` string, required
  - `resident_agent_template_id` string, nullable — Template that seeds a worker when this rule matches. Only meaningful for CHANNEL_JOIN rules; verified to belong to your organization.

## Response `201`

Successful Response

- TriggerRuleResponse
  - `id` string, required
  - `organization_id` string, nullable, required
  - `integration_id` string, nullable, required
  - `trigger_condition_type` string, required
  - `context_source` string, required
  - `channel_id` string, required
  - `conditions` TriggerConditionResponse[], required
    - `id` string, required
    - `field` string, required
    - `operator` string, required
    - `value` string, required
  - `resident_agent_template_id` string, nullable, required
  - `created_at` string, date-time, required
  - `created_by_user_uuid` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/traversal/apis/fastapi.md) · [All operations](https://skmtc.net/traversal/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/traversal/fastapi/revisions/2134ebffd1ef/schema)
