Similaire à Accelerating your application development with IBM BlueMix (Your dream development unit in Cloud) using Twilio service and IBM Worklight (20)
4. IBM BlueMix is there to help you.
3
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
5. 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.
4
IaaS (Softlayer)
PaaS (BlueMix)
Your Idea/App
6. Now, what is your Idea?
5
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. 6
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. 7
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…
9. Now you are ready for implementation!
The simplest and fastest steps ever for you to implement your idea
8
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. 9
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%2Faccoun
t&t=33749c41db7fc705abf1d1241d41739087391d1
689f7c9e44323bf475126d73c
3. Now you have for example :
Account ID :ACbef68e6b88d0a0cfe82712c3f20fc875
Auth Token : ***************************************
Twilio Phone number : +1438****018
Implementation Continue..
11. 10
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. 11
4. Create Twilio service using Twilio
credential (Account Id and Auth Token)
that you have already created.
Implementation Continue..
14. 13
6. 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. 14
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
16. 15
8. 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
18. Lets Deploy Worklight App!
17
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.
19. Deployment continue..
18
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!
20. Hurray!! you done with your
development.
Lets Test !
19
1. Run Worklight Application by accessing at
http://twilio-test-worklight-
app.stage1.mybluemix.net:10080/WorklightSendSMSTwilio/console
Note :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.
21. Your idea in action…
20
Landing page to send SMS.
Sent success message acknowledgement!
22. ..and message in cell (416-***-7819)
21
…So, you achieved your idea
implemented after applying simplest
and fastest steps ever using IBM
BlueMix in Cloud.
23. Benefits of IBM BlueMix at a glance…
1. It saves your time by just worrying about your idea and
the development
2. 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.
22