This project demonstrates how resellers of Vida can embed the Vida web app inside a Next.js application. It walks through provisioning organizations under a reseller account, obtaining one-time authentication tokens and loading the Vida app within an iframe. A minimal email/password authentication flow is provided along with an example of triggering a phone call using Vida's embed script.
Install dependencies and start the development server:
npm install
npm run devOpen http://localhost:3000 in your browser.
Copy .env.example to .env.local and provide your Vida credentials:
VIDA_API_TOKEN– API token with access to Vida's public APIVIDA_RESELLER_ID– your reseller ID used when creating organizations
Configuration constants referenced throughout the app can be adjusted in
config/constants.js.
These values are used by app/api/vida/route.js when calling Vida's API. They ensure that any organizations created through the demo are associated with your reseller account.
- When an authenticated user visits
/home, theClientHomecomponent requests/api/vida. This endpoint usesVIDA_API_TOKENandVIDA_RESELLER_IDto fetch or create an organization under your reseller account and to obtain a one‑time authentication token. - The token and the user's email are passed to an
<iframe>pointing at the Vida web app (VIDA_EMBED_BASE_URL). This automatically logs the user into Vida inside your application. - The landing page also contains a button with the
data-vida-buttonattribute. Vida's embed script (loaded globally inapp/layout.js) turns this into a clickable call button.
See comments in the source files for further details on how each piece works:
app/api/vida/route.js– proxy route that interacts with Vida's APIlib/vida.js– small helper for GET/POST requests to Vidaapp/home/client-home.jsx– embeds the Vida app iframeapp/modalDemo/client-home.jsx– opens a Vida modal on button click
The app is a standard Next.js project and can be deployed anywhere Next.js is supported, for example Vercel. Ensure the environment variables above are configured in your hosting environment.