Thomas lambert
Thomas lambert

Reputation: 11

WebSocket Error 403 During Handshake with ElevenLabs API

I’m working on a conversational AI website, and I’m using the ElevenLabs API for voice generation and conversation handling. However, I’ve run into a problem when trying to establish a WebSocket connection to their API.

Here are the details of the issue:

Terminal Output:

✓ Compiled in 624ms (608 modules) GET / 200 in 185ms Requesting signed URL for agent: JKGi0Tt8RmaPYInI4sdL Raw ElevenLabs response: {"signed_url":"wss://api.elevenlabs.io/v1/convai/conversation?agent_id=JKGi0Tt8RmaPYInI4sdL&conversation_signature=Rzqesjb7S4vo7vSHV8DW"}

Browser Console Error:

WebSocket connection to 'wss://api.elevenlabs.io/v1/convai/conversation?agent_id=JKGi0Tt8RmaPYInI4sdL' failed: Error during WebSocket handshake: Unexpected response code: 403 Failed to start conversation: Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}

Steps Taken:

I followed the ElevenLabs documentation for requesting a signed URL and used the provided signed_url to initiate the WebSocket connection. The URL appears valid, but the server returns a 403 error during the WebSocket handshake.

Environment:

What could be causing the 403 error during the WebSocket handshake? Are there specific headers or configurations required that I might be missing?

I’ve verified that the agent ID and conversation signature are correctly passed when requesting the signed URL.

Upvotes: 1

Views: 76

Answers (0)

Related Questions