Skip to content

tarikub/opFaceMask

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

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

Twilio Dev Hackathon

SMS Powered Realtime COVID-19 Mask Donation Drive tracker

About

This application provides the ability for users to run grassroots donation drives for coordinating home-made and donated face masks as part of the effort to curb the spread of COVID-19 virus. Users can control their donation drives by sending text messages to a designated auto-provisioned Twilio number and start receiving and distributing face masks.

This is a sample application developed for Twilio x DEV community hackathon.

Twilio APIs Used

  • Programmable SMS
    • Twilio.Rest.Api.V2010.Account
    • Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry

Implementations in other languages:

.NET Java Python PHP Ruby
YES TBD TBD TBD TBD

Demo

Twilio Dev Hackathon Demo

How it works

  1. User who wants to start a donation center sends SMS message with Start to a designated Twilio number to start a donation drive
  2. The application will respond back with address validation request and once the center address is validated the application sets up a new Twilio phone that the donation center coordinator can share for receving donated masks and also distributing masks
  3. Donation centers are displayed real-time on Google map
  4. Donation center coordinator can text Close to stop the donation event

Activity Diagram

Donation center establishment process.

Activity diagram

Features

  1. Twilio SMS - to control center opertaions (start/stop event)
  2. Google Geolocation & Map API - to validate addresses and display map
  3. Azure Serverless Function - to orchestrate SMS operations
  4. Azure hosted SignalR service - to broadcast donation centes real-time
  5. Angular to display realtime map data

Set up

Requirements

  • Visual Studio 2019
  • Azure storage explorer
  • Node.js
  • A Twilio account - sign up

Account Settings

Before we begin, we need to collect all the config values we need to run the application:

Twilio Account Settings

Config Value Description
Account Sid Your primary Twilio account identifier - find this in the Console.
Auth Token Used to authenticate - just like the above, you'll find this here.
Phone number A Twilio phone number in E.164 format - you can get one here

Google Services

Configuration values needed.

Config Value Description
API KEY API key used for Google Map and Geolocation services - find this in the Goggle Cloud Console.

How to provision services in Google Cloud Console.

  1. Go to API Manager
  2. Click on Overview
  3. Search for Google Maps JavaScript API (Under Google Maps APIs). Click on that
  4. You will find Enable button there. Click to enable API.
  5. Search for Geocoding API and enable that as well

Azure Services

Configuration values needed.

Config Value Description
SignalR Connection String Connection string for Azure Hosted SignalR in the Azure portal.

How to set up a hosted SignalR service

  1. Go to Azure portal and create a new Hosted SignalR service
  2. One the service is provisioned get the connection string from the Service > Keys blade

Local development

  1. Clone this repo
  2. Add the following json as local.settings.json file under OpFaceMask\opFaceMask.Functions directory
{
    "IsEncrypted": false,
  "Values": {
    "Simulated":  true,
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "donatedItem": "Masks",
    "googleApiKey": "[YOUR GOOGLE API KEY]",
    "accountSid": "[YOUR TWILIO ACCOUNT SID]",
    "appPhone": "[YOUR TWILIO PHONE NUMBER]",
    "webHookUrl": "[YOUR ORCHESTRATOR FUNCTION URL]",
    "voiceUrl": "[SAMPLE VOICE URL - CAN USE TwiML Bins]"
  }
}
  1. Add your GoogleMap API key on OpFaceMask\opFaceMask.Web\ClientApp\src i.e.
  <script src="https://maps.googleapis.com/maps/api/js?key=[YOUR GOOGLE API KEY]"
            type="text/javascript"></script>
  1. With command terminal go to OpFaceMask\opFaceMask.Web folder and run the command to save the hosted SignalR connection string.
dotnet user-secrets set Azure:SignalR:ConnectionString "<Your connection string>"
  1. Run the solution file. (This should bring up Azure Function Console terminal and also start the ANgular map website)

  2. Run the Simulator app fnOpFaceMask.Simulator after the website loads.

SMS Operations

  1. Text 'start' to your Twilio number to start a donation drive
  2. Text 'close' to your Twilio number to end a donation drive
  3. Text 'donate' to your Twilio number to donate items
  4. Text 'receive' to your Twilio number to receive donated items

Running Modes

By default the application runs in demo mode where it accepts text messages from a simulator application. To test with a Twilio number change the Simulated flag in local.settings.json to false.

Resources

Contributing

This repo is open source and welcomes contributions.

Visit the project on GitHub

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

About

SMS Powered Realtime COVID-19 Mask Donation Drive tracker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published