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

# 웹훅 웨이크

> 내가 쓸 때 듣고 있지 않은 AI를 zapbip이 시작하게 해요.

웹훅 웨이크는 [웨이크 래더](https://docs.zapbip.com/ko/concepts/wake-ladder.md)의 두 번째 단계예요. 소유자가 WhatsApp에서 쓰는데 에이전트가 듣고 있지 않으면, zapbip이 에이전트를 시작하는 링크를 호출해요. 지원하는 클라이언트에서는 설치 과정이 이를 설정해요. 이 페이지는 zapbip이 무엇을 보내는지, 그리고 직접 설정하는 방법을 보여 줘요.

그다음 에이전트는 [check\_inbox](https://docs.zapbip.com/ko/mcp-reference/check-inbox.md) 또는 [get\_messages](https://docs.zapbip.com/ko/mcp-reference/get-messages.md)로 메시지를 읽고 답해요. 링크는 [set\_wake](https://docs.zapbip.com/ko/mcp-reference/set-wake.md)로 저장해요.

이 호출에는 내 텍스트가 전혀 담기지 않아요. 본문은 항상 `{"event":"inbox_has_messages"}`이에요. 연달아 도착한 메시지는 첫 메시지 몇 초 뒤에 보내는 웨이크 하나를 공유해요.

## Grok Bot 루틴

웹훅 트리거가 있는 루틴을 만든 뒤 저장해요.

```json theme={null}
{ "mode": "webhook", "url": "https://api2.cursor.sh/automations/webhook/<routine-id>", "token": "<token>" }
```

zapbip은 `Authorization: Bearer <token>`을 보내요.

## claude.ai 예약 작업

API 트리거가 있는 예약 작업을 만든 뒤 저장해요.

```json theme={null}
{ "mode": "webhook", "url": "https://api.anthropic.com/v1/claude_code/routines/<trigger-id>/fire", "token": "<token>" }
```

zapbip은 `Authorization: Bearer <token>`과 루틴 헤더를 보내요.

## 직접 운영하는 서비스

공개된 `https` 호스트면 무엇이든 돼요. 토큰은 서명 키이며 32자 이상이어야 하고 전송되지 않아요. 각 요청에는 `X-Zapbip-Timestamp`(Unix 초)와 `X-Zapbip-Signature`가 붙어요. 후자는 `sha256=` 뒤에 `<timestamp>.<body>`의 HMAC-SHA256 16진수 값이 이어진 것이에요. 300초보다 오래된 타임스탬프는 거부하세요.

```js theme={null}
import { createHmac, timingSafeEqual } from 'node:crypto';

const TOLERANCE_SECONDS = 300;

export function isValidWake({ timestamp, signature, body, token }) {
  const ageSeconds = Math.abs(Date.now() / 1000 - Number(timestamp));
  if (!(ageSeconds <= TOLERANCE_SECONDS)) return false;
  const expected = `sha256=${createHmac('sha256', token).update(`${timestamp}.${body}`).digest('hex')}`;
  const received = Buffer.from(signature);
  const wanted = Buffer.from(expected);
  return received.length === wanted.length && timingSafeEqual(received, wanted);
}
```

## 웨이크가 실패할 때

* `408`, `425`, `429`, `5xx`, 시간 초과, 네트워크 오류는 최대 5번까지 다시 시도하며, 5초, 10초, 20초, 40초를 기다리고, `429`와 `503`의 `Retry-After`는 최대 60초까지 따라요.
* 리다이렉트와 그 밖의 `4xx` 응답은 즉시 거부되고 다시 시도하지 않아요.
* 웨이크가 거부되거나 포기되면 메시지가 받은편지함에서 기다린다는 알림이 WhatsApp으로 한 번 오고, 연결에는 `failing` 표시가 붙어요. [set\_wake](https://docs.zapbip.com/ko/mcp-reference/set-wake.md)를 다시 호출해 대상을 고치세요. 다음에 전달된 웨이크가 `active`로 되돌려요.
* 웨이크가 실행되기 전에 에이전트가 메시지를 읽었다면 요청은 보내지 않아요.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.