Skip to content

SendEvent

Source: src/AWS/FraudDetector/SendEvent.ts

Store an event in Amazon Fraud Detector without generating a prediction — the effectful ingestion call made from a deployed Lambda or Task. Stored events build the historical dataset used to train models and can be labeled later via UpdateEventLabel. The bound event type must have eventIngestion: "ENABLED".

Provide the SendEventHttp implementation layer on the Function effect, bind the event type in the init phase, then call the returned client at runtime. The binding grants frauddetector:SendEvent on the event type and injects its eventTypeName automatically.

// init
const sendEvent = yield* FraudDetector.SendEvent(eventType);
return {
fetch: Effect.gen(function* () {
// runtime
yield* sendEvent({
eventId: "order-123",
eventTimestamp: new Date().toISOString(),
entities: [{ entityType: "customer", entityId: "cust-1" }],
eventVariables: { email: "buyer@example.com", ip: "1.2.3.4" },
});
return HttpServerResponse.json({ ok: true });
}),
};
// on the Function effect:
// .pipe(Effect.provide(FraudDetector.SendEventHttp))