Integration documentation
Two calls: tell us what happened, and ask us before something risky happens.
Setup overview
- Create your project.
- Install the SDK.
- Report events.
- Protect sensitive actions.
Install
npm install @puppetwatch/sdkReport events
puppetwatch.identify(currentUser.id);
puppetwatch.capture("analysis_requested", {
target_type: "ai_inference",
target_id: demo.id,
});identify() associates activity with a pseudonymous account. capture() reports an event and its target metadata.
Protect a sensitive action
const decision = await puppetwatch.guard(currentUser.id, {
targetType: "analysis_requested",
});
if (decision.action === "block") {
// deny the request
}capture() never blocks anything on its own. guard() is what lets you actually stop a bad actor. Call it right before the action happens, and act on what it returns (allow, block, require a CAPTCHA, and more).
Data sent in these examples
| Value | Purpose |
|---|---|
currentUser.id | Pseudonymous account identifier. |
analysis_requested | Name of the event or sensitive action. |
target_type | Type of resource involved in the captured event. |
target_id | Identifier of the target involved in the captured event. |
targetType | Action type submitted to guard for a decision. |
Send pseudonymous IDs and event metadata. No emails or message content required.