🌐 실전 사용 사례
GitHub — push, PR, 이슈 이벤트를
등록된 URL로 전송 (CI/CD 트리거)
결제사 (Stripe/토스) — 결제 성공/실패를
가맹점 서버에 실시간 통지
Slack Incoming Webhook — 특정 URL에
POST만 하면 채널에 메시지 게시
# FastAPI — 서명 검증 후 빠르게 응답
@app.post("/webhooks/order")
async def receive_webhook(request: Request):
body = await request.body()
sig = request.headers.get("X-Webhook-Signature")
expected = hmac.new(SECRET, body,
hashlib.sha256).hexdigest()
if not hmac.compare_digest(sig, expected):
raise HTTPException(401)
# event_id로 중복(재시도) 처리 방지 후
# 무거운 작업은 큐에 넘기고 즉시 응답
return {"received": True}