Skip to content
REST API

A voice agent with a Czech number in your Lovable app

Lovable builds apps on React with a Supabase backend - calling the volai REST API belongs on the server, in one Edge Function, not in the browser.

1Save your API key as a Supabase secret

In the Supabase project Lovable created for your app, add an environment variable VOLAI_API_KEY with your key's value (portal, API and MCP section). Never put it in frontend code or commit it to a repository - anyone who saw it could spend your credit.

2Call volai from an Edge Function

Create an Edge Function that accepts a request from your app, and only IT calls https://volai.cz/v1/messages with an Authorization: Bearer ${VOLAI_API_KEY} header. The same pattern works for POST /v1/calls (a call through your voice agent).

typescript
// supabase/functions/send-sms/index.ts
Deno.serve(async (req) => {
  const { to, body } = await req.json();

  const res = await fetch("https://volai.cz/v1/messages", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${Deno.env.get("VOLAI_API_KEY")}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ to, body }),
  });

  return new Response(await res.text(), { status: res.status });
});

3Call the function from your UI

From an app component, call the Edge Function through supabase.functions.invoke(...) - the key stays on the server, the app only sends to and the message text.

typescript
const { data, error } = await supabase.functions.invoke("send-sms", {
  body: { to: "+420777123456", body: "Objednavka je pripravena." },
});

4Set a webhook so the app learns the call outcome

Create a second Edge Function that accepts an event (call.completed, call.failed, call.no_answer, call.missed, message.sent) and writes it to a Supabase table - the app reads it back through Realtime or a normal query. Save the address with PUT /v1/webhook; an empty events array would mean every event, so list the ones you want.

bash
curl -X PUT https://volai.cz/v1/webhook \
  -H "Authorization: Bearer vk_TVUJ_KLIC" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://tvuj-projekt.supabase.co/functions/v1/volai-webhook", "events": ["call.completed", "message.sent"]}'

5Optional: let Lovable AI wire it up for you

Lovable can reach for an outside tool through its own MCP integration (Custom MCP servers / Custom connectors in its integration settings) while building your app. The server address is https://volai.cz/mcp, authenticated with Authorization: Bearer vk_YOUR_KEY - the exact buttons in Lovable's UI change faster than this page can track, so check docs.lovable.dev/integrations for the current steps.

What you can do with it

Order or booking confirmation by SMS

A Lovable-built store or booking app calls its own Edge Function after payment, which sends a confirmation SMS with the order details.

A voice agent that answers the phone for your app

The app buys a phone number and creates an agent through REST (or you set it up in the portal) - your app's customers then call a real Czech number, not an outside platform.

Lovable AI wires up calling and SMS on its own

While building the app, let Lovable AI reach for volai through Custom MCP - describe the feature in words ("add a button that calls the customer") and it picks the right tool itself.

Frequently asked questions

Can I call the volai API directly from the app's frontend code?
No. An API key doesn't belong in the browser - anyone who opened the developer console could see it and spend your credit. Always go through an Edge Function or another server route that keeps the key on the backend.
Is there a native Lovable connector for volai?
Not yet - native connectors in Lovable are always partnerships (that's how the ElevenLabs one works). Today the path is REST from an Edge Function, or the generic Custom MCP server described above.
How does the app learn a call ended, without constant polling?
Write the call.completed webhook into a Supabase table from an Edge Function, and read the change in the app through Supabase Realtime - no polling.
How much will running this cost?
The same pricing as the pricing page, no surcharge for using Lovable: SMS 1.36 CZK (~EUR 0.06), outbound calls 0.92 CZK/min (~EUR 0.04), the built-in voice agent adds 2.50 CZK/min (~EUR 0.10). Full pricing is at /en/pricing.

Try it now

Sign up and get 50 CZK in credit on top.