> ## Documentation Index
> Fetch the complete documentation index at: https://docs.platform.nora.my/llms.txt
> Use this file to discover all available pages before exploring further.

# nora triggers

> Trigger 블록 관리 — Flow 의 API·웹훅·스케줄 진입.

Trigger 가 Flow 시작 방식. 세 종류: `api` (SDK/CLI 에서 호출), `webhook` (외부 HTTP POST), `schedule` (크론 기반).

## 명령

| 명령                                    | 설명                             |
| ------------------------------------- | ------------------------------ |
| `triggers create --kind <k>`          | Trigger 블록 추가.                 |
| `triggers update <trigger-id>`        | 필드 패치 (많은 `--set-*` 플래그).      |
| `triggers edit <trigger-id>`          | Trigger JSON 을 `$EDITOR` 에 열기. |
| `triggers delete <trigger-id>`        | Trigger 제거.                    |
| `triggers secret rotate <trigger-id>` | 새 웹훅/API 서명 시크릿 발급.            |

## `triggers create`

```bash theme={null}
nora triggers create --kind webhook --name "customer-events"
```

플래그:

* `--kind` (필수) — `api` / `webhook` / `schedule`.
* `--name <n>` — 표시 이름.
* `--config <json>` — 특정 종류용 인라인 설정.
* `--x <n>`, `--y <n>` — 캔버스 위치.

명령이 생성된 Trigger 의 ID 인쇄 (그리고 `webhook`/`api` 에는 초기 시크릿 — 지금 복사; 한 번만 표시).

## `triggers update`

```bash theme={null}
nora triggers update tr_events \
  --set-kind schedule \
  --set-schedule-mode preset \
  --set-period daily \
  --set-time 09:00 \
  --set-timezone Asia/Seoul
```

Update 플래그가 큼 — 아래 그룹핑.

### Update 플래그 — 그룹핑

**정체성**

* `--set-name <n>`
* `--set-kind api|webhook|schedule`
* `--set-x <n>`, `--set-y <n>`, `--set-width <n>`

**Schedule 설정** (kind = `schedule`)

* `--set-schedule-mode preset|cron`
* `--set-cron <expr>` — mode = `cron` 용, 예: `"0 9 * * *"`.
* `--set-period daily|weekly|monthly|yearly` — mode = `preset` 용.
* `--set-time HH:MM` — preset 용.
* `--set-day-of-week 1..7` — weekly 용.
* `--set-day-of-month 1..31` — monthly 용.
* `--set-month-of-year 1..12` — yearly 용.
* `--set-interval <n>` — 간격 카운트.
* `--set-timezone <IANA>` — 예: `America/Los_Angeles`.
* `--set-schedule-input <text>` — 스케줄 실행당 주입되는 페이로드.
* `--set-schedule-thread-id <id>` — 채팅 Agent 용, 게시할 스레드.
* `--set-schedule-user-id <id>` — 사용자 귀속.
* `--set-schedule-tts true|false` — text-to-speech 입력으로 다룸.

**Webhook 설정** (kind = `webhook`)

* `--set-webhook-slug <s>` — 경로 접미사 (URL 이 `.../trigger/webhook/<slug>` 됨).
* `--set-webhook-input-path <json-path>` — 본문에서 입력 추출.
* `--set-webhook-image-path <json-path>` — 이미지 데이터 추출.
* `--set-webhook-audio-path <json-path>` — 오디오 데이터 추출.
* `--set-webhook-auth-kind <k>` — `none` / `secret` / `header`.
* `--set-webhook-auth-header <name>` — `header` auth 의 헤더 이름.

**API 설정** (kind = `api`)

* `--set-api-slug <s>` — 경로 접미사.
* `--set-api-auth-kind <k>` — `none` / `secret` / `header`.
* `--set-api-auth-header <name>`.

**벌크**

* `--patch <json>` — 임의 병합.

설정 패치가 기존 설정에 deep-merge.

## `triggers edit`

```bash theme={null}
nora triggers edit tr_events
```

`$EDITOR` 에 전체 JSON. 저장으로 적용.

## `triggers delete`

```bash theme={null}
nora triggers delete tr_events
```

## `triggers secret rotate`

```bash theme={null}
nora triggers secret rotate tr_events
```

새 서명 시크릿 발급. 평문 한 번 인쇄 — 호출자에 복사. 이전 시크릿이 60분간 계속 동작해 다운타임 없이 호출자 업데이트 가능.

스케줄로 로테이션 (분기별 흔함), 또는 누출 의심 즉시.

## 레시피

### 매일 오전 9시 서울 시간 스케줄 추가

```bash theme={null}
TR=$(nora triggers create --kind schedule --name "daily-9am" | jq -r '.id')

nora triggers update $TR \
  --set-schedule-mode preset \
  --set-period daily \
  --set-time 09:00 \
  --set-timezone Asia/Seoul \
  --set-schedule-input "일일 롤업 — 어제 티켓 요약"
```

Flow 배포 — 스케줄 발화 시작.

### CMS 용 웹훅 트리거 추가

```bash theme={null}
TR=$(nora triggers create --kind webhook --name "cms-hook" | jq -r '.id')

nora triggers update $TR \
  --set-webhook-slug cms \
  --set-webhook-input-path payload.body \
  --set-webhook-auth-kind secret

nora triggers secret rotate $TR  # 시크릿 캡처
```

웹훅 URL: `https://api.platform.nora.my/trigger/webhook/<flow-slug>/cms`. `X-Nora-Signature` 로 POST 하도록 CMS 설정.

### preset 스케줄을 cron 으로 전환

```bash theme={null}
nora triggers update tr_daily \
  --set-schedule-mode cron \
  --set-cron "0 9 * * MON-FRI"    # 평일 오전 9시
```

Cron 이 preset 보다 표현력 있음 — daily/weekly/monthly 패턴 넘는 모든 것에 사용.

### 웹훅이 추출하는 입력 경로 변경

옛 CMS 모양: `{ "body": "..." }` — 경로 `body`.

새 모양: `{ "message": { "body": "..." } }`:

```bash theme={null}
nora triggers update tr_cms --set-webhook-input-path message.body
```

변경 라이브 위해 Flow 배포.
