Working with mapping has been improved to provide you with a more efficient and user-friendly way of binding your data. Now, with the upgraded Mapping feature binding your data is more intuitive; it also provides more features and flexibility. This tutorial uses old mapping, and will be updated shortly. The new mapping uses the same concepts. The following page shows how to migrate the old mapping to the new mapping.
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:
Type a Tropo application name, and choose Scripting API:
Now you should create script. Click “New script” to create it:
The text editor will appear. Lets add some simple code:
say('Hello from Appery.io!');
say("Hello, "+customerName+"! There is a message for you: "+msg+"!");
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”:
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:
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:
In your Appery.io app, create the following 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:
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.
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.
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:
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:
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:
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.
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.
We also upgraded PhoneGap to version 2.2. This means Appery.io cloud build has also been upgraded to PhoneGap 1.2:
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.
Sign into Appery.io.
Click on APPS in the upper-right-hand corner of the screen.
Click on the More create options link to the right of the Create button.
In the new screen, enter an app name. Let’s use “TwitterWindows8″.
Select the Windows 8 App radio button.
Click Create to open the new project in the new builder. (It should display a welcome screen as shown below.)
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.
Using the left sidebar, expand Pages and select home. In the middle of the screen, you will see this:
Click the black screen.
In the right (Properties) sidebar under Custom, find the Rows field and make the entry “120px;auto;1fr”. A new row will appear.
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:
Select the new input and then click the icon (as shown) to select the parent container:
Under Custom properties, set Column align to “start”.
Now select a button component from under Controls and drop it inside the cell at the second row/second column.
Select the new button’s parent container by clicking the icon as you did for the new input and set Column align to “start”.
Select the button and change its label by entering “Search” into the Text field under Common properties.
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.
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.
Select the component and, under Common properties, change the Height to “160px”.
Next, select a grid component from the Layouts components and drop it inside the listview.
With the grid selected, set the Rows field under Custom properties to “auto;auto;auto”.
Then, set its size by entering these values into these fields under Commonproperties:
Select an image component from the Controls components and drop it into the first row/first column of the grid you just created.
Select the image component’s parent (via the small icons) and set its Column align to “start”.
Select a label component from the Controls components and drop it into the second row/first column of the grid.
Select the label’s parent (via the small icons) and set its Column align to “start”.
Reselect the label and set the Text field under Common properties to be blank.
Select another label component from the Controls components and drop it into the third row/first column of the grid.
Select this label’s parent (via the small icons) and set its Column align to “start”.
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.
In the upper-left part of the screen, click on Create New and then click on “Service” from the drop-down menu.
Enter “TwitterSearch” as the name and click the Create Service button.
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.
Now, under the REST Service Properties section, enter “http://search.twitter.com/search.json” as the URL and select “jsonp” as the Data Type.
Open the Request Parameters section underneath this section by clicking on Request Parameters.
Enter “q” into the text input box and click Add.
Open the Response Parameters section underneath this section by clicking on Response Parameters.
Enter “results” into the text input box and click Add.
Click the green + button in the same row as the results response parameter to make a sub-element of results.
Enter “profile_image_url” into the new text input box and click Add. The result will look like this:
Click the green + button in the same row as the results response parameter again to make another sub-element of results.
Enter “from_user” into the new text input box and click Add.
Then, click the green + button in the same row as the results response parameter one last time to make another sub-element of results.
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”.
Select the home tab above the service editor.
Click on the Data side-tab.
From the Type drop-down menu, select “Service”.
From the Component drop-down menu, select “REST Service”.
Click the green button to the right.
In the row that will have appeared under Components List, click the blue Edit Mapping… button
A Component Properties sidebar will appear to the right. From the Service drop-down menu, select “TwitterSearch”.
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.
On the right-hand side under Components, expand home and then expand the first sub-item under it.
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.
Now click on the Response Mapping.
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.
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.
Select the Design side-tab.
Find the Show Events Panel tab all the way in the bottom-right corner of your screen.
Click this tab to open the events panel.
From the Component drop-down menu, select the button component.
From the Event drop-down menu, select “Click”.
From the Action drop-down menu, select “Invoke Service”.
From the Service drop-down menu select “restservice” (the service data mapping you created).
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:
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
Create a new database by going to http://appery.io.
Go to Collections tab and click Import button.
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
In Appery.io app builder, select Project > Create New > Database Services
Select your database
Expand States collection and check Query service.
Click import Selected services button. A query search for States collection will be created.
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.