Code Monkey home page Code Monkey logo

airtng-node's Introduction

Twilio

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

This template is part of Twilio CodeExchange. If you encounter any issues with this code, please open an issue at github.com/twilio-labs/code-exchange/issues.

About

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!

Implementations in other languages:

.NET Java Python PHP Ruby
Done Done Done Done Done

Set up

Requirements

Twilio Account Settings

This application should give you a ready-made starting point for writing your own application. Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN You could find them in your Twilio Account Settings
TWILIO_NUMBER You can get one here

Local Development

  1. Clone this repository and cd into it.

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

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

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables. The phone numbers should be in E.164 format.

  4. Run the application (will run on port 3000).

    npm start
  5. Check it out at http://localhost:3000

  6. To let our Twilio Phone number use the callback endpoint we exposed, our development server will need to be publicly accessible. You could expose the application to the wider Internet using ngrok. Here there is an interesting article about why we recommend you to use ngrok.

    ngrok http 3000

    Keep in mind that our endpoint is:

    http://<your-ngrok-subdomain>.ngrok.io/reservations/handle
    
  7. 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. On Twilio Account Settings you could find the link to buy a Twilio number. 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 Messaging

That's it!

Docker

If you have Docker already installed on your machine, you can use our docker-compose.yml to setup your project.

  1. Make sure you have the project cloned.
  2. Setup the .env file as outlined in the Local Development steps.
  3. Run docker-compose up.
  4. Follow the steps in Local Development on how to expose your port to Twilio using a tool like ngrok and configure the remaining parts of your application.

Tests

You can run the tests locally by typing

npm test

Resources

  • The CodeExchange repository can be found here.

Contributing

This template is open source and welcomes contributions. All contributions are subject to our Code of Conduct.

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

airtng-node's People

Contributors

acamino avatar rojastob avatar hortega avatar jarodreyes avatar jonedavis avatar joliveros avatar maylonpedroso avatar jefflinwood avatar kathyguerron avatar kwhinnery avatar dependabot-preview[bot] avatar nebtrx 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.