IBM® Bluemix™ is a platform(PaaS) that helps users to build and deploy their applications easily without any worry of infrastructure setup.It abstracts and hides most of the complexities that are associated with hosting and managing cloud-based applications.Both IBM and third party services are available on IBM® Bluemix™. Twilio is a mobile service that is available on Bluemix which allows software developers to programmatically make and receive phone calls and send and receive text messages using its web service APIs.
This tutorial will help you to build and deploy a java application that sends registration successful message using Twilio and IBM® Bluemix™
- IBM Bluemix Account – Take a 30 day free trial here http://ibm.biz/bluemixapp
- Eclipse IDE for Java EE developers
- Cloud Foundry command line interface
- Twilio API credentials and Twilio number
- Twilio Java Helper Library
Let’s start building java application,before that lets go to our Bluemix Dashboard and select required services to build it!
Step 1: Goto Catalog and then click on Java Runtime
Step 7: Click on Add a service again and then in CATALOG goto Data and Analytics and click on SQLDB
Step 8: Create the service by giving it a service name. Follow the steps to create a table in SQLDB as shown in my previous blog
Cool! The service is now up and running in Bluemix!! We can now proceed to Eclipse IDE to build the registration application that inserts details into database and also sends out registration successful message.
Input–>Team Name, First participant name,emailid,mobile number,Second participant name,emailid,mobile number and Hackathon idea
Copy and paste the twilio-java jar to the below shown location
Database integration ( JNDI lookup of database, can be dynamically integrated using VCAP_SERVICES)
Twilio API (hard coded the Twilio accountSID, Twilio authentication token.Can be taken dynamically)
Step1: Login to Bluemix account from the cf command line interface cf login -a https://api.ng.bluemix.net ( Depending on the region selected your api endpoint changes). Enter the credentials
Step2: Now push the WAR file to Bluemix using the command
cf push appname -p <path_of_war_file>
Common lets test it!!
Click on REGISTER after providing the required details
Awesome! The details have been inserted into database and I just received a message!! Yipeee!!
Thanks IBM® Bluemix™ and Twilio !! You made our life easier and simpler !!
Courtesy: (bluemix.net) IBM Bluemix and Twilio (twilio.com)