Giter Club home page Giter Club logo

airtng-laravel's Introduction

Airtng App: Part 1 - Workflow Automation with Twilio - Laravel

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!

Run the application

  1. Clone the repository and cd into it.

  2. Install the application's dependencies with Composer

    $ composer install
  3. The application uses PostgreSQL as the persistence layer. If you don't have it already, you should install it. The easiest way is by using Postgres.app.

  4. Create a database.

$ createdb airtng
  1. Copy the sample configuration file and edit it to match your configuration.

    $ cp .env.example .env

You can find your TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN under your Twilio Account Settings. You can buy a Twilio phone number here Twilio numbers TWILIO_NUMBER should be set according to the phone number you purchased above.

  1. Generate an APP_KEY.

    $ php artisan key:generate
  2. Run the migrations.

$ php artisan migrate
  1. Load the seed data.
$ php artisan db:seed
  1. Expose the application to the wider Internet using ngrok

    $ ngrok http 8000

    Once you have started ngrok, update your Twilio number sms URL settings to use your ngrok hostname. It will look something like this:

    http://<your-ngrok-subdomain>.ngrok.io/reservation/incoming
    
  2. Configure Twilio to call your webhooks.

You will also 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 it 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 webhooks must be the same one you set on the TWILIO_NUMBER environment variable.

Configure Voice

For this application, you must set the voice webhook of your number so that it looks something like this:

http://<your-ngrok-subdomain>.ngrok.io/reservation/incoming

And in this case set the POST method on the configuration for this webhook.

  1. Run the application using Artisan.
$ php artisan serve

It is artisan serve default behaviour to use http://localhost:8000 when the application is run. This means that the ip addresses where your app will be reachable on you local machine will vary depending on the operating system.

The most common scenario is that your app will be reachable through address http://127.0.0.1:8000. This is important because ngrok creates the tunnel using only that address. So, if http://127.0.0.1:8000 is not reachable in your local machine when you run the app, you must tell artisan to use this address. Here's how to set that up:

$ php artisan serve --host=127.0.0.1

Dependencies

This application uses this Twilio helper library:

Run the tests

  1. Run at the top-level directory.

    $ phpunit

    If you don't have phpunit installed on your system, you can follow these instructions to install it.

Meta

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

airtng-laravel's People

Contributors

kathyguerron avatar kwhinnery avatar mcelicalderon 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.