Code Monkey home page Code Monkey logo

call-tracking-node's Introduction

Twilio

Call tracking

Node.js CI

Call Tracking helps you measure the effectiveness of different marketing campaigns. By assigning a unique phone number to different advertisements, you can track which ones have the best call rates and get some data about the callers themselves. For a step-by-step tutorial see twilio docs to help with setting this up.

Create a TwiML App

This project is configured to use a TwiML App, which allows us to easily set the voice URLs for all Twilio phone numbers we purchase in this app.

Create a new TwiML app and use its Sid as the TWILIO_APP_SID environment variable wherever you run this app.

You'll configure the exact URL to use in your TwiML app in the "Try it out" section of this application.

Local development

Prerequisites

To run this project locally, you'll need to install:

Setup

  1. First clone this repository and cd into its directory:

    git clone https://github.com/TwilioDevEd/call-tracking-node.git
    
    cd call-tracking-node
  2. Install dependencies:

    npm install
  3. Copy the sample configuration file and edit it to match your configuration.

    cp .env.example .env

    The .env file lists where you can find or generate the values for each required variable.

    Run source .env to export the environment variables.

  4. Start the MongoDB server.

    This app requires MongoDB to be running. See how to start the MongoDB service on Windows, MacOS, or Linux (choose your Linux distribution and then see "Run MongoDB Community Edition" in the installation instructions).

  5. Run the application.

    npm start

    Alternatively you might also consider using nodemon for this. It works just like the node command, but automatically restarts your application when you change any source code files.

    npm install -g nodemon
    nodemon ./bin/www

    You should now be able to visit http://localhost:3000 on your local web browser and see a blank dashboard. The app is almost ready to go!

  6. Start ngrok

    To actually forward incoming calls, your development server will need to be publicly accessible, so that Twilio can communicate with it. We recommend using ngrok to do this. Install ngrok and then run it, exposing port 3000 (the port that your local server is running on):

    ngrok http 3000

    You will use the ngrok tunnel URL provided in the "Try it out" step below.

Run the tests

You can run the tests locally by typing

npm test

Try it out

In your Twilio app configuration you'll need to set http://<your-ngrok-domain>.ngrok.io/lead as the callback URL. Open the application and then click the "App configuration" button.

app configuration button screenshot

The button will take you to your TwiML call tracking application. Under "Voice" you will find a "Request URL" input box. There you should put the URL to the application's lead resource (e.g http://<your-ngrok-domain>.ngrok.io/lead).

webhook configuration

You can now purchase new numbers from Twilio, associate them with a lead source, and set up call forwarding from the dashboard.

To add a new number press the "Search" button on the main dashboard. You can optionally select an area code to find a number in that particular area.

phone number search

After you click "Search", you will be shown a list of available Twilio numbers that you can purchase. To select and purchase a number, click the "Purchase" button next to any of the listed available phone numbers.

available numbers view

You will then be redirected to a form where you can label the Lead Source and set up call forwarding. Now, when someone calls the number you have just purchased, it will be forwarded to the number you configure under "Forwarding number".

available numbers view

Now, when someone calls the number you purchased and labeled, the call will display in your dashboard as having been generated from that specific lead.

main dashboard view

Meta

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

call-tracking-node's People

Contributors

alexisbcc avatar atbaker avatar ccnixon avatar dependabot-preview[bot] avatar jefflinwood avatar joliveros avatar kwhinnery avatar mcelicalderon avatar molinto avatar mplacona avatar nebtrx avatar rjatkinson2 avatar sarahcstringer avatar smendes avatar well1791 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

call-tracking-node's Issues

Invalid path for Windows in repo

This repo cannot be cloned on Windows due to the following path:

cassettes/Lead sources controllers/POST /

The problem is the space character after POST.

@mcelicalderon Can you or someone on your team fix? Thanks!

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.