This is a Contact Center like app with support for Voice and Chat.
-
Backend - ./supabase-backend A Common backend using:
-
Main Web App - ./main-app
A Contact Center like app with support for Voice and Chat using:
-
Android Voice Sample App - ./android-voice
An Android application powered by the Vonage Voice API to make and receive VOIP Calls using:
-
Android Chat Sample App - ./android-chat
An Android application that showcases how to integrate the Vonage Chat Client SDK for real-time chat functionality using:
-
iOS Voice Sample App - ./ios-voice
An iOS application powered by the Vonage Voice API to make and receive VOIP Calls using:
-
iOS Chat Sample App - ./ios-chat
An iOS application that showcases how to integrate the Vonage Chat Client SDK for real-time chat functionality, using:
Almost all dependencies are installed via npm install
however you will need to ensure you have the following installed:
- NodeJS (v18+) - Download NodeJS or if you use nvm run
nvm use
from the root to switch to the correct version - Docker - Download Docker Desktop or OrbStack is good if on MacOS
Although installed via npm install
you may need to install the following manually:
- Ngrok Tunnel - This is used to expose your local server to the internet (or localtunnel)
- localtunnel - This is used to expose your local server to the internet (or ngrok)
- Supabase CLI - This is used to start your local Supabase instance
Nice to have:
- Vonage CLI - This is used to create the Vonage API application although you can do this manually via the dashboard
You will also need a few accounts:
- Vonage API Account - You will need to create a Vonage API account to get your API Key and Secret
- Google Cloud Account - if you wish to configure OAuth for Google (optional, instructions coming soon)
- Github Account - if you wish to configure OAuth for Github (optional, instructions coming soon)
-
Clone this monorepo
-
Run
npm install
from the root of the monorepo (if using nvm runnvm use
first) -
Run
npm run db:start
to start your Supabase instance (this will take a while the first time and once it's done it should print a list of urls and keys to the console you will need these later) -
Make a new vonage application either via the dashboard or via the CLI (see Vonage CLI) and make a note of the application ID and private key. You will need these later.
# Create a new Vonage Application npx @vonage/cli apps:create "Contact Center" --voice_answer_url=https://example.com/answer --voice_event_url=https://example.com/event # this will output some info about the application including the ID and private key # this command will also create 'vonage-app.json' which contains the application ID and private key and 'private.key' which contains the private key
-
Create a new copy of the
.env.example
file and name it.env
and fill in the values from the previous stepsNEXT_PUBLIC_SUPABASE_URL
- The Supabase URL from step 3NEXT_PUBLIC_SUPABASE_ANON_KEY
- The Supabase Anon Key from step 3, you can grab it by running supabase status inroot/apps/supabase-backend
directoryVONAGE_API_KEY
- The Vonage API Key used to create the Vonage Application from step 4VONAGE_API_SECRET
- The Vonage API Secret used to create the Vonage Application from step 4VONAGE_APPLICATION_ID
- The Vonage Application ID from step 4VONAGE_PRIVATE_KEY
- The Vonage Application Private Key from step 4 (I recommend the private key string from thevonage-app.json
file)DEVICE_REFRESH_TOKEN_SECRET
- A random string used to encrypt the refresh token for the device (this is used to keep the device logged in)DEVICE_CODE_SALT
- A random string used to encrypt the device code (this is used to keep the device logged in)
-
Run
npm run dev:contact-center
to start the development server -
Configure Database webhook for new users
- Go to your local Supabase studio (should be at
http://localhost:54323
) - Open the default project
- Go to the Database tab then Webhooks (should be at
http://localhost:54323/project/default/database/hooks
) - Click 'Create New hook' and make a webhook with the following settings:
- Name:
new_user
- Table:
auth.users
- Event:
INSERT
andDELETE
- Method:
POST
- URL:
http://host.docker.internal:54321/functions/v1/new-user
(this is the url of your edge function) - Headers:
Content-Type: application/json
- Name:
- Go to your local Supabase studio (should be at
TODO: Add instructions for configuring OAuth
Add the following to your .env
file:
LOCALTUNNEL=true
- Once you have followed the setup instructions you should be able to go to
http://localhost:3000
and see the app - You can login with magic link (or with Google or Github if you have configured OAuth)
- Local Magic Link instructions:
- Use any email address with the domain
@vonage.com
(e.g.test@vonage.com
it doesn't need to be a real email address) - Go to
http://localhost:54324/m/{mailbox}
where{mailbox}
is the mailbox you want to login to (e.g.http://localhost:54324/m/test
for the email addresstest@vonage.com
) - You should see an email with a link to login to the app
- Click the link and you should be redirected to the app and logged in
- Use any email address with the domain
- Local Magic Link instructions:
- You can now make and receive calls