Git Product home page Git Product logo

airtng-node's Introduction

Twilio

AirTNG App: Part 1 - Workflow Automation with Twilio with Node.js and Express

Build Status

Learn how to automate your workflow using Twilio's REST API and Twilio SMS. This example app is a vacation rental site, where the host can confirm a reservation via SMS.

Read the full tutorial here!

Local Development

  1. You will need to configure Twilio to send requests to your application when SMS are received.

    You will need to provision at least one Twilio number with sms capabilities so the application's users can make property reservations. You can buy a number right here. Once you have a number you need to configure your number to work with your application. Open the number management page and open a number's configuration by clicking on it.

    Remember that the number where you change the SMS webhook must be the same one you set on the TwilioPhoneNumber setting.

    Configure Voice

    To start using ngrok in our project you'll have to execute to the following line in the terminal.

    ngrok http 3000

    Keep in mind that our endpoint is:

    http://<your-ngrok-subdomain>.ngrok.io/reservations/handle
    
  2. This sample application stores data in a MongoDB database using Mongoose. You can download and run MongoDB yourself (OS X, Linux, Windows).

    On OS X, maybe the easiest way to get MongoDB running locally is to install via Homebrew.

    brew install mongodb

    You should then be able to run a local server with:

    mongod
  3. Clone this repository and cd into it.

    git clone [email protected]:TwilioDevEd/airtng-node.git
    cd airtng-node
  4. Install the dependencies.

    npm install
  5. Copy the sample configuration .env.example to .env, and then edit .env to match your configuration.

cp .env.example .env

You can find your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN in your Twilio Account Settings. You will also need a TWILIO_PHONE_NUMBER, which you may find here.

Once you have edited the .env file, if you are using a UNIX operating system, just use the source command to load the variables into your environment:

source .env
  1. Run the application.
npm start
  1. Check it out at http://localhost:3000

That's it!

To let our Twilio Phone number use the callback endpoint we exposed, our development server will need to be publicly accessible. We recommend using ngrok to solve this problem.

Run the tests

You can run the tests locally by typing

npm test

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

airtng-node's People

Contributors

acamino avatar hortega avatar jarodreyes avatar joliveros avatar kathyguerron avatar kwhinnery avatar nebtrx avatar

Watchers

 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.