createMaestrio()
Creates and returns a new Maestrio SDK instance. This is the main entry point for the SDK.
import { createMaestrio } from "@maestrio/sdk";
const maestrio = createMaestrio({
apiKey: "mst_live_abc123",
baseUrl: "https://app.maestrio.ai",
projectId: "proj_xyz",
});Parameters
createMaestrio(config: MaestrioConfig) accepts a single configuration object:
| Property | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your API key from the dashboard. Starts with mst_. |
baseUrl | string | Yes | The Maestrio API base URL. |
projectId | string | Yes | The project ID to send feedback to. Found in project settings. |
widget | WidgetConfig | No | Customize the widget appearance, labels, and position. |
Returns
Returns a MaestrioSDK object with the following methods:
| Method | Description |
|---|---|
identify() | Associate the current user with future feedback |
submitRequest() | Programmatically submit a bug report or feature request |
show() | Mount and display the feedback widget |
hide() | Close the widget panel (keep it mounted) |
destroy() | Remove the widget from the DOM entirely |
Session persistence
The SDK stores the identified user in sessionStorage under the key maestrio:identity:{projectId}. If a user was previously identified in the same browser tab, the SDK restores that identity automatically on initialization.
With widget customization
const maestrio = createMaestrio({
apiKey: "mst_live_abc123",
baseUrl: "https://app.maestrio.ai",
projectId: "proj_xyz",
widget: {
position: "right-center-vertical",
theme: {
primaryColor: "#7c3aed",
backgroundColor: "#1e1b4b",
textColor: "#e0e7ff",
borderRadius: "16px",
},
labels: {
triggerText: "Feedback",
headerText: "Send us feedback",
},
},
});See the full Configuration reference for all available options.