With Peaka as a Data Management Tool with UI, you can access all of its premium features through either its powerful API or/and its intuitive user interface (UI). Whether you prefer seamless automation via the API or a more visual approach using the UI, Peaka offers the flexibility to suit your needs. If you prefer to use Peaka exclusively as a connector solution, we provide a dedicated approach for that use case. To learn more about this focused implementation, please refer to the Peaka as a Connector-Only Solution section.
You can easily integrate Peaka’s UI into your own web application. This allows your users to enjoy the full range of Peaka’s advanced features without ever leaving your platform. By embedding Peaka, you provide a seamless and cohesive experience, empowering your users with the tools they need to maximize productivity and efficiency.
Enabling Embedded UI for Peaka Integration Using an iframe
For security reasons, you cannot use the session URL directly in an iframe. To embed Peaka within an iframe, you need to enable the embedded UI for your partner API key.In order to do that you should;
Go to Developer Settings in your peaka account.
Find your api key in the table then click ... button.
Select Enable Embedded UI option
Enable Embedded UI for this API Key
Enter your domain that you want to embed the Peaka app.
URL is needed for security reasons. Please be aware that your application
should be served over HTTPS for use in an iframe.
Enter a Company Name for white labeling in Embedded UI.
If you want to customize the UI, click “Customize UI Theme” button then give a theme name and upload your custom css file. You can also download the valid example of the customization file (Check out the related documentation to learn more about customization).
You can add custom css files more than one and change themes in runtime.After you set the css file, you should start the session with following parameters to enable custom theme.
Note: The application requires clipboard access to perform copy actions. Please ensure your iframe code includes allow=“clipboard-write *” to prevent browser blocking.
Note: If you want to switch between different themes in runtime you can do it with iframe’s post message method.
Congratulations! You have successfully embedded Peaka’s UI into your web application. Your users can now seamlessly interact with Peaka’s interface to manage their data efficiently and effectively.
In Embedded Mode, you can customize the Peaka UI by hiding specific components or features. To do this, use the featureFlags key when initiating the UI session. This allows you to tailor the interface to your application’s needs, ensuring a seamless and focused user experience.
When initializing the UI session, specify the features you want to hide or disable using the featureFlags configuration. This ensures that only the relevant parts of the UI are displayed to your users. For example you can hide queries sections in Peaka’s UI with following configuration.
When you need to use Peaka exclusively as a connector solution, you can configure the UI session to display only the connector functionality. This streamlined approach is perfect for applications that focus on data source connections without requiring the full Peaka studio experience.First, initialize the session with following payload options:
SessionMode: Specifies the mode of the session. Available options are:ConnectorType: Specifies the type of connector interface to display. Available options can be found in the API Reference.CatalogCreateEnabled: Boolean flag that controls whether catalogs are automatically created when establishing connections. The default value is true. Set this to false only when using CONNECTOR_MODAL_ONLY mode to prevent automatic catalog creation.
CONNECTOR_MODAL_ONLY
FULL_STUDIO
Note: ConnectorType and CatalogCreateEnabled are only available in the CONNECTOR_MODAL_ONLY mode.
The API response includes sessionUrl and partnerOrigin properties, allowing you to open the Peaka interface in a popup window for seamless integration.In this example, we’re using the CONNECTOR_MODAL_ONLY mode to display only the connector modal interface. We get the session URL and partner origin from the API response and open the Peaka interface in a popup window.
Copy
Ask AI
fetch(`https://partner.peaka.studio/api/v1/ui/initSession`, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Bearer <token>" }, body: JSON.stringify({ projectId: <your_project_id>, theme: <your_theme_name>, themeOverride: true, sessionMode: "CONNECTOR_MODAL_ONLY", connectorType: <connector_type>, catalogCreateEnabled: true, }),}).then(async (response) => { const res = await response.json(); // Open the Peaka connector interface in a popup window window.open( res.sessionUrl, "authPopup", `width=500,height=600,left=${window.screen.width / 2 - 500 / 2},top=${ window.screen.height / 2 - 600 / 2 },resizable=yes,scrollbars=yes,noopener=no,noreferrer=no` ); // Handle the message from the Peaka connector popup const handleMessage = (event) => { // Use event.data to get the message from the Peaka connector popup when popup is closed if (event.data.status) { // Status might be "CANCELLED" or "FINISHED" // If popup is closed without selection a catalog, status will be "CANCELLED" // If popup is closed with selection a catalog, status will be "FINISHED" console.log("Status from the Peaka connector popup:", event.data.status); window.removeEventListener("message", handleMessage); } else { console.log("Data from the Peaka connector popup:", event.data); } }; // Listen to the message from the Peaka connector popup when popup is closed window.addEventListener("message", handleMessage);});