AnpherosAnpheros PlatformDevelopers

Try it free in the sandbox · first FHIR call in 5 minutesFree · 30 synthetic patients · no card

웹훅

리소스 쓰기, 동의 변경 및 완료된 문서에 대한 서명되고 재시도되는 얇은 이벤트, TypeScript, Dart 및 Python에서의 서명 확인 포함.

Anpheros Platform은 프로젝트에서 특정 이벤트가 발생할 때 서버를 호출할 수 있습니다. 예를 들어, 리소스가 작성되었거나, 사용자가 액세스 권한을 부여하거나 철회했거나, 문서가 최종 확정되었을 때입니다. 이벤트는 간결합니다: ID, 유형, 버전만 포함하며 임상 콘텐츠는 포함하지 않습니다. 필요한 경우 API를 통해 리소스를 읽으십시오. 모든 전송은 서명되므로 신뢰하기 전에 서명을 확인하십시오.

엔드포인트 등록

curl -X POST $BASE/v1/webhooks -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://your.app/anpheros/hook", "events": ["resource.created", "consent.revoked"], "description": "prod"}'

응답에는 secret (whsec_…) 한 번이 포함됩니다. 저장해 두세요. 서명 확인에 필요합니다. events은 ["*"] 또는 다음 중 하나를 허용합니다.

type when data
resource.created / resource.updated / resource.deleted 프로젝트에서 FHIR 리소스(REST v1, FHIR API 또는 번들)를 작성한 경우 — 또는 다른 프로젝트가 액세스할 수 있는 레코드에 작성한 경우 (환자를 생성했거나 활성 권한을 보유하고 있는 경우). 그러면 data.external은 true이고 data.source은 작성자를 나타냅니다: author_type (patient / practitioner / device / import / ai), organization (작성자가 대신한 표시 이름), practitioner (알려진 경우 디렉토리의 이름), source_system resource_type, id, patient (표시되는 ID), version, last_updated, 외부 작성의 경우 external, source
consent.granted 사람이 동의 페이지에서 앱에 액세스 권한을 부여한 경우 (또는 해당 레코드를 연결한 신뢰할 수 있는 앱) grant_id, patient, application_id, scopes, purpose, expires_at
consent.revoked 사람(또는 플랫폼)이 권한 부여를 종료한 경우 위와 동일하며 revoked_at, reason 추가
document.finalized 문서 업로드가 완료되고 체크섬이 계산된 경우 id, patient, content_type, size, sha256
proposal.created AI 에이전트가 볼 수 있는 레코드에 쓰기를 제안했으며, 사람의 승인을 기다리는 경우 id, patient, action, resource_type
ping 테스트 전달을 요청한 경우 endpoint

엔드포인트는 프로젝트 및 환경별입니다. sk_test_ 키는 샌드박스 엔드포인트를 관리하고, sk_live_ 키는 프로덕션 엔드포인트를 관리합니다. URL은 공개 https:// 엔드포인트여야 합니다. 등록(및 이후 url 변경)은 로컬, 개인, 링크-로컬, 메타데이터 및 기타 예약된 주소 — localhost, 127.0.0.1, ::1, 10.0.0.0/8, 192.168.0.0/16, fd00::/8 등 — 및 해당 주소로 확인되는 이름을 거부합니다. 400 invalid은 url 필드에 적용됩니다. 이는 샌드박스에도 적용됩니다. 모든 전달은 주소를 다시 확인하고 방금 확인한 IP 주소에만 연결하므로 나중에 개인 네트워크를 가리키는 이름(DNS 리바인딩)은 아무것도 받지 못합니다. 개발 중에 자체 머신에서 이벤트를 수신하려면 공개 HTTPS 터널을 통해 노출하고 터널의 주소를 등록하세요. 프로젝트 및 환경당 최대 10개의 엔드포인트.

전달

POST https://your.app/anpheros/hook
Content-Type: application/json
User-Agent: Anpheros-Webhooks/1.0
Anpheros-Event: resource.created
Anpheros-Event-Id: evt_…
Anpheros-Delivery: whd_…
Anpheros-Signature: t=1789800000,v1=5f3a…

{"id":"evt_…","type":"resource.created","created_at":"2026-09-19T12:00:00.000Z","environment":"production",
 "project":"proj_…","data":{"resource_type":"Observation","id":"…","patient":"…","version":1,"last_updated":"…"}}

10초 이내에 2xx를 포함하여 응답합니다. 그 외의 경우(또는 타임아웃)는 실패로 간주되며, 24시간(10회 시도)까지 백오프를 적용하여 전달을 재시도한 후 exhausted로 표시됩니다. 전달은 최소 한 번 보장되며 순서가 바뀌어 도착할 수 있습니다. 중복 제거를 위해서는 Anpheros-Event-Id을 사용하고, 오래된 업데이트를 무시하려면 data.version을 사용하십시오.

서명 확인

v1은 <t>.<raw body>에 대한 시크릿을 사용하여 HMAC-SHA256으로 생성됩니다. t이 5분보다 오래된 경우 거부합니다.

import { verifyWebhookSignature } from '@anpheros/sdk';
app.post('/anpheros/hook', express.raw({ type: 'application/json' }), async (req, res) => {
  const ok = await verifyWebhookSignature({ secret: process.env.ANPHEROS_WEBHOOK_SECRET!, header: req.header('anpheros-signature'), body: req.body });
  if (!ok) return res.status(400).end();
  const event = JSON.parse(req.body.toString());
  // … enqueue and return quickly
  res.status(204).end();
});
import 'package:anpheros_sdk/anpheros_sdk.dart';
final ok = verifyWebhookSignature(secret: secret, header: request.headers['anpheros-signature'], body: rawBodyBytes);
import hmac, hashlib, time
def verify(secret: str, header: str, body: bytes, tolerance=300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(parts["t"])) > tolerance:
        return False
    expected = hmac.new(secret.encode(), f"{parts['t']}.".encode() + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts["v1"])

작동

두 SDK 모두 webhooks (create, list, get, update, delete, rotateSecret, ping, deliveries, redeliver) 아래에 이를 노출합니다.

Try it free in the sandbox · first FHIR call in 5 minutesFree · 30 synthetic patients · no card

Product updates by email

New features, guides and the end of the beta. One email a month at most.

Send me occasional Anpheros Platform updates by email (new features, API changes, guides). I'll confirm by email and can unsubscribe in one click from any email. Privacy