SDK Reference
Complete API documentation for the Triagly JavaScript SDK.
Configuration Options
Only apiKey is required.
type TriaglyOptions = {// RequiredapiKey: string;// Optional - Appearancetheme?: '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 - ContentplaceholderText?: string;successMessage?: string;errorMessage?: string;metadata?: Record<string, unknown>;// Optional - Console CapturecaptureConsole?: boolean;consoleLogLimit?: number;consoleLogLevels?: Array<'log' | 'warn' | 'error'>;// Optional - CallbacksonOpen?: () => 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 widgettriagly.open();triagly.close();// Submit feedback programmaticallyawait triagly.submit({description: 'Description of the issue',tags: ['bug'],});// Clean uptriagly.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 visibleonClose— Widget closes (any method)onCancel— Cancel button clickedonDismiss— X button clickedonSuccess— Successful submissiononError— 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';