Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
This repository was archived by the owner on Nov 1, 2026. It is now read-only.
ezbot-aiPublic archive

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

⚠️ ezbot.ai has been shut down

ezbot.ai has been shut down. This repository is now read-only and archived. The npm package @ezbot-ai/javascript-sdk is deprecated. As of v2.0.0 every public method is a no-op that only logs a console message, so existing integrations keep running without errors but do nothing. The original code is preserved behind guard functions (see src/lib/shutdown.ts) for reference only.

ezbot Javascript SDK

The easiest way to interact with ezbot via JS (browser). For ease of use, our Javascript library wraps Snowplow's Browser Tracker (BSD-3 License).

Docs

For full documentation, please visit docs.ezbot.ai.

Server-side predictions (Node)

Use the server client to fetch predictions from backend code (e.g., Next.js Route Handlers, RSC/SSR, Express, serverless functions).

import { createEzbotClient, type PredictionsParams, type RequestMeta } from '@ezbot-ai/javascript-sdk';

// Create a client. By default, baseUrl is https://api.ezbot.ai.
// You can override baseUrl explicitly for testing if needed.
const client = createEzbotClient({
  timeoutMs: 500,
  // Optional: baseUrl: 'http://localhost:8000',
  // Optional: agentOptions for TLS/keepAlive tuning
  // agentOptions: { keepAlive: true }
});

async function fetchPredictions() {
  const params: PredictionsParams = {
    projectId: 123,
    pageUrlPath: '/',
    userAgent: '...',
    referrer: '...'
  };
  const meta: RequestMeta = {
    userAgent: params.userAgent,
    referrer: params.referrer,
    origin: 'https://your-site.example',
    headers: { 'accept-language': 'en-US' },
  };

  try {
    const predictions = await client.getPredictions(params, meta);
    return predictions; // Array<Prediction>
  } finally {
    // Only call dispose() if the client will no longer be reused.
    // For serverless (per-invocation) workflows, dispose to free sockets.
    // For long-lived servers, keep a singleton and DO NOT dispose on every request.
    // client.dispose();
  }
}

Note: The baseUrl defaults to https://api.ezbot.ai. Only override it for local/testing scenarios.

Lifecycle guidance

  • Serverless (per-invocation): create the client inside the handler/invocation and call dispose() in a finally block to close the underlying agent.
  • Long-lived server (singleton): create one client at module scope and reuse it across requests. Do not call dispose() on each request; call it only at shutdown.

Error handling

  • The client returns an empty array on network errors or timeouts to allow SSR to render without blocking.

Credits

ezbot-ai/ezbot-javascript-sdk is maintained by ezbot and many constributors.

First-party Code

First-party code is stored in the src directory, with the exception of the vendor subdirectory.

Third-party Code

Third-party code is brought in via npm, with a full manifest available in the package.json file. 3rd party code is also present in the src/vendor directory.

Special Thanks

Special thanks to Snowplow Analytics, Ltd, for their Browser Tracker library and other open source contributions.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages