Coder Social home page Coder Social logo

philnash / ng-sms-messages Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 2.0 182 KB

An SMS application for Twilio, written with Angular and Service Workers

License: MIT License

JavaScript 39.35% TypeScript 45.08% HTML 11.90% CSS 3.68%
twilio sms twilio-sms angular angular5 service-worker push-notifications background-sync

ng-sms-messages's Introduction

Web, Twilio and Service Worker powered SMS Messages app

This is an implementation of an SMS Messages app that you can use with a Twilio number, with a front end built with Angular 6, enhanced with Service Worker features.

This was the demo application used at Angular Conf Melbourne, for the talk Service Worker - Beyond the cache.

Important code

Push Notifications

Check out the settings.component.ts for registering and unregistering for Push Notifications with the swPush service.

For sending Push Notifications, take a look at server/routes/index.js.

Background Sync

Check out the message.service.ts for registering for a sync event. And, once you have run npm install then patch-package will have updated ./node_modules/@angular/service-worker/ngsw-worker.js. Or you can just look at the patch in ./patches/@angular/service-worker+6.0.5.patch.

Running the application

Clone the repository and install dependencies:

$ git clone https://github.com/philnash/ng-sms-messages.git
$ cd ng-sms-messages
$ npm install

Copy .env.example to .env and fill in the your Twilio account credentials and the Twilio number you want to use. You can find your Account SID and Auth Token in your Twilio account portal.

$ cp .env.example .env

You also need to generate VAPID keys for your application. You can do so with:

$ npx web-push generate-vapid-keys

Add the public key to your src/environment.prod.ts file.

Then start the application. You can run it in development mode with

$ npm run dev

This will start the front end on http://localhost:4200

To use the service worker functionality, you need to create a production build and serve it. The script to perform this is:

$ npm run server

Navigate to http://localhost:3000 and you will see the application.

ng-sms-messages's People

Contributors

philnash avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.