Code Monkey home page Code Monkey logo

clicktocall-node's Introduction

Twilio

Click to Call - Node.js

This repository is archived and no longer maintained. Check out the Twilio Voice docs for links to other tutorials.

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 Your primary Twilio account identifier - find this in the Console.
TWILIO_AUTH_TOKEN Used to authenticate - just like the above, you'll find this here.
TWILIO_NUMBER A Twilio phone number in E.164 format - you can get one here

Local Development

  1. First clone this repository and cd into it.

    git clone https://github.com/TwilioDevEd/clicktocall-node.git
    cd clicktocall-node
  2. Install the dependencies.

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

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables.

  4. Launch local development web server, will run on port 3000.

    npm start
  5. For Twilio to be able to talk to your application, you'll need a way to make your server publicly available to the internet. For local testing purposes, we recommend using ngrok. Ngrok provides secure introspectable tunnels to localhost webhook development: for more information and instructions on setting up ngrok to work with your application, check out this section of the Click to Call tutorial.

    ngrok http 3000
  6. Finally, open up your browser and go to your ngrok URL. It will look something like this: http://<sub-domain>.ngrok.io

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

To execute tests, run the following command in the project directory:

npm test

Resources

  • The CodeExchange repository can be found here.

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

clicktocall-node's People

Contributors

acamino avatar bld010 avatar dependabot[bot] avatar dprothero avatar jarodreyes avatar joliveros avatar jonedavis avatar juancarlospaco avatar kathyguerron avatar kwhinnery avatar maylonpedroso avatar mcelicalderon avatar nebtrx avatar rojastob avatar saadq avatar smendes avatar

Stargazers

 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  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

clicktocall-node's Issues

Error: The request resource /2010-04-01/Accounts/:Account-SID/Calls.json was not found

Hello,

I'm trying to execute the server and run the web application on my local server, using ngrok as my online publisher for my app. When I submit the information to execute the code I get a 500 Error:

{"readyState":4, responseText":{"status":404, \message":"The requested resource /2010-04-01/Accounts/{myAccoundID}/Calls.json was not found,"code":20404,"moreInfo":\https://www.twilio.com/docs/errors/20404\"}","status":500,"statusText":"Internal Server Error"}

OS: I'm running a debian Linux 4.9.35 Jessie
Platform: Raspberry Pi model B+

I can't install the heroku toolbelt on either my windows machine or my raspberry pi machine, how do I ensure the call isn't returning a 500 error?

Getting Error 21205

Hi, I cloned this project and I am getting this error:
localhost:3000 says
{"readyState":4,"responseText":"{"status":400,"code":21205,"moreInfo":"https://www.twilio.com/docs/errors/21205\"}","responseJSON":{"status":400,"code":21205,"moreInfo":"https://www.twilio.com/docs/errors/21205"},"status":500,"statusText":"Internal Server Error"}
I double checked ngrok and it is fwding on port 3000:

Session Status online
Account Twilio (Plan: Twilio)
Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://1668b3b4.ngrok.io -> http://localhost:3000
Forwarding https://1668b3b4.ngrok.io -> http://localhost:3000

Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00

How can I troubleshoot further this issue?

Thanks!
Al

Getting Error : username is required on node app.js run

F:\laragon\www\twillio_starter\node_modules\twilio\lib\rest\Twilio.js:98
throw new Error('username is required');
^

Error: username is required
at new Twilio (F:\laragon\www\twillio_starter\node_modules\twilio\lib\rest\Twilio.js:98:11)
at initializer (F:\laragon\www\twillio_starter\node_modules\twilio\lib\index.js:8:10)
at Object. (F:\laragon\www\twillio_starter\routes\index.js:11:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)

Getting error 21205

Hi! I have cloned this repository and configured the app as README.md states.

Unfortunately, when I make a phone call, I got this error printed on the console window

{ [Error: Url is not a valid url: http://localhost:3000/outbound/%2B1%20842-261-2148]
  status: 400,
  message: 'Url is not a valid url: http://localhost:3000/outbound/%2B1%20842-261-2148',
  code: 21205,
  moreInfo: 'https://www.twilio.com/docs/errors/21205',
  detail: undefined }

I have looked through this link , but it doesn't seem to help much since I didn't change any line in the project.

Please, help me fix this problem

Code Exchange quality checklist

The purpose of this checklist is to assess the state of this repository, and bring it to an acceptable level for long-term support by completing the tasks listed below.

This checklist is used internally but can be used as a guidance for others

Please check every part of this checklist for us to process your request. You can do this by marking them with [x] instead of [ ].

Documentation

  • LICENSE file exists in repository

  • Code of Conduct exists in repository

  • CONTRIBUTING exists in repository

  • No broken links in README.md

  • Build status exists at top of README.md

  • Set up steps are complete and accurate

  • CodeExchange repository is linked in README.md

GitHub

  • Dependabot set up

  • Dependabot automerge set up

  • Uses GitHub Actions (required for Twilio sample) or other CI

Code

  • Packages/dependencies are up to date

  • Code compiles against latest packages/dependencies

  • Matches CodeExchange Guidelines to the best of ability

Tests

  • Functionality tests have been created

  • All tests pass

App

  • Confirmed sample behaves as expected (after dependencies have been updated)

  • This file has been copied into a wiki entry for the respective repository or added as a GitHub issue

General

  • App is released under a permissive license like MIT or Apache-2

  • I've read and followed the contribution guidelines

  • I've read and implemented my template according to the respective coding guidelines for my project

  • I agree and adhere to the Code of Conduct

  • The template has been authored by me / or my organization and will be kept up-to-date. If the template will not longer be maintained, I'll notify this project.

Which version to use?

Is it ok if we use client.makeCall ?

or it should be changed to client.calls.create ?

Error: username required but have env file set up

I am working on a Node/React app and am trying to integrate Twilio. I have my .env file set up properly and have this on my server file:
const client = require('twilio')(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);
I looked into the node modules just to check and it should be satisfying the requirements but isn't. If I comment out the username part, it errors on the password too.
I know the auth token and sid are correct, so I'm at a loss. I'm fairly new to coding as well, so I'm hoping I'm just missing something simple. I followed the tutorial from the react-express-starter and got that to work, but when I started to use in my app I ran into these problems. Help!

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.