Upload
supal-chowdhury
View
694
Download
9
Tags:
Embed Size (px)
DESCRIPTION
Accelerating your application development with IBM BlueMix (Your dream development unit in Cloud) using Twilio service and IBM Worklight.
Citation preview
Accelerating your application development with
IBM BlueMix (Your dream development unit in Cloud)
using Twilio service and IBM Worklight By: Supal K Chowdhury
I got an idea!I need a development environment to implement my product!
2
-A Platform-Tools-Assets-Environment
3How do I implement my idea without owning:
IBM BlueMix is there to help you.4
IBM BlueMix is your Development unit in Cloud. Built on an open source project called
Cloud Foundry.
A platform for running virtually any applications in the cloud without having to worry about the hardware, software, and networking.
Referred as a platform-as-a-service or PaaS
Encompasses set of concepts ( Buildpacks, Service, CLI, etc)
BlueMixBuild
Idea
More about IBM BlueMix BluMix runs on PaaS A PaaS is software that is
running on top of an IaaS IaaS runs on Softlayer Your app runs on top of
BlueMix and you don’t need to have knowledge of the IaaS layer.
5
IaaS (Softlayer)
PaaS (BlueMix)
Your Idea/App
Now, what is your Idea?6
My idea is very simple. I want to implement a web app for mobile
devices that can send a text message to my friends.
Web app will ask for the user’s mobile number and the text message that I want to text.
Upon hitting the ‘Send SMS’ button, web app will display ‘SMS sent successfully’.
Message will be delivered within fraction of seconds.
7
Twilio Service build apps that communicate, integrate voice, messaging
(SMS,MMS) and VoIP into your web and mobile apps. ‘Liberty of Java’ Buildpack
one of the pseudo-standards defined in my boilerplates that provides you virtual runtime to use for applications to run.
OK, here you go!!Here are the prerequisites that BlueMix can provide you to help implementing your idea
8
Worklight to build your idea A development environment aka mobile-dev-studio to be
used to build mobile Worklight solutions (native, hybrid or web) to make use of my cloud services by incorporating a mobile cloud services software development kit, or SDK (iOS and Android).
VCAP_Services An environment variable, contains runtime information
once Twilio service is bound to your application information to use the service.
More…
Now you are ready for implementation!The simplest and fastest steps ever for you to implement your idea
9
1. BlueMix is currently in open beta, you need to register to get starting
During the beta you get 8GB of memory to use across as many apps as you want and can provision up to 20 services.
Register at https://ace.ng.bluemix.net/ ,you need an IBM ID.
10
2. Open Twilio account (Account SID ,Auth token and a trial Twilio phone number) from the following link:
https://www.twilio.com/login?g=%2Fuser%2Faccount&t=33749c41db7fc705abf1d1241d41739087391d1689f7c9e44323bf475126d73c
3. Now you have for example : Account
ID :ACbef68e6b88d0a0cfe82712c3f20fc875 Auth Token : *************************************** Twilio Phone number : +1438****018
Implementation Continue..
11
3. Login to BlueMix with your IBM ID. You will be presented with the dashboard below,
4. Create an Application namely ‘twilio-test-worklight-app’ using ‘Liberty of Java’ from ‘Catalog->Runtime’
Implementation Continue..
12
4. Create Twilio service using Twilio credential (Account Id and Auth Token) that you have already created.
Implementation Continue..
13
5. Service Twilio-test-worklight-sms-srv created
Implementation Continue..
146. Go and select your new application followed by
Runtime and select VCAP_Services Environment.
Implementation Continue..
You are ready with your Twilio REST URL for sending message.REST URL : https://api.twilio.com/2010-04-01/Accounts/{account SID}/Messages?From='{a twilio number you own}'&To='{your cell number}'&Body='{your SMS text}'
15
7. Single step to create ‘Send SMS’ web app for mobile device using Worklight Studio :
Implementation Continue..Now time to do a quick coding on Worklight Studio
• Open new Project• Create simple web
application namely ‘WorklightSendSmsTwilio’
for Mobile device.• Create HTML code for web
page.• OnClick button will call
‘sendText’ to send message.
See project snapshot
168. 3 steps to create ‘SendSMS’ Http Adapter using Twilio
REST URL:
Implementation Continue..https://api.twilio.com/2010-04-01/Accounts/{account SID}/Messages?From='{a twilio number you own}'&To='{your cell number}'&Body='{your SMS text}'
Step -1: Create Http Adapter with Twilio domain and server auth Step -2: Develop Procedure to send SMS
17One more…Implementation Continue…Step -3: Invoke Adapter in main.js
Done!! Worklight Studio has created .war file inside your workspace ‘bin’ folder.
Lets Deploy Worklight App!
18
1. WAR file (WorklightSendSMSTwilio.war) is ready to be deployed for your Worklight application.
2. Push WAR file to BlueMix using CF Command. This action registers the application and configuration with BlueMix and enables Twilio services to be bound to it .
$cf push twilio-test-worklight-app -p WorklightSendSMSTwilio.war
Note :
View guide (download, install, usage of cf command line tool) by clicking ‘view quick start’ after selecting ‘twilio-test-worklight-app’ application.
Note : Additionally you need to deploy Worklight Server Package in Liberty Service.
Deployment continue..19
3. Bind the service to the non-started application by entering following command:
$cf bind-service twilio-test-worklight-app Twilio-test-worklight-sms-srv 4. Start the application to refresh the environment variables by entering the
following command: $cf start twilio-test-worklight-app
5. Go to ‘Files and Logs’ of your application you pushed and see environment meta data in liberty runtime environment.
Done!! All you need to do is to run your dream idea!
Hurray!! you done with your development.Lets Test !
20
1. Run Worklight Application by accessing at http://twilio-test-worklight-app.stage1.mybluemix.net:10080/WorklightSendSMSTwilio/consoleNote :If you are using Worklight 6.x then port will be 10080. For having a running server there are additional WARs and JAR files are required. Some additional artifacts (admin DB and run time DB) are also required.
2. You can even run by going to the application in the BlueMix user interface i.e. Dashboard, and click on the link that is shown next to the name of the application.
Your idea in action… 21
Landing page to send SMS.
Sent success message acknowledgement!
..and message in cell (416-***-7819)
22
…So, you achieved your idea implemented after applying simplest and fastest steps ever using IBM BlueMix in Cloud.
Benefits of IBM BlueMix at a glance…1. It saves your time by just worrying about your
idea and the development2. It is always ready to serve your idea
implemented to users – deploying and running a single command
3. It can easily add services to your idea implementation using IBM and vendor provided services
4. It leverages use of any languages, runtimes, and frameworks that you are most familiar with.
23
Resources Documentation:
https://www.ng.bluemix.net/docs/index.jsp developerWorks:
Home : http://developer.ibm.com/bluemix Sample Apps & Tutorials: https://www.ibmdw.net/bluemix/docs/articles/,
https://www.ibmdw.net/bluemix/docs/sample-code/ Developer Forum: https://www.ibmdw.net/answers/?community=bluemix Article : http://www.ibm.com/developerworks/library/mo-android-twilio-
app/index.html Blog: https://www.ibmdw.net/bluemix/blog/ General Availability :
https://developer.ibm.com/bluemix/2014/06/30/general-availability/
24