#for the web widget. how do i send the conversation_id after the call has finished?
1 messages · Page 1 of 1 (latest)
Currently, the ElevenLabs Conversational AI widget does not support resuming conversations using a conversation_id. While you can capture and save the conversation_id during a session, there is no functionality to pass it back to the widget to continue a previous conversation. This feature is under consideration for future updates, but there is no timeline for its release.
If you have further questions or need assistance with other features, feel free to ask!
how do i send the full conversation to api endpoint after its finished for the web widget?
To send the full conversation to an API endpoint after it has finished for the web widget, you can use the conversation_id to retrieve the conversation details via the API. Here's how you can do it:
-
Retrieve the
conversation_id:
When the conversation starts, you can capture theconversation_idusing theconversation_startevent from the widget. For example:widget.addEventListener('conversation_start', (event) => { const conversationId = event.detail.conversation_id; console.log(`Conversation ID: ${conversationId}`); // Save the conversation ID for later use }); -
Fetch the Conversation Details:
Once the conversation ends, use theconversation_idto call the Get conversation details API endpoint. This endpoint allows you to retrieve the transcript and other details of the conversation. The endpoint format is:GET https://api.elevenlabs.io/v1/convai/conversations/:conversation_idReplace
:conversation_idwith the actual ID of the conversation. -
Send the Transcript to Your API Endpoint:
After fetching the conversation details, you can send the transcript to your desired API endpoint using an HTTP POST request. Here's an example in JavaScript:async function sendConversationToWebhook(conversationId) { try { // Fetch conversation details const response = await fetch(`https://api.elevenlabs.io/v1/convai/conversations/${conversationId}`, { method: 'GET', headers: { 'xi-api-key': 'YOUR_API_KEY', // Replace with your API key 'Content-Type': 'application/json' } }); if (!response.ok) { throw new Error('Failed to fetch conversation details'); } const conversationDetails = await response.json(); // Send the transcript to your webhook await fetch('https://your-webhook-url.com', { // Replace with your webhook URL method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(conversationDetails) }); console.log('Conversation sent to webhook successfully'); } catch (error) { console.error('Error sending conversation to webhook:', error); } } -
Trigger the Process After the Call Ends:
Ensure you trigger the above function after the conversation ends. You can implement a mechanism to detect when the call has concluded and then execute the function.
This approach allows you to retrieve the full conversation details and send them to your desired API endpoint. Let me know if you need further clarification!
how do i get this configured on my server code?