Skip to content

waveformhealth/virtualvisit-server

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Virtual Visit Server

About

This is the server component of Virtual Visit, a product for making video calls simple for patients in hospitals. This project was created during the Twilio x DEV community hackathon.

How it works

This application creates a web service to manage Virtual Visits (video calls) using Twilio Programmable Video. It also uses Twilio Programmable SMS for sending Virtual Visit invitations.

Features

  • Web server using Ktor
  • Dockerfile for easy development and deployment using Docker
  • One click deploy button for Heroku

Set up

The following steps assume you are running Linux but should be adaptable for Mac or Windows

Requirements

Environment variables

Before we begin, we need to collect all the environment variables we need to run the application:

Environment Variable Description
TWILIO_ACCOUNT_SID Your primary Twilio account identifier - find this in the Console.
TWILIO_AUTH_TOKEN Used to authenticate - just like the above, you'll find this here.
TWILIO_API_KEY Used to grant access tokens - find this in the console.
TWILIO_API_SECRET Also used to grant access tokens - and also found in the console.
TWILIO_PHONE_NUMBER A Twilio phone number - you can get one here
INVITE_BASE_URL The base URL sent as part of the Virtual Visit invitation

Local development

The easiest way to getting started with development on the project is to use Intellij IDEA.

After installation, start Intellij and create a new project from version control:

File > New > Project from Version Control...

Ensuring "Git" is selected, enter this repository URL and then click "Clone".

With the new project opened, edit your configuration to set the required environment variables:

  1. Run > Edit Configurations...
  2. Click the "Kotlin" dropdown, select the virtualvisit configuration, and click the Copy icon
  3. Ensure the "Store as project file" toggle is not selected
  4. Select the "Environment variables" "Browse" button to update the environment variables for this configuration

Local deployment (with Docker)

  1. Clone this repository and cd into it
git clone git@github.com:waveformhealth/virtualvisit-server.git
cd virtualvisit-server
  1. Build the Docker image
sudo docker build -t virtualvisit-app .
  1. Create the env-file for Docker

Copy the env.list.dev file to env.list:

cp env.list.dev env.list

Now edit env.list and add your [environment variables](#environment variables).

  1. Run the application
sudo docker run -m512M --cpus 2 -it --env-file ./env.list -p 8080:8080 --rm virtualvisit-app

That's it! The server can now be accessed at localhost:8080. See the API docs to discover the APIs.

Cloud deployment

In addition to trying out this application locally, you can easily deploy it to a variety of host services as a Docker container.

You can also try out one click deployments below.

Service
Heroku Deploy

API

NOTE: The secret used below refers to a code randomly generated by the server. If specified in the examples below, this code must be provided by the client in order to access the resource. This is only for development and testing purposes. This mechanism should be replaced before deploying to production.

Create a room

POST /v1/room
curl -u secret: -X POST "https://example.com/v1/room"

Response example:

{
  "sid": "RM00000000000000000000"
}

Request a token

GET /v1/token
Attribute Type Required Description
room string yes The room sid a token is being requested for
code string no (optional) The room access code. Required if an Authentication token is not provided
curl -u secret: -X GET "https://example.com/v1/token?room=RM00000000000000000000"

The secret here is optional if a valid room and room access code are provided

Response example:

{
  "token": "0000000000000000000000"
}

Send an invitation

POST /v1/invitation
Attribute Type Required Description
room string yes The room sid to include in the invitation
phone string yes The phone number to send the invitation to via SMS
curl -u secret: -X POST -H "Content-Type: application/json" -d '{"room": "RM00000000000000000000", "phone": "0000000000"}' "https://example.com/v1/invitation"

Response example:

202 Accepted

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published