Is my Voice Widget embed code wrong? Nothing is sh...
# support
l
var vapiInstance = null; const assistant = ""; // Substitute with your assistant ID const apiKey = ""; // Substitute with your API key const buttonConfig = { position: "bottom-right", // "bottom" | "top" | "left" | "right" | "top-right" | "top-left" | "bottom-left" | "bottom-right" offset: "40px", // decide how far the button should be from the edge width: "50px", // min-width of the button height: "50px", // height of the button idle: { // button state when the call is not active. color: rgb(93, 254, 202), type: "pill", // or "round" title: "Have a quick question?", // only required in case of Pill subtitle: "Talk with our AI assistant", // only required in case of pill icon: https://unpkg.com/lucide-static@0.321.0/icons/phone.svg, }, loading: { // button state when the call is connecting color: rgb(93, 124, 202), type: "pill", // or "round" title: "Connecting...", // only required in case of Pill subtitle: "Please wait", // only required in case of pill icon: https://unpkg.com/lucide-static@0.321.0/icons/loader-2.svg, }, active: { // button state when the call is in progress or active. color: rgb(255, 0, 0), type: "pill", // or "round" title: "Call is in progress...", // only required in case of Pill subtitle: "End the call.", // only required in case of pill icon: https://unpkg.com/lucide-static@0.321.0/icons/phone-off.svg, }, };
(function (d, t) { var g = document.createElement(t), s = d.getElementsByTagName(t)[0]; g.src = "https://cdn.jsdelivr.net/gh/VapiAI/html-script-tag@latest/dist/assets/index.js"; g.defer = true; g.async = true; s.parentNode.insertBefore(g, s); g.onload = function () { vapiInstance = window.vapiSDK.run({ apiKey: apiKey, // mandatory assistant: assistant, // mandatory config: buttonConfig, // optional }); }; })(document, "script");
@nikhil the apikey and assistant ID was correctly replaced, but not working
z
Are u facing any particular error?
n
Yup ^ it'd be helpful to know if there are console logs or any failed requests you see in the network tab
l
here's the console: JQMIGRATE: Migrate is installed, version 3.4.1 content.4badd4fd.js:1 Failed to load resource: the server responded with a status of 404 () index.esm.6e77cd8e.js:1 Failed to load resource: the server responded with a status of 404 () storage.94f96ed3.js:1 Failed to load resource: the server responded with a status of 404 () script.js:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT tracker:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT script.js:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
z
This seems more like an browser extension issue. It would be helpful if you can check your network tab. to see if u get any network error. Also check if you are using the Public the Key not the private key.
l
@zoratrox360 retried in a guest chrome browser (no extensions), still same issue though, and yea I was using the private key, but I've just tested using the public key and same issue as well. As for the network part I'm not really sure, I don't see any issues there?
z
Can u try sending me the assistant ID you are using?
Also the final snippet if possible.
h
@Leo could this be an issue with your actual attribute values? did you define a function called
rgb
? i tried copy pasting exactly what you had and it didn't work. the icon links needed to be in quotes, and
rgb
values need to be in quotes. after making these changes, the voice widget showed up. if not I think you need to place the rgb in quotes like this:
"rgb(" + 93 + "," + 124 + "," + 102 + ")"
if you already have this defined,then im not entirely sure but can keep looking
here is the result with exactly your code, just placing quotes in certain places
l
@hawa I used the exact same code but in another site using elementor then it worked, my previous one was using wpbakery builder
h
thats interesting, so is this resolved? I am not super familiar with wpbakery but ig issue must have been with them then? maybe wpbakery requires the quotes, i wonder if you can try it with those and see if that works
i tried it in wp bakery, with and without the quotes. it worked with, but not without, so maybe that was the issue with wpbakery
marking resolved, but let me know if not!
l
@hawa Thanks, will definitely test it out, but I have a bigger problem regarding the function calls that's not working, are you free to perhaps hop on a call to discuss this? The settings for function calls are correct (works with openAI cluster but not with custom llm somehow)