what is the correct API endpoint for starting a vo...
# support
s
Hello, Trying to connect my custom chat on my wix website to vapi but it doesnt connect. im getting a 404 or 405 error and it seems to be suggesting that the endpointURL is incorrect.
v
@shapsa_ Hello! I'm here to help you with your VAPI integration. A 404 or 405 error typically indicates that there's an issue with the endpoint URL you're using. Here's what you can do to troubleshoot this: 1. **Check the Endpoint URL**: Ensure that the URL you've provided to VAPI is correct. It should be the URL where your server is expecting to receive POST requests from VAPI. 2. **Verify Server Configuration**: Make sure that your server is configured to accept POST requests at the endpoint URL you've provided. If you're using Wix, you might need to check their documentation or settings to ensure that your site is set up to handle incoming API requests. 3. **Review VAPI Documentation**: Double-check the VAPI documentation to ensure that you're following all the required steps for connecting your custom chat. 4. **Server URL Guide**: You mentioned that you're getting an error suggesting the endpoint URL is incorrect. It might be helpful to review our server URL guide to ensure you've set up everything correctly. If you've gone through these steps and are still facing issues, could you provide me with more details about your current setup? Specifically, I would need to know how you've configured your endpoint URL in VAPI and any relevant configuration details on your Wix site. This will help me assist you further.
You can continue this conversation by mentioning me in the message.
s
Here are the two snippets I have: 1. Code Snippet from Your Wix Project: javascript Copy code // Backend function to handle VAPI conversations using POST method export async function startVAPIConversation(userMessage) { const vapiApiKey = await getSecret('VAPI_API_Key'); const assistantId = 'your-assistant-id'; // Your actual Assistant ID const userId = 'your-user-id'; // Your actual user ID try { // Replace with the correct URL from the VAPI documentation const vapiResponse = await fetch('https://api.vapi.ai/v1/conversations', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization':
Bearer ${vapiApiKey}
, }, body: JSON.stringify({ assistantId: assistantId, userId: userId, message: userMessage, }), }); // Log the response status code and raw response text for debugging const statusCode = vapiResponse.status; const responseText = await vapiResponse.text(); console.log("VAPI Status Code:", statusCode); console.log("VAPI Raw Response:", responseText); const contentType = vapiResponse.headers.get('content-type'); if (contentType && contentType.includes('application/json')) { const result = JSON.parse(responseText); if (!vapiResponse.ok) { throw new Error(
Failed to start VAPI conversation: ${result.message || 'Unknown error'}
); } return result.message || 'VAPI conversation started.'; } else { throw new Error(
Unexpected response from VAPI: ${responseText}
); } } catch (error) { console.error('Error starting VAPI conversation:', error); throw new Error(
Failed to start VAPI conversation: ${error.message}
); } }
2. Curl Command Example: bash Copy code curl --request POST \ --url https://api.vapi.ai/v1/conversations \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "assistantId": "your-assistant-id", "userId": "your-user-id", "message": "Hello!" }' Is the the endpoint https://api.vapi.ai/v1/conversations correct for starting a conversation. is the the structure and format of the POST request valid?
both are failing to connect
s
Are you trying to place a web call or an actual phone call? because the /call endpoint is for placing actual calls, not web calls. You need to uset he web snippet or the Web SDK for web calls, at least that's how I currently understand it.
s
im trying to add it to my existing chat on my website so its not a phone call.
im testing with terminal and still cant make connection with the api
i used this: curl -X POST https://api.vapi.ai/assistant//conversation/init \ -H "Authorization: Bearer YOUR_VAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "message": "Hello!" }'
hello
?
is someone still here?
@Stickler101 are you still here?
s
If you mean you're trying to start a text-based web chat with one of the VAPI assistants that you've made, then I haven't done that yet.
s
i have a chat already and im trying to intergrade Vapi into it so it works seamlessly with my txt-based chat. are you saying this is not possible with Vapi?
@Stickler101 i have a chat already and im trying to intergrade Vapi into it so it works seamlessly with my txt-based chat. are you saying this is not possible with Vapi?
@Stickler101so to be clear i want to use it so the vapi and my chat work together so if i have a conversation with vapi it shows in my chat as well and the data is shared. are you saying this is not possible with Vapi?
s
I'm just saying I haven't done anything soley text-based with VAPI before, personally.
Hearing you on mic, sounds like you should be using the web snippet in the location you want the "mic" button to be.
The button works as a toggle, turning a web call on/off.
The API is for phone calls, not web initiated calls. Supposed to use the Web SDK for web chats, or the web snippet (i think). (I don't work for VAPI).
s
@Shubham Bajaj
ok ya i tried to use the WebSDK but i still cant connect.
s
Since you're using WIX, you should probably be using the snippet:
Copy code
<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>
Wrap that in where you want the button to appear.
s
@Stickler101
@Shubham Bajaj
@Stickler101 @Shubham Bajaj any ideas why im getting a error VAPI SDK cannot be initialized on the server. Line50. thanks
s
seems like, for some reason, typeof window and typeof document are coming back as undefined.
@Stickler101 @Shubham Bajaj ive gotten to this point. it just hangs on Initializing VAPI now. ive checked this link (https://cdn.jsdelivr.net/gh/VapiAI/html-script-tag@latest/dist/assets/index.js) the SDK seems to be working but just hangning like in the screenhot. Please let me know what can be done thanks https://cdn.discordapp.com/attachments/1290331011930001419/1290494574988496918/Screenshot_2024-10-01_at_3.57.17_AM.png?ex=66fcaa3a&is=66fb58ba&hm=f95e9fdd2cbe258111f26f6f6a84e659314e8287df929136ceb0f1f232bf18db&
@Stickler101 1 @Shubham Bajaj ok i am now at this stage. but im using the latest browsers and not working on both. what could this be? is this common with trying to intergrade Vapi. i was under the immpression vapi would be reletavly easy to intergrade. please advise https://cdn.discordapp.com/attachments/1290331011930001419/1290592576046501908/Screenshot_2024-10-01_at_10.31.46_AM.png?ex=66fd0580&is=66fbb400&hm=077fd9bc0f14d4a7862bd5d162459f2fc8e5ed9edd85701e224cc1752ec7f4c9&
a
Look into setting up a custom LLM - that way you can transfer the conversation from chat to voice and from voice to chat. It's gonna be hard but doable!
s
hey Alejo. so this is not possible to do? seems like sucha simpl eusecase to have Vapi power your chatbox.
@Alejo hey Alejo. so this is not possible to do? seems like sucha simpl eusecase to have Vapi power your chatbox.
GPT seems to think its possible but not sure why its not working and Vapi hasnt been very helpful at all
a
@Chowderr any input on this?
c
First of where did you get this endoint url? This literally does not excist.
Also I am very confused on why you are not just using the HTML - you are on Wix......
No it's not, Not rying to be rude but did you read the actual documentation on web? No where does it says you can combine this chat features.
s
Text-to-Speech (TTS): Use VAPI's TTS to convert the bot's text responses into speech. Speech-to-Text (STT): Implement STT to convert the client's spoken words into text for processing.
@Chowderr
@Alejo @Chowderr so a solution thats has those capabilities isnt able to power the voice a simple chatbot and work seamlessly with it? seems kinda silly
c
are you trying to tell me how Vapi works?
No thats not it - I dont think your read the docs and just assumed it was supposed to be that way. https://docs.vapi.ai/examples/voice-widget
s
i guess im trying to tell you and others how it doesnt work
c
I am telling you what you are thinking it was never supposed to do anyway. Is it possible - yes. Through the way you just did - no.
s
i was on support call yesterday and the guy from vapi told me its possible haha
doesnt seem like a robust voice solution my the sounds of it
c
When you find it in the docs - let me know.
s
this is a very simple usecase my firend
c
To be really fair - your new right? So I dont think you really read through the docs or anything. The reason I was tagged is because I am in real tie doing what you asked. I am tryna tell you its not by Vapi. I understand support told you it's possible - but you need to make the code for it. Besides that what yu put in the chat was entriely wrong to begin with.
s
what was wrong about it. i was tryng to use a voice service to power my chatbot on my website
c
so you read the documentation on the voice widget?
s
but by the sounds of it this tool cant even do the simplest thing
yes and used the web snippets as my bases to try and intergrade it
c
You are saying you want a chatbot voice widget - and I am telling you the code never provided that. SO I am really confused on what you are upset about.
so where did it say it was chatbot? or show that it would be a chatbot?
s
its on my wix website what else could it be!
this is just typical micky mouse product stuff
its a voice solution but it doesnt do the simplest usecase
c
Yea you ae confused. I am asking in the docs where did it show or say that. It sounds like you are confused .
s
the amount of issues i was hearing on the call yesturday
Vapi sucks. for anyone reading this later just use already existing solutions they are much more robust.
stop wathing affiliate videos on youtube
this product is trash
c
Sounds like your upset you could not get something to work first try - not sure what to say to that. On top of you doing it wrong as well. Every platform has problems so yea... Glad I could help out. You cant get mad because you did not read the docs or thought the product works one way - when it does not work that way at all. Whats even crazier is you know of better solutions but came to the platform itself. That speaks volumes about ya mate. https://cdn.discordapp.com/attachments/1290331011930001419/1290706817445269585/Screenshot_2024-10-01_090714.png?ex=66fd6fe5&is=66fc1e65&hm=34e603ffd33e12b6991ba9187d0dc0af0e6b57b70e8041d23eca314ee20c3be2&
s
my guy this is suppose to be a voice solution. and its not that haha
its pathetic
c
Your just here to waste time. Have a good day. ❤️
s
maybe you should do a video about it on youtube im sure all of your 261 subscribers would be mind blown haha
c
Dam you found one channel of mine ahhh Wheres your? 🙂
s
your channel sucks.
c
Ahh a person who does not contribute and also cries. I love it. Keyboard warrior type of guy.
s
i wouldnt wanna embarrass myself like that
talk about a waste of time
c
@Sahil @Shubham Bajaj I don't think this guy wants help actually whatsoever. Might just need to close this ticket.
s
loosers like you are always bitter about something. whats wring cant get it right?
keep trying man
c
I am loser becasue you did read the docs? hahah good one.
s
dont worry @Sahil @Shubham Bajaj dont give a shit
no becuase ur clearly bitter with a chip on your shoulder
meanwhile u do nothing. you are nothing
remmeber that
😉
s
Idk, I'm not familiar worknig with Wix or the SDK. I'd try using the web snippet I pasted.
5 Views