Cobbl

Installation

How to install and set up the Cobbl Feedback Widget

Installation Methods

Choose the installation method that matches your project:

npm install @cobbl-ai/feedback-widget

Choose Your Integration

Requirements

For Script Tag / CDN

No additional requirements — just include the script in your HTML.

For npm Package

  • Node.js: 18.0.0 or higher
  • React (optional): 16.8.0 or higher for the React component

Package Exports

The package provides multiple entry points:

Import PathDescription
@cobbl-ai/feedback-widgetJavaScript
@cobbl-ai/feedback-widget/reactReact
@cobbl-ai/feedback-widget/browserBrowser global (auto-mounting)

JavaScript Import

import { cobblWidget } from '@cobbl-ai/feedback-widget'

React Import

import { FeedbackWidget } from '@cobbl-ai/feedback-widget/react'

Getting the Run ID

The runId comes from running a prompt with the CobblAdminClient:

import { CobblAdminClient } from '@cobbl-ai/sdk'

const adminClient = new CobblAdminClient({
  apiKey: process.env.COBBL_API_KEY,
})

const result = await adminClient.runPrompt('my-prompt', {
  topic: 'AI Safety',
})

// Use result.runId with the feedback widget
console.log(result.runId)

Configuration Options

All integration methods share the same configuration options. See the specific integration pages for detailed API references with defaults:

Common Options

OptionTypeRequiredDescription
runIdstringYesRun ID from prompt execution
variant'trigger' | 'thumbs' | 'inline'NoDisplay variant
positionWidgetPositionNoFlyout position
triggerButtonTextstringNoTrigger button text
onSuccess(feedbackId: string) => voidNoSuccess callback
onError(error: Error) => voidNoError callback

Position Options

For trigger and thumbs variants, the flyout can be positioned in 8 directions:

type WidgetPosition =
  | 'top-left'
  | 'top'
  | 'top-right'
  | 'right'
  | 'bottom-right'
  | 'bottom'
  | 'bottom-left'
  | 'left'

Next Steps

On this page