IBM® Worklight® Sample App Cheat Sheet
Last week at IBM Impact we demonstrated our AT&T adapters for IBM® Worklight® for the AT&T API Platform and how you can easily extend your app’s functionality. We built a simple enterprise contact management app that used the Speech API and messaging APIs to search for and distribute contacts via SMS and MMS messaging options.
Below is a simple cheat sheet to show our work. You can also download all of the sample app documentation for offline access.
Next, find and download the Worklight adapters or run the following from git on your workstation:
To use AT&T API, you will need two keys –App Key and Secret. To obtain these, perform the following steps:
· Click Join Now in top-right corner. Review the details of the dialog as shown in the
following screen and click Close.
· The Get a Free Trial and Join screen is then shown.
· Enter your details and click Join Program.
· You are done.
A test application is automatically created for you. It comes with the App Key and Secret Key. Use these two keys for OAuth authentication and get the credentials used to access AT&T API.
Note: Your trial access is valid up to 90 days and you can create up to three applications in the Sandbox environment during this trial period.
You can set up your own application in the Sandbox environment and select a combination of APIs that you want to use by performing the following steps:
- Click Create an Additional App, as shown in the following My Free Trial Access screen.
2. Enter Application Name and Description as shown in the following Request App Tokens for Sandbox screen.
3. Check the APIs you want to use in your application, as shown in the following screen. If you plan to use Speech API in your app, make sure you do select the ‘Speech’ checkbox.
You can mix and match all the APIs you want to use in one app.
4. Click Set up Application. A screen similar to the following should appear. Note that an App Key and a Secret Key are created for your application.
Your setup for the AT&T API Platform is now complete.
Using the Sample App Project
There are two Worklight projects you should have downloaded above:
This includes all AT&T adapters.
This includes the Demo app ‘ATT_WL_Contacts_2’ by AT&T DPS Team to illustrate how Speech and SMS adapters can be used in a simple jQuery app. For comparison, a version of the original jQuery app ‘ATT_WL_Contacts’ is also included.
There is also a ‘Contacts’ HTTP adapter to retrieve contact information in JSON format from a HTTP server.
Setting up the Sample App
- Import the above 2 pre-built projects (ATTWLAdapterProject, ATT_WL_Contacts) into your Eclipse workspace
- Build ATTWLAdapterProject
- Retrieve the API Key and Secret from the Free Trial Access screen when you signed up above.
- Configure the following properties in Worklight. Properties of ATT_WL_Contacts project:
- Right-click on ATT_WL_Contacts project and Start Worklight Server
- Deploy OAuth, SMS, Speech adapters from ATTWLAdapterProject onto Worklight Server of ATT_WL_Contacts project. To do this:
- Visit http://localhost:8080/console
- Click ‘Catalog’tab
- Click ‘Browse’
- Select OAuthAdapter.adapter from <your_workspace_dir>/ATTWLAdapterProject/bin
- Repeat the above for SMSAdapter.adapter and SpeechAdapter.adapter
- Build and Deploy ‘Contacts’ adapter
- Build and Deploy ATT_WL_Contacts_2 app
- Build and Run the Android environment of the app on your Android Emulator or Android Device
Where to go next?
You have seen how we built the sample app we unveiled at IBM Impact last week, but you might have also noticed we didn’t scratch the surface of what is possible with the Worklight adapters and the AT&T APIs. How would you go about adding the AT&T Advertising API to the sample app, or what other enterprise functions could you enable with the existing APIs?
Add what you would do in the comments below!