GithubHelp home page GithubHelp logo

twiliodeved / send-sms-during-inbound-calls-java Goto Github PK

View Code? Open in Web Editor NEW
1.0 15.0 3.0 58 KB

Learn how to send an SMS to someone who's called your Twilio phone number while they're on the call

License: MIT License

Java 85.06% Shell 3.30% Dockerfile 7.39% Makefile 4.25%
twilio-voice twilio-sms

send-sms-during-inbound-calls-java's Introduction

Twilio

Send an SMS during a phone call. Powered by Twilio and Java/Spark

We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at github.com/twilio-labs/code-exchange/issues and we'll try to help you.

About

Learn how to send an SMS to someone who's called your Twilio phone number while they're on the call.

This small sample application will say a short message to an inbound caller and, at the same time, send them an SMS.

Read the full tutorial here!

Implementations in other languages:

PHP .NET Python Ruby Node
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 appointment reminder application. Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
Account Sid Your primary Twilio account identifier - find this in the Console.
Auth Token Used to authenticate - just like the above, you'll find this here.

Local development

After the above requirements have been met:

  1. Clone this repository and cd into it

    git clone [email protected]:TwilioDevEd/send-sms-during-inbound-calls-java.git
    cd send-sms-during-inbound-calls-java
  2. Set your environment variables

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables.

    If you are using a UNIX operating system, load the environment variables before the application starts.

    source .env

    If you are using a different operating system, make sure that all the variables from the .env file are loaded into your environment.

  3. Run the application

    make serve

    NOTE: If you are using a dedicated Java IDE like Eclipse or IntelliJ, you can start the application within the IDE and it will start in development mode, which means any changes on a source file will be automatically reloaded.

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 environmental variables in the docker-compose.yml file, see the Twilio Account Settings.
  3. Run docker-compose --env-file /dev/null up.
  4. Follow the steps in Configure Twilio section 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:

./gradlew test

Configure Twilio

You will need to configure Twilio to call your application when calls are received in your Twilio Number. 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.

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

ngrok http 8080 -host-header="localhost:8080"

Update your Twilio number voice URL with the following URL.

http://<your-ngrok-subdomain>.ngrok.io/answer

Make a call to your number to try.

Cloud deployment

Additionally to trying out this application locally, you can deploy it to a variety of host services. Here is a small selection of them.

Please be aware that some of these might charge you for the usage or might make the source code for this application visible to the public. When in doubt research the respective hosting service first.

Service
Heroku Deploy

Some notes:

  • For Heroku, please check this to properly configure the project for deployment.
  • You can also follow this guide to deploy the application to several other cloud services including Google Cloud, Oracle Cloud, etc.

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.

send-sms-during-inbound-calls-java's People

Contributors

dependabot-preview[bot] avatar maylonpedroso avatar dkundel avatar jonedavis avatar nickfun avatar

Stargazers

 avatar

Watchers

 avatar Jarod Reyes avatar James Cloos avatar  avatar Sam Agnew avatar Kat King avatar Craig Dennis avatar Ricky avatar Lizzie Siegle avatar Angie Rojas avatar Stefani Castellanos avatar sstringer avatar Tom Wanzek avatar  avatar  avatar

send-sms-during-inbound-calls-java's Issues

RE: Bump twilio from 7.24.1 to 7.47.2

#19
Bumps com.twilio.sdk:twilio from 7.24.1 to 7.47.2. This update introduces changes in 432 existing functions: 4 of those functions are called by 1 function(s) in this project and has the risk of creating potential regression errors. We advise you to review these changes before merging the pull request.

Below are project functions that will be impacted after the update:

  • f!f!f!
    Sample Affected Path(s)
    com.twilio.app.App.sendSms
          at: com.twilio.base.Creator.create
          at: com.twilio.rest.api.v2010.account.MessageCreator.create
          at: com.twilio.rest.api.v2010.account.MessageCreator.create
          at: com.twilio.rest.api.v2010.account.MessageCreator.addPostParams
    com.twilio.app.App.sendSms
          at: com.twilio.base.Creator.create
          at: com.twilio.rest.api.v2010.account.MessageCreator.create
          at: com.twilio.rest.api.v2010.account.MessageCreator.create
          at: com.twilio.http.TwilioRestClient.request
          at: com.twilio.http.HttpClient.reliableRequest
          at: com.twilio.http.HttpClient.reliableRequest
          at: com.twilio.http.NetworkHttpClient.makeRequest
          at: com.twilio.http.Request.getAuthString
    com.twilio.app.App.sendSms
          at: com.twilio.base.Creator.create
          at: com.twilio.rest.api.v2010.account.MessageCreator.create
          at: com.twilio.rest.api.v2010.account.MessageCreator.create
          at: com.twilio.http.TwilioRestClient.request
          at: com.twilio.http.HttpClient.reliableRequest
          at: com.twilio.http.HttpClient.reliableRequest
          at: com.twilio.http.NetworkHttpClient.makeRequest
    Changed Dependency Function(s)
    • f!f!
      • Update ConstructorCall in Throw (L128) to Throw (L128)
    • f!f!
      • Update Invocation in LocalVariable (L101) to LocalVariable (L97)
    • f!f!
      • Update FieldRead in If (L570) to If (L537)
      • Update Literal in Invocation (L571) to Invocation (L539)
      • Delete If in Method (L558)
      • Delete If in Method (L566)
      • Delete If in Method (L574)
      • Delete Invocation in If (L571)
      • Insert ForEach in If (L538)
      • Move Literal in Invocation (L571) to Invocation (L539)
      • Move VariableRead in Invocation (L571) to Invocation (L539)
      • Move If in Method (L570) to Method (L537)
    • f!f!f!

Did you find this information useful? Give this issue a 👍 if it is useful, 👎 if it is not, and ✋ if neutral.

Want to help us or have suggestions?

We are a group of university researchers trying to make automated dependency services more useful and user-friendly for OSS projects. If you have feedback and questions about this, feel free to submit it here.

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.

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

  • Twilio LICENSE 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

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

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.