Building Mobile Apps with Tropo API in Appery.io

Posted: June 4th, 2014 | Author: | Filed under: API, Tutorials | Tags: , | Comments Off

Tropo provides a powerful cloud API that can be used to add real-time communication features to your app. Using  popular web technologies such as PHP, JavaScript, Ruby and many others, it makes it easier to create and control network features.

tropo_log

Tropo also provides a great REST API that lets you configure and control Tropo applications through the use of RESTful methods. This includes the ability to create new Tropo apps, add phone numbers to them, delete applications, and much more. And as Appery.io provides a very comfortable way to work with REST API’s, it’s unbelievably easy to add Tropo communication features to your Appery.io app.

But before you begin, the Tropo application should be created by using the Scripting or Web API. Lets start with creating a simple Tropo app!

Sign up on the Tropo website, and create a new app:

tropo_new_app

Type a Tropo application name, and choose Scripting API:

tropo_basic_info

Now you should create script. Click “New script” to create it:

tropo_new_script

The text editor will appear. Lets add some simple code:

Code explanation:

Function say will pronounce “Hello from Appery.io!” text by using the Tropo’s Text-To-Speech engine. After that, the phone number that was passed as a REST parameter will be dialed. Once the call is accepted, a second phrase will be pronounced. Note that the second phrase contains REST parameters too.

Enter the script name, and click “Save.” Don’t forget to specify the script file extension as “.js”:

tropo_new_script

Click “CREATE APP,” and you’re done with the Tropo side. You can test your Tropo app directly from the browser by using Phono. Click “Call App from browser” and then click the phone icon in the bottom left corner:

tropo_call_from_app

Note that you can’t test the call function directly from the browser.

Now you can launch your Tropo app via REST services from Appery.io.

Copy the voice API key to your clipboard:

tropo_api_key

In your Appery.io app, create the following UI:

tropo_ui

If you not familiar with Appery.io yet, we recommend looking at this very simple beginners tutorial.

All the application magic will be kept in a single REST service that will start the Tropo session. Create the REST service and specify the following settings:

tropo_rest_settings

As you can see, there is the Appery.io Proxy provided for this REST service. Click “New channel,” enter a new proxy name for this REST, and then click “Create” to create a new proxy channel directly from the Appery.io builder.

Note: Read about the Appery.io proxy via the link.

In the Request tab, you can specify parameters and their values that can be passed to the Tropo app. In our case, the Request parameters are the following:

tropo_request_parameters

Go to the Test tab and click “Test.” If everything was done correctly, you’ll see a “Test successful” message, and a REST service response that contains both token and id:

tropo_test

Note that you should obtain phone number to make calls, otherwise the script will fail. You also need to link the UI and REST service parameters.

Switch to Data tab, and create a new datasource based on this REST service. Click “Edit Mapping”:

tropo_rest_datasource

Create the following mapping for REST service Request:

tropo_rest_mapping

This will map data from the UI components to the REST parameters. If it’s difficult to understand, read about REST services and mapping.

Unlike the Request parameters, we will print the REST service response without mapping to print all its data. Open the Events tab, and create the following event:

start_tropo_session > Success > Run JavaScript. Add the following JavaScript code:

Note that session_response in this case is the name of your Text Area component.

The last thing to do is to launch our REST service by clicking the button. Switch back to Design view, select the “Start session” button and add the following event:

start_session > Click > Invoke service > start_tropo_session.

Now you can test your app by clicking the “Test” button in the top right corner of the screen.

Click “Start session” and you’ll see the result:

tropo_test_app

If something above was not clear enough for you, check out the Appery.io tutorials and documentation.

Go ahead and create apps using Tropo documentation and the power of Appery.io!


Using Facebook API in Appery.io App

Posted: April 28th, 2014 | Author: | Filed under: API, Tutorials | Tags: , | Comments Off

When building a mobile app in Appery.io, it’s very easy to use and connect to any APIs. Facebook provides one of the most popular and widely used APIs that you can as easily use in the app you build in Appery.io.

facebook-logo

Appery.io provides a really simple out-of-box approach to pass the OAuth protocol and connect with Facebook. Before building the Appery.io app you need to register as developer with Facebook and create an app. Once it’s done, go to Appery.io builder and import the Facebook API plug-in:

fb_import_plug_in

Once the plug-in is imported you need to specify Appery.io app ID and Facebook app ID in the Facebook_Setting file that listed under the Services folder:

fb_settings

One more thing to do is change the Start Page in App settings to Facebook_Login. After that you can test the app. You’ll see the Login to Facebook button, clicking on which will dial the OAuth log-in dialog, where you should enter your Facebook login and password. After successful authentication, information about you will be displayed at the Facebook_Me page:

fb_me_page

All of the Graph API features can be used the same way, but note, that some actions requires certain scope. You can change default scope parameter in the Facebook_Helper JavaScript file:
fb_tutorial_helper

That’s it, you can now invoke any available Facebook API.  Go ahead and see how to post a wall message in our detailed Facebook tutorial.


New Appery.io and PhoneGap Video

Posted: March 4th, 2013 | Author: | Filed under: Tutorials, Video | Tags: , , | Comments Off

The last piece is in for the Appery.io self-training course of videos. We’ve now added:

Lesson 5: Appery.io & PhoneGap Capabilities

In the video, we show how to take advantage of the PhoneGap API with ready-to-use “device services” and data mapping in the Appery.io app builder. For this lesson, we build a simple contacts app and go through the steps of testing it in an Android emulator.

Here is the complete set of lessons from the video page on our help site:

  • Lesson 1: The UI Builder
  • Lesson 2: Data Mapping to a Service
  • Lesson 3: Using the Appery.io Database Service
  • Lesson 4: Web Service Caching
  • Lesson 5: Appery.io & PhoneGap Capabilities
  • Lesson 6: A Windows 8 App with the Twitter API

Each lesson links to a YouTube video. For each lesson there is also a link to a Appery.io backup ZIP of the finished lesson app, which you can open as a new project within Appery.io.

We’ll be updating the series soon, so chime in with any suggestions


Appery.io Self-training Video Course

Posted: February 5th, 2013 | Author: | Filed under: Tutorials, Video | 12 Comments »

We’ve started a Appery.io self-training course of videos. These lessons are linkable now from our video page on our help site:

  • Lesson 1: The UI Builder
  • Lesson 2: Data Mapping to a Service
  • Lesson 3: Using the Appery.io Database Service
  • Lesson 4: Web Service Caching

Each lesson links to a YouTube video. For each lesson there is also a link to a Appery.io backup ZIP of the finished lesson app, which you can open as a new project within Appery.io.

What’s next?

  • Lesson 5: Advanced PhoneGap API with Appery.io

Stay tuned!

 


New Tutorials on Building Mobile Apps with Appery.io Backend Services

Posted: December 28th, 2012 | Author: | Filed under: Tutorials | Tags: | 6 Comments »

Try our new tutorials:


Appery.io Updates its New HTML5 App Builder with Windows 8 Support, plus jQuery Mobile 1.2, PhoneGap 2.2, and Push Notifications

Posted: December 19th, 2012 | Author: | Filed under: API, Database, jQuery Mobile, New release, PhoneGap, Tutorials, Windows Phone | Tags: , , , , , | 1 Comment »

Windows 8 Support

Windows 8

Appery.io new HTML5 app builder has been the default builder for the past couple of weeks and we continue to update it with new features. One such feature is new Windows 8 support. In addition to jQuery Mobile/PhoneGap apps, you can now build Windows 8 apps with native support such as Snap View, Search Charm, Share Charm, and Live Tile.

To create a new Windows 8 app, click the “More create options” link from the Apps page and then select Windows 8 App as the app type. Try our Windows 8 app tutorial.

jQuery Mobile 1.2

We also upgraded to a much better jQuery Mobile version 1.2.

Selection_773

PhoneGap 2.2

We also upgraded PhoneGap to version 2.2. This means Appery.io cloud build has also been upgraded to PhoneGap 1.2:

Selection_393

If you use Appery.io Mobile App Tester for Android – go and grab an update so it also uses the latest PhoneGap version.

Push Notifications

A long requested feature – Push Notifications feature has been added to Appery.io Backend Services.

Selection_772

Want to try it? Try our new Push tutorial.

New Tutorial: Building a ToDo App with Appery.io Backend Services

Build this app and learn how the app builder is fully integrated with backend services.

 

 


Building a Windows 8 App in Appery.io

Posted: October 29th, 2012 | Author: | Filed under: Tutorials, Windows 8 | Tags: , | 4 Comments »

This tutorial is going to show you how to build a Windows 8 app in Appery.io new app builder. Before proceeding, here are a few things to keep in mind:

  • The new builder is now in beta.
  • You should use Firefox to build and test the app in the browser. IE10 support is coming

In this tutorial, we are going to build a Windows 8 app to search Twitter. We will use the Twitter search REST API to find all tweets using a term entered in the app.

Creating a new Windows 8 project

To start, let’s create a new Windows 8 project.

  1. Sign into Appery.io.
  2. Click on APPS in the upper-right-hand corner of the screen.
  3. Click on the More create options link to the right of the Create button.
  4. In the new screen, enter an app name. Let’s use “TwitterWindows8″.
  5. Select the Windows 8 App radio button.
    Selection_304
  6. Click Create to open the new project in the new builder. (It should display a welcome screen as shown below.)
    img31

Creating the UI

We will create the UI by dragging and dropping components from a left sidebar palette and setting component properties from a right-hand sidebar.

  1. Using the left sidebar, expand Pages and select home. In the middle of the screen, you will see this:
  2. Click the black screen.
  3. In the right (Properties) sidebar under Custom, find the Rows field and make the entry “120px;auto;1fr”. A new row will appear.
  4. From the Design (components) palette to the left, select an input component under Controls and drop it inside the cell at the first row/second column:

    The result will then look like this:
  5. Select the new input and then click the icon (as shown) to select the parent container:
  6. Under Custom properties, set Column align to “start”.
  7. Now select a button component from under Controls and drop it inside the cell at the second row/second column.
  8. Select the new button’s parent container by clicking the icon as you did for the new input and set Column align to “start”.
  9. Select the button and change its label by entering “Search” into the Text field  under Common properties.
  10. You can also now test the app by clicking the Test button in the upper-right corner of the browser screen.

    Note: We recommend Firefox for previewing the app. We are still working on IE 10 support.
  11. Now, let’s continue building the UI by adding a listview component. Select a listview component from the Containers components and then drop it inside the cell at the third row/second column.
  12. Select the component and, under Common properties, change the Height to “160px”.
  13. Next, select a grid component from the Layouts components and drop it inside the listview.
  14. With the grid selected, set the Rows field under Custom properties to “auto;auto;auto”.
  15. Then, set its size by entering these values into these fields under Commonproperties:
    1. Width: “600px”
    2. Height: “160px”
  16. Select an image component from the Controls components and drop it into the first row/first column of the grid you just created.
  17. Select the image component’s parent (via the small icons) and set its Column align to “start”.
  18. Select a label component from the Controls components and drop it into the second row/first column of the grid.
  19. Select the label’s parent (via the small icons) and set its Column align to “start”.
  20. Reselect the label and set the Text field under Common properties to be blank.
  21. Select another label component from the Controls components and drop it into the third row/first column of the grid.
  22. Select this label’s parent (via the small icons) and set its Column align to “start”.
  23. Then, reselect the label and set the Text field under Common properties to be blank.

(Saving is not required till the end, but, if you want, you can save at the end of each section by clicking on the Save button in the top menu bar of the editor.)

Creating a service

We’ll now create a Appery.io “service” component (service interface) that can be used in building our app. We’ll use a Twitter Search REST service for our service component. We just need to define some things about the service and specify the request and response parameter we’ll be using for input and output.

  1. In the upper-left part of the screen, click on Create New and then click on “Service” from the drop-down menu.
  2. Enter “TwitterSearch” as the name and click the Create Service button.
  3. If you look on the left-hand side, you’ll see the new service listed under Services. Click on this TwitterSearch label to open the service editor on the service.
  4. Now, under the REST Service Properties section, enter “http://search.twitter.com/search.json” as the URL and select “jsonp” as the Data Type.
    Selection_319
  5. Open the Request Parameters section underneath this section by clicking on Request Parameters.
  6. Enter “q” into the text input box and click Add.
  7. Open the Response Parameters section underneath this section by clicking on Response Parameters.
  8. Enter “results” into the text input box and click Add.
  9. Click the green + button in the same row as the results response parameter to make a sub-element of results.
  10. Enter “profile_image_url” into the new text input box and click Add. The result will look like this:
  11. Click the green + button in the same row as the results response parameter again to make another sub-element of results.
  12. Enter “from_user” into the new text input box and click Add.
  13. Then, click the green + button in the same row as the results response parameter one last time to make another sub-element of results.
  14. Enter “text” into the new text input box and click Add.

The result will look like this:

Mapping the service to the UI

Now, we have REST service parameters on one side and UI components on the other side. Next, we’ll connect them together in the Data section of the editor as a data mapping called “restservice” that uses the service component called “TwitterSearch”.

  1. Select the home tab above the service editor.
  2. Click on the Data side-tab.
  3. From the Type drop-down menu, select “Service”.
  4. From the Component drop-down menu, select “REST Service”.
  5. Click the green button to the right.
  6. In the row that will have appeared under Components List, click the blue Edit Mapping… button
  7. A Component Properties sidebar will appear to the right. From the Service drop-down menu, select “TwitterSearch”.
  8. Now click the Edit Mapping… button again. A new screen, the mapping editor, will scroll in from the right with the Request Mapping tab selected.
  9. On the right-hand side under Components, expand home and then expand the first sub-item under it.
  10. Click on the q parameter on the left-hand side, drag the cursor to the label Text under the expanded sub-item, and drop.
    The input component is now mapped to the REST service input.
  11. Now click on the Response Mapping.
  12. Expand results on the the left-hand side, collapse the input component on the right-hand side, and expand the listview component and it’s subitems until everything is exposed.
  13. Then, using the same drag-and-drop approach as above, define the following mappings:

The results parameter is the collection of all tweets found through the query. We are mapping it to the parent listview container to get automatic looping. The rest of the mappings are straightforward.

Invoking the service

We are almost done. We have a UI, a service component for using a REST service from the app, and a data mapping connecting the UI and the service together. All we need is a triggering event for the data mapping to invoke the service. For this we’ll use a panel hidden away at the bottom of the screen.
  1. Select the Design side-tab.
  2. Find the Show Events Panel tab all the way in the bottom-right corner of your screen.
  3. Click this tab to open the events panel.
  4. From the Component drop-down menu, select the button component.
  5. From the Event drop-down menu, select “Click”.
  6. From the Action drop-down menu, select “Invoke Service”.
  7. From the Service drop-down menu select “restservice” (the service data mapping you created).
  8. Click the green button to add this event.

You have now set up the app to invoke a service through clicking the Search button in the app.

Testing the app

Now we can test the app. Just click the Test button in the upper-right corner of the screen and enter any term to search for. You should get a result that looks something like this:


Building a Mobile Search App with Appery.io Database, Part 2

Posted: October 22nd, 2012 | Author: | Filed under: Mobile Backend, Tutorials | Tags: , | 1 Comment »

Last week we put posted Building a Mobile Search App with Appery.io Database tutorial that shows you how to search a database for a particular search term. The way the search worked, is that the entire word has to be matched. For example, you could enter ‘Apple’ but not ‘Ap’ to search. In this post we are going to show you how to use a regular expression to get all objects that start with a particular letter. As for our data, are going to use US States.

Building the UI

To start, the UI that we need looks like this:

  • For input we use a search component
  • Below the input we have a grid, with one column and a label inside.

That’s all we need for the UI. Let’s now create the database.

Creating a database

  1. Create a new database by going to http://appery.io.
  2. Go to Collections tab and click Import button.
  3. Upload States CSV file to the database. Once the collection is created, it should look like this:

That’s it for the database. Let’s now add a REST service to search this collection.

Adding a REST service

  1. In Appery.io app builder, select Project > Create New > Database Services
  2. Select your database
  3. Expand States collection and check Query service.
  4. Click import Selected services button. A query search for States collection will be created.
  5. Let’s test the service. As we want to make the search a little bit more flexible, we are going to use a regular expression. For where param, enter the following:

    The above will return all states that start with letter C or c. “$options”:”i” is what specifies the query to ignore the case.

We are done with the service. Let’s move on to mapping.

Mapping the service to the page

The input mapping looks like this:

This is JavaScript mapping:

This is output mapping:

Invoking the service

The last thing we need to do is to invoke the service. Select the input search field, then Events > Add Event > Search. Add Action > Invoke Service, select the service instance.

Testing the app

To test the app, enter any letter, for example ‘n’ and click the magnifying glass inside the search input:


Building a Mobile Search App with Appery.io Database

Posted: October 15th, 2012 | Author: | Filed under: Mobile Backend, Tutorials | Tags: , | 2 Comments »

This tutorial will show you how to build an app that searches data stored in Appery.io database.

Let’s start with building the mobile UI.

Building mobile UI

Using Appery.io app builder, create a page named Phones and build the following UI:

  • Maker name is  a placeholder
  • Below the button ,there is a grid with two columns and a label inside each column.

Creating a database

  1. Create a new database by going to http://appery.io.
  2. Go to Collections tab and click Import button.
  3. Upload Phones CSV file to the database. Once the collection is created, it should look like this:

Creating REST services to access the database

  1. In Appery.io app builder, select Project > Create New > Database Services
  2. Select your database
  3. Expand Phones collection and check Query service.
  4. Click import Selected services button. Two services will be generated under Services folder. One is a settings service that holds the database id and the other one is the query service.

Open the service and then open Request Parameter panel. It should look like this:

Click Test. As we didn’t specify anything for where parameter, you should get all the phones in the collection.

Let’s now test the where parameter. Enter the value of {“Maker”:”Samsung”}, then click Test. You should now get only records where the maker is Apple.

Note that we don’t need to create the response parameters as the response was automatically created when we imported the services.

Adding the service to the page

  1. Select the query service and drag and drop it over the phone frame. A box will appear on the left-hand side indicating a service instance was added to this page.
  2. Rename the service instance to: query_phones

Mapping the service to the page

  1. Open Data Mapping tab
  2. Map the input component to where parameter:
  3. Click Add and enter the following code:

    this means any value entered from the page will be used to search the database.
  4. Click on Response Mapping and create the following mappings:
  5. Go back to Design view.
  6. The last thing we need to do is to invoke the service. Select the button, then Events > Add Event > Click. Add Action > Invoke Service, select the service instance.

Testing the app

Run the app in the browser and enter either Samsung or Apple as value. For example entering Samsung will produce the following:

Displaying a message when no records are found

  1. Add a new label component just above the grid
  2. Rename the component to no_records and uncheck Visible.
  3. Select the button, go to Events. Add a Run Custom JavaScript action with the following code:

    That’s to hide the label on every new search.
  4. Now select the service instance on the page, then Events > Add Event > Complete. Add Run Custom JavaScript action with this code:

    If nothing is returned, show the message.
  5. Test the app, if you enter anything other than Apple or Samsung, you should get the following:

 

 


Video: Building jQuery Mobile App Connected to Twitter Search API

Posted: September 13th, 2012 | Author: | Filed under: API, Tutorials, Video | Tags: , , | Comments Off