#for the web widget. how do i send the conversation_id after the call has finished?

1 messages · Page 1 of 1 (latest)

frank tendonBOT
#
AI-generated Answer for shawn_kerch

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!

twin meteor
#

how do i send the full conversation to api endpoint after its finished for the web widget?

frank tendonBOT
#
AI-generated Answer for shawn_kerch

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:

  1. Retrieve the conversation_id:
    When the conversation starts, you can capture the conversation_id using the conversation_start event 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
    });
    
  2. Fetch the Conversation Details:
    Once the conversation ends, use the conversation_id to 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_id
    

    Replace :conversation_id with the actual ID of the conversation.

  3. 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);
        }
    }
    
  4. 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!

twin meteor
#

how do i get this configured on my server code?