TEXT CHAT WIDGET CODE
# support
u
Where can I find code to embed the CHAT verison of the widget on a website?
s
cant help with that ... but thats the coolest name i saw in a while 👍
v
Hi there! 👋 I wasn't able to find specific code for embedding the CHAT version of the widget on a website, as it appears this feature is still in development. However, I can share what I know about the current status and alternatives. According to the [Discord conversation](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1339978679119249469), a dedicated endpoint for testing the assistant via chat is actively being worked on but isn't fully available yet. There is a staging version available at
https://staging-api.vapi.ai/api-extended#/extended/ChatController_chat
, while the production endpoint
https://api.vapi.ai/chat
is deprecated and may result in timeout errors. If you're looking to embed a widget on your website, I can share the code for the Voice Widget as an alternative. Here's how to embed the Vapi Voice Widget:
Copy code
html
<script>
  var vapiInstance = null;
  const assistant = "<assistant_id>"; // Substitute with your assistant ID
  const apiKey = "<your_public_api_key>"; // Substitute with your Public key from Vapi Dashboard
  const buttonConfig = {}; // Modify this as required

  (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");
</script>
This code should be inserted into your website's HTML, ideally before the closing
</body>
tag according to the [Voice Widget Example](https://docs.vapi.ai/examples/voice-widget). Is there anything else you'd like to know about embedding widgets or using the Vapi Web SDK? Sources:
s
Hey, you need to follow the instructions in the shared GitHub repo link on how to attach the assistant or the chat assistant to your website.
v
Message marked as helpful by @UnitedNotions! 🎉
Message marked as helpful by @UnitedNotions! 🎉
s
Marking this ticket as Solved ✅
o
Css is broken on my website when i add (i'm using tailwindcss) There might be a scoping problem for the widget css
s
This ticket has been marked as solved, and as a result, you will no longer receive any further responses. Kindly create a new support ticket to escalate your inquiry. 
2 Views