Events
December 15, 2025 ยท View on GitHub
Overview
Use to log conversation or message events, like "conversation_shared" or "message_code_snippet_copied".
Available Operations
- log - Log Event
log
Log Event
Example Usage
import { InkeepAnalytics } from "@inkeep/inkeep-analytics";
const inkeepAnalytics = new InkeepAnalytics();
async function run() {
const result = await inkeepAnalytics.events.log({
webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
}, {
type: "<value>",
messageId: "<id>",
entityType: "message",
});
console.log(result);
}
run();
Standalone function
The standalone function version of this method:
import { InkeepAnalyticsCore } from "@inkeep/inkeep-analytics/core.js";
import { eventsLog } from "@inkeep/inkeep-analytics/funcs/eventsLog.js";
// Use `InkeepAnalyticsCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const inkeepAnalytics = new InkeepAnalyticsCore();
async function run() {
const res = await eventsLog(inkeepAnalytics, {
webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
}, {
type: "<value>",
messageId: "<id>",
entityType: "message",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("eventsLog failed:", res.error);
}
}
run();
React hooks and utilities
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useEventsLogMutation
} from "@inkeep/inkeep-analytics/react-query/eventsLog.js";
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | components.InsertEvent | :heavy_check_mark: | The request object to use for the request. |
security | operations.LogEventSecurity | :heavy_check_mark: | The security requirements to use for the request. |
options | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries | RetryConfig | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<components.SelectEvent>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequest | 400 | application/problem+json |
| errors.Unauthorized | 401 | application/problem+json |
| errors.Forbidden | 403 | application/problem+json |
| errors.UnprocessableEntity | 422 | application/problem+json |
| errors.InternalServerError | 500 | application/problem+json |
| errors.APIError | 4XX, 5XX | */* |