Below is a detailed article on how to integrate Airtable with ElevenLabs to create voice agents for a website. This setup allows you to store conversation prompts, user data, or agent configuration in Airtable, while leveraging ElevenLabs for text-to-speech (TTS) and, optionally, advanced speech-to-text capabilities. We will walk through an example workflow, data modeling in Airtable, integrations with JavaScript, and how to include a code snippet (shown below) that handles redirection after a voice interaction.
Voice-based interactions have gained traction as users often find them more intuitive and hands-free. ElevenLabs provides high-quality text-to-speech (TTS) technology, which can be embedded into a website or application to enable a conversational user interface.
However, creating a scalable or easily maintainable voice agent often requires a centralized repository for prompts, responses, or user data. That’s where Airtable comes in. Airtable combines the familiarity of a spreadsheet with the power of a database, allowing both technical and non-technical teams to manage data, logic triggers, and more.
By coupling Airtable’s flexible database with ElevenLabs’ powerful voice technology, you can build user-friendly voice agents that fetch data, respond in natural-sounding voices, and guide users through various tasks on your website.
Create a new Base: Go to Airtable, sign in, and create a new base. You might name it “Voice Agent” or “Website Voice Assistant.”
Design Tables: Determine what information you want your voice agent to use or provide. Common tables may include:
Generate API Credentials: Go to “Account” in Airtable to generate an API key. You will need this to query or update your Airtable data from your website’s JavaScript code.
https://airtable.com/appXXXX/api/docs). It shows you the endpoint for each table and how to query them.// Example: fetch prompts from "Prompts" table
const baseId = "appXXXX"; // Your Airtable base ID
const tableName = "Prompts"; // The table where you store prompts
const apiKey = "keyXXXX"; // Your Airtable API key
async function getPrompts() {
const response = await fetch(`https://api.airtable.com/v0/${baseId}/${tableName}`, {
headers: {
Authorization: `Bearer ${apiKey}`
}
});
const data = await response.json();
return data.records;
}
filterByFormula) to retrieve only the relevant records for a specific scenario or user query.ElevenLabs provides an API and a custom element (like <elevenlabs-convai>) to handle text-to-speech interactions. Depending on your setup, you might:
<elevenlabs-convai>, simply pass it text content to speak aloud.A typical usage might look like this:
Sometimes your voice agent needs to guide users to a specific article, product page, or other resource. Below is a sample code snippet that:
elevenlabs-convai:call event (a hypothetical custom event emitted by the ElevenLabs web component).redirect_to_a_page within clientTools.url parameter with the current website’s hostname (and port, if present).<elevenlabs-convai agent-id="YourAgentCode"></elevenlabs-convai>
<script>
document.querySelector('elevenlabs-convai').addEventListener('elevenlabs-convai:call', (e) => {
e.detail.config.clientTools = {
redirect_to_a_page: async ({ url }) => {
console.log("Original URL:", url);
// Parse the incoming URL
const parsedUrl = new URL(url);
// Replace the hostname with the current browser tab's hostname
parsedUrl.hostname = window.location.hostname;
// If the current page is served on a specific port, use that in the new URL
if (window.location.port) {
parsedUrl.port = window.location.port;
} else {
// If no port is set on the current page, remove any port from the parsed URL
parsedUrl.port = '';
}
// Keep the same protocol as the current page (http / https)
parsedUrl.protocol = window.location.protocol;
// Wait 2 seconds before redirecting
setTimeout(() => {
window.location.href = parsedUrl.href;
}, 2000);
return "Redirect scheduled after 2 seconds.";
}
};
});
</script>
<script src="https://elevenlabs.io/convai-widget/index.js"
async type="text/javascript"></script>
elevenlabs-convai:call event from the <elevenlabs-convai> element.clientTools: The clientTools object is extended with custom behaviors. Here, we define redirect_to_a_page.URL constructor, replace the hostname and port with the current site’s details. This ensures the user remains on your domain even if the original URL is from a different domain.parsedUrl.protocol = window.location.protocol, we ensure that the protocol remains http or https (as appropriate for your site).setTimeout is used to introduce a 2-second delay, which can improve user experience (for example, letting the voice agent finish speaking a confirmation message).<elevenlabs-convai> web component (or any other ElevenLabs integration you are using).redirect_to_a_page) can be invoked by the voice agent, guiding them to the correct article.Combining Airtable’s flexible database capabilities with ElevenLabs’ advanced TTS engine opens up exciting possibilities for engaging voice-based interactions on your website. Whether you are guiding customers through a product catalog, helping users navigate an online course, or providing audio assistance for an FAQ, the workflow remains the same:
This modular approach ensures that non-technical team members can update the voice agent’s content through Airtable, while developers fine-tune the website’s logic and user experience. Over time, you can scale and refine your voice agent by adding more data tables, customizing voice outputs, or integrating natural language understanding (NLU) for more sophisticated interactions.
By following these steps, you can create a seamless voice agent that delivers real-time, on-demand, and context-aware guidance to users—all powered by Airtable’s structured data and ElevenLabs’ high-quality voice technology.