Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free
  • By Matthew Gilliard
    Handling Incoming Phone Calls with Java and Twilio Title: Handling incoming phone calls with Java and Twilio

    Making outbound phone calls with Java and Twilio is only half of the picture. To build a useful and engaging phone app you will need to handle what happens when people call you back.

    To do that, you will need to configure a URL in your Twilio console. Incoming calls will trigger HTTP requests to that URL, and the response to those webhook requests will determine what happens next in the call. The HTTP responses contain an XML dialect called TwiML, which gives you a lot of flexibility in how the call is handled.

    In this post I'll show how to set up a web server using Spring Boot to handle incoming calls with a spoken "hello world" and then show how to create a more interesting and interactive setup.

    If you want to skip to the end, check out the completed project on GitHub.

    Setting up

    Before …

    Read More
  • By Matthew Gilliard
    Making Voice Calls with Java and Twilio Title: Making Voice Calls with Java and Twilio

    The capability to make outbound calls from code has a long history at Twilio. It will only take you a few minutes to set up a Java project to do just that and see the magic for yourself. To follow along with this post you'll need:

    The easiest way to call the Twilio API is with the Java Helper Library. In this tutorial I'll give examples using the Apache Maven build …

    Read More
  • By Matthew Gilliard
    How to send SMS at scale with Twilio Title: How to send SMS at scale with Twilio

    If you want to send a single SMS using Twilio you'll need a Twilio account, a phone number to send them from, and of course you'll need to know the destination phone number and the content of the message. Once you have these you can send your message with a single API call either with a direct HTTP request, or using any of our helper libraries. Check out our Programmable SMS Quickstarts for more details.

    What if you need to send a hundred messages? Or a thousand? Or even more? In this post I'll talk through the challenges you may face as you scale up and how to get past them. Code samples will be in Java but the same principles apply with any programming language.

    Sending a single SMS

    Sending one SMS with Java is covered in this blog post. Feel free to go and read it, …

    Read More
  • By Matthew Gilliard
    5 Maneiras de Fazer uma Chamada HTTP em Java 5 Maneiras de Fazer uma Chamada HTTP em Java

    Fazer chamadas HTTP é uma funcionalidade fundamental da programação moderna, e geralmente é uma das primeiras coisas que você vai querer fazer ao aprender uma linguagem de programação nova. Para programadores Java, existem diversas maneiras de se fazer isso - bibliotecas core na JDK e bibliotecas de terceiros. Este artigo vai te introduzir aos clientes HTTP Java que eu geralmente uso. Se você usa outros, ótimo! Me conte mais sobre eles. Veja o que vou cobrir neste artigo:

    Core Java:

    • HttpURLConnection
    • HttpClient

    Bibliotecas Populares:

    • ApacheHttpClient
    • OkHttp
    • Retrofit

    Eu vou usar a API de Imagem Astronômica do Dia das APIs da NASA para os código de exemplo, e o código está todo no GitHub em um projeto baseado em Java 11.

    APIs Core do Java para se fazer chamadas http no Java

    Desde o Java 1.1 já havia um cliente HTTP nas bibliotecas core com o JDK. Com o Java 11, …

    Read More
  • By Matthew Gilliard
    Sending SMS with Java with Twilio Title: Sending SMS with Java and Twilio

    Did you know you can code a Java app in under 5 minutes to send an SMS using the Twilio API? Probably closer to 2, once you've got the tools installed. You'll need:

    The easiest way to call the Twilio API is with the Twilio Java Helper Library. In this I'll give examples using the Apache Maven build tool which will download and manage the dependency and packaging the project. You can get up to speed with Maven in 5 Minutes, …

    Read More
  • By Matthew Gilliard
    Receiving and Responding to SMS with Java and Twilio Title: Receiving and Responding to SMS with Java and Twilio

    If you're wondering how to send SMS from Java code, we've got you covered already. However, people are increasingly expecting to be able to converse with companies and services rather than just get a never-ending stream of notifications. To build really engaging and interactive apps you're going to want to respond to incoming messages too.

    To do that, you will need to configure a URL in your Twilio console. Incoming messages will trigger HTTP requests to that URL, and the response to those webhook requests will determine what happens next, including sending responses. Responses should be written in an XML dialect called Twilio Markup Language, or TwiML.

    In this post I'll walk you through setting up a web server using Spring Boot to do just that.

    Getting set up

    Before we get started, you'll need:

    Read More
  • By Matthew Gilliard
    Comment Lire et Comprendre la Stacktrace en Java ? lire-comprendre-stacktrace-java

    Lorsque quelque chose ne tourne pas rond dans une application Java en cours d'exécution, le premier indice est souvent l'impression de lignes à l'écran qui ressemblent à peu près à ce qui suit :

    Exception in thread "main" java.lang.RuntimeException: Something has gone wrong, aborting!
        at com.myproject.module.MyProject.badMethod(MyProject.java:22)
        at com.myproject.module.MyProject.oneMoreMethod(MyProject.java:18)
        at com.myproject.module.MyProject.anotherMethod(MyProject.java:14)
        at com.myproject.module.MyProject.someMethod(MyProject.java:10)
        at com.myproject.module.MyProject.main(MyProject.java:6)
    

    Ceci est une Stacktrace, et dans ce blog post, je vais vous expliquer de quoi il s'agit, comment ils sont générés et comment les lire et les comprendre. Si ça à déjà l’air pénible, lisez la suite...

    Anatomie d'une Stacktrace

    Habituellement, une Stacktrace s'affiche lorsqu'une Exception n'est pas gérée correctement dans le code. Il peut s'agir d'un des types d'exception intégrés de base dans Java, ou d'une exception customisée créée par un programme ou une librairie.

    La Stacktrace contient le type d'exception et un message, ainsi qu'une liste de tous les …

    Read More
  • By Matthew Gilliard
    Handling Webhooks with Java, Spring Cloud Function and Azure Functions Title: Handling Webhooks with Java, Spring Cloud Function and Azure Functions

    When you want to send an SMS or a WhatsApp message using Twilio's API, the programming model is straightforward: You call the API and the message gets sent. Responding to incoming messages is a different question. When the message arrives Twilio needs to find out how to handle it, and the mechanism we use is the Webhook. You configure your Twilio number with a URL and the platform makes a request to it passing some details about the incoming message - your app's response decides what happens next.

    This means your app needs a public URL, which in turn means that you need some hosting. In the last few years serverless platforms have become popular for this, because they alleviate many of the pains of hosting. You provide code, which can handle an individual request, and the platform takes care of routing, scaling and most other concerns. Java's no …

    Read More
  • By Matthew Gilliard
    Building Voicemail with Twilio and Java Building Voicemail with Twilio and Java

    One useful and common way to use Twilio is to create a phone number which forwards to your real phone. You can hand out the Twilio number to colleagues or customers and take business calls on your personal phone without worrying about handing out your real phone number. This also gives you a lot of options for how to handle these calls - you have the full power of Twilio at your disposal.

    In this post I'll show you how to create a voicemail system that will jump in when your cell number is busy, or when you don't answer the call. It will play a message to your caller, then record their message and text you a link to the recording when it's done.

    Primer: How Twilio Handles Calls

    When someone dials your Twilio number, an HTTP request is sent to a URL that you provide. The web server …

    Read More
  • By Matthew Gilliard
    Building Single-Page Apps with React and Twilio Functions Title: Building Single-Page Apps with React and Twilio Functions

    You can do all kinds of weird and wonderful things with Twilio's APIs, and if you could call those APIs from your browser you'd be able to build some awesome apps that you could use from a browser anywhere. This isn't directly possible, because the Twilio API doesn't send any CORS headers (for good reason).

    A better way to use Twilio API from the browser is to implement a custom web app which accesses Twilio API. In this post I'll show how you can build such a custom web app on the Twilio Runtime platform, using Functions and Assets.

    If you follow along with the code, you'll build a single-page app with a backend that is hosted on Twilio. This will let you call the Lookup API from anywhere in the world. I've chosen the Lookup API because it's relatively simple, but using the same principles you …

    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.