
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@invincible_rd/test-two
Advanced tools
Ultron SDK for integrating AI features into your web application.
To install the package, use npm:
npm install @metabrix_labs/ultronai
initUltronAI(divId: string, iframeLink: string): voidInitializes the Ultron AI by embedding an iframe into the specified div.
divId: The ID of the div where the iframe should be embedded.iframeLink: The URL of the iframe content.sendMessageContent(iframe: HTMLIFrameElement, message: string, speak: boolean, lipsync: boolean, url: string): voidSends a text message to the iframe.
iframe: The iframe element.message: The text message to send.speak: Whether the message should be spoken.lipsync: Whether lipsync should be enabled.url: The URL of the iframe content.sendSubmitEvent(iframe: HTMLIFrameElement, url: string): voidSends a submit event to the iframe.
iframe: The iframe element.url: The URL of the iframe content.sendAudioMessage(iframe: HTMLIFrameElement, audioData: string, url: string): voidSends an audio message to the iframe.
iframe: The iframe element.audioData: The audio data to send.url: The URL of the iframe content.setupMessageListener(iframe: HTMLIFrameElement, iframeLink: string, callback: (data: any) => void): voidSets up a message listener to receive messages from the iframe.
iframe: The iframe element.iframeLink: The URL of the iframe content.callback: The callback function to handle the received messages.When using the package, you can receive the following messages from the iframe:
{type: "avatarLoaded"}
{type: "error", message: "Unauthorized request: Session not found", status: 401}
{type: "error", message: "Unauthorized request: Session expired", status: 401}
To use the package, import the necessary functions in your TypeScript or JavaScript file:
import { initUltronAI, sendMessageContent, sendSubmitEvent, sendAudioMessage, setupMessageListener } from '@metabrix_labs/ultronai-sdk';
To initialize the Ultron AI, call the initUltronAI function with the ID of the div where the iframe should be embedded and the link to the iframe content:
const sessionId = 'created_with_ultron_api'; // please refer docs.ultronai.me
initUltronAI('metabrix-labs', `https://app.ultronai.me/chat/?avatarId=xxxx&sessionId=${sessionId}`);
You can send messages to the iframe using the provided functions:
const iframe = document.getElementById('metabrix-labs').querySelector('iframe');
// Send a text message
sendMessageContent(iframe, 'Hello, Ultron!', true, false, 'https://app.ultronai.me');
// Send a submit event
sendSubmitEvent(iframe, 'https://app.ultronai.me');
import { useEffect, useState, useRef } from "react";
import "./App.css";
import {
initUltronAI,
sendMessageContent,
sendSubmitEvent,
sendAudioMessage,
setupMessageListener
} from "@metabrix_labs/ultronai-sdk";
function App() {
const [count, setCount] = useState(0);
const [message, setMessage] = useState("");
const [audioData, setAudioData] = useState<string | null>(null);
const [iframeMessage, setIframeMessage] = useState<any>(null);
const iframeRef = useRef<HTMLIFrameElement | null>(null);
useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
const sessionId =
urlParams.get("sessionId")
console.log("sessionId:", sessionId);
const timer = setTimeout(() => {
initUltronAI(
"metabrix",
`https://app.ultronai.me/chat/?avatarId=xxxx&sessionId=${sessionId}`
);
iframeRef.current = document.querySelector("#metabrix iframe");
if (iframeRef.current) {
setupMessageListener(
iframeRef.current,
iframeRef.current.src,
setIframeMessage
);
}
}, 2000);
return () => clearTimeout(timer);
}, []);
const handleSendMessage = () => {
if (iframeRef.current) {
const userInteracted =
document.body.classList.contains("user-interacted");
if (userInteracted) {
const finalMessage =
message || "Hello, this is a metabrix test message";
sendMessageContent(
iframeRef.current,
finalMessage,
true,
true,
iframeRef.current.src
);
} else {
alert("Please interact with the page first.");
}
}
};
const handleSendSubmitEvent = () => {
if (iframeRef.current) {
sendSubmitEvent(iframeRef.current, iframeRef.current.src);
}
};
const handleSendAudioMessage = () => {
if (iframeRef.current && audioData) {
sendAudioMessage(iframeRef.current, audioData, iframeRef.current.src);
} else {
alert("Please upload an audio file first.");
}
};
const handleAudioUpload = (event: React.ChangeEvent<HTMLInputElement>) => {
const file = event.target.files?.[0];
if (file) {
const reader = new FileReader();
reader.onload = (e) => {
const audioData = e.target?.result as string;
setAudioData(audioData);
if (iframeRef.current) {
sendAudioMessage(iframeRef.current, audioData, iframeRef.current.src);
}
};
reader.readAsDataURL(file);
}
};
useEffect(() => {
const handleUserInteraction = () => {
document.body.classList.add("user-interacted");
};
document.addEventListener("click", handleUserInteraction);
document.addEventListener("keydown", handleUserInteraction);
return () => {
document.removeEventListener("click", handleUserInteraction);
document.removeEventListener("keydown", handleUserInteraction);
};
}, []);
useEffect(() => {
handleSendMessage();
}, [message]);
useEffect(() => {
console.log("iframeMessage", iframeMessage);
}, [iframeMessage]);
return (
<div className="app-container">
<h2>AI Interviewer - SDK demo</h2>
<div className="iframe-container">
<div id="metabrix" className="iframe-wrapper"></div>
</div>
<div className="controls-container">
<input
type="text"
placeholder="Enter your message"
value={message}
onChange={(e) => setMessage(e.target.value)}
className="input-field"
/>
<input
type="file"
accept="audio/*"
onChange={handleAudioUpload}
className="input-field"
/>
<button onClick={handleSendSubmitEvent} className="button">
Send Submit Event
</button>
</div>
{iframeMessage && (
<div className="message-container">
<h3>Message from iframe:</h3>
<pre>{JSON.stringify(iframeMessage, null, 2)}</pre>
</div>
)}
</div>
);
}
export default App;
FAQs
Ultron SDK for integrating conversational AI Avatars into your web application
We found that @invincible_rd/test-two demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.