TriaglyTriagly DocsGet Started

SDK Reference

Complete API documentation for the Triagly JavaScript SDK.

Configuration Options

Only apiKey is required.

type TriaglyOptions = {
// Required
apiKey: string;
// Optional - Appearance
theme?: 'light' | 'dark' | 'auto';
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
| 'edge-bottom-right' | 'edge-bottom-left' | 'edge-right' | 'edge-left';
buttonText?: string;
buttonShape?: 'rounded' | 'circular' | 'square' | 'pill' | 'expandable';
offsetX?: string; // e.g., '10px', '2rem'
offsetY?: string;
// Optional - Content
placeholderText?: string;
successMessage?: string;
errorMessage?: string;
metadata?: Record<string, unknown>;
// Optional - Console Capture
captureConsole?: boolean;
consoleLogLimit?: number;
consoleLogLevels?: Array<'log' | 'warn' | 'error'>;
// Optional - Callbacks
onOpen?: () => void;
onClose?: () => void;
onCancel?: () => void;
onDismiss?: () => void;
onSuccess?: (feedbackId: string) => void;
onError?: (error: Error) => void;
}

Methods

const triagly = new Triagly({
apiKey: 'pub_live_abc123',
});
// Open/close the widget
triagly.open();
triagly.close();
// Submit feedback programmatically
await triagly.submit({
description: 'Description of the issue',
reporterEmail: '[email protected]',
tags: ['bug'],
});
// Clean up
triagly.destroy();

Method Reference

open()

Opens the feedback widget.

close()

Closes the widget without clearing form state.

submit(payload)

Submits feedback programmatically. Returns feedback ID.

destroy()

Removes DOM nodes and detaches listeners.

Callbacks & Events

const triagly = new Triagly({
apiKey: 'pub_live_abc123',
onOpen: () => analytics.track('widget_opened'),
onClose: () => analytics.track('widget_closed'),
onSuccess: (feedbackId) => {
toast.success('Thanks for the feedback!');
console.log('Feedback ID:', feedbackId);
},
onError: (error) => {
toast.error('Something went wrong.');
console.error(error);
},
});

Event Summary

  • onOpen — Widget becomes visible
  • onClose — Widget closes (any method)
  • onCancel — Cancel button clicked
  • onDismiss — X button clicked
  • onSuccess — Successful submission
  • onError — Submission failed

TypeScript Support

The SDK ships with full TypeScript definitions. Import types directly:

import Triagly from '@triagly/sdk';
import type { TriaglyConfig, FeedbackData } from '@triagly/sdk';