How to make Facebook status posts using Altair SmartWorks & Temboo

0. Introduction

If you are a Temboo user, you can send data from Altair SmartWorks to your Temboo account and do a variety of things.

Temboo is a library of processes which allow users to run programs using minimal code. The smart processes called "choreos" (short for choreographies) are easy to test. They can deal with API interactions like the one we will use in the example between Altair SmartWorks and Facebook.


1. Steps to working with Temboo

Before starting, you need to do some things on Temboo.

Create account

You should have a valid Temboo account to use the API. If you do not have one, visit the following URL (create Temboo account) and create a login.

You will also need your application information. You can find this information by clicking on the Account tab on the home page once logged into your account. Then click the Applications option (as shown in the picture below). You will need the name of your account, the application name and the key in order to send a petition to the Temboo API correctly.

  • Temboo Account Information

If you have never worked with Temboo before, you might want to consider doing the Yahoo Weather Tutorial that they have for the Arduino. Here is a link to the Getting started tutorial. The link is for the Arduino, but there are also getting started examples for the Arduino Yun.


1. Steps to working with Facebook

The steps to working with Facebook and Temboo are detailed on the Temboo page (Temboo and Facebook). You can follow the instructions there, but we will also list here the most important parts.

Facebook Developers Console

Before continuing, you must configure a Facebook Developers Console. This console will allow you to access your Facebook account from other applications. Set up your developer's console at the Facebook Dev Console.

Aviso Note that many users have had problems receiving Facebook Dev Console confirmation codes. This could have to do with your mobile phone service provider. We would suggest trying with a number from a different company if you do not receive the confirmation code.

Click on the Apps option at the top of the page. Create a new App, click the Settings tab on the left, select + Add Platform, and choose the Website option. Set the Temboo callback URL by specifying the following URL as your Site URL: https://{ACCOUNT_NAME}

Inicialize OAuth

On the InicializeOAuth page enter your Facebook AppID and then click on the Optional Input text. In Scope, add the value publish_actions. Then click Run to generate the Authorization URL and the CallbackID. Click on the Authorization URL and accept the terms to gain access to your Facebook account from Temboo. Save the CallbackID to use in the Finalize OAuth step.

Finalize OAuth

On the FinalizeOAuth page enter your Facebook AppID, your AppSecret from Facebook and the CallbackID from the Inicialize OAuth step. Also, click on the Optional Input text and in Timeout, add the value 40. You can change this value depending on your internet connection. Then click Run to generate the Access Token. Save it because you will need it in any interaction between Temboo and Facebook.

Now we have all the information necessary to make the Altair SmartWorks listener and run an example.


3. Send data from Altair SmartWorks to Temboo using a listener

In this tutorial we will follow the example used in the Arduino Alert System. You could also do the example using the Arduino Yun Alert System.

We will make an alert system that sends sensor data to Altair SmartWorks every time the lights turn off or on. In a Altair SmartWorks listener, we will send that data to Temboo, which in turn will send it to Facebook to set your status.

Follow the Alert System tutorial to establish the correct connections for the Arduino. When you get to the code part, copy and paste the following code in the sketch instead:

Run the code and check in your Altair SmartWorks account if the data is being received correctly.

Once you're sure your Arduino code is running properly, you're ready to create the listener in Altair SmartWorks. To create a listener go to the control panel, then to “Rules” → “Listeners”.

We have enhanced the listener creation process with our Flow Tool.

Click on the new button above the Listeners list. Select "Device" as Entity type and locate next your arduino device name. Select "Event Data Received" and continue to the next step to design the listener logic.

In the Flow editor we'll only need drag & drop a "function" node and add our custom code since this tutorial is not intended to explain the details of the Flow Tool. For a deeper vision of the tool please read its documentation or our "How to create a listener" tutorial.

  • Flow designer: function node

After saving it, your listener will look something like this.

  • Resulting listener

The listener will "listen" to the "data_received" event.

When Altair SmartWorks receives a data stream from the default device that contains the sensor and light data values it will fire the execution path detailed in the "if_expression".

A couple things are important to note for future use of Temboo and different libraries. The URL value will change depending on the Temboo library you want to use. In this case we use /choreos/Library/Facebook/Publishing/SetStatus. However, if you wanted to send data to a Google Spreadsheet for example you would need to use a different route, /choreos/Library/Google/Spreadsheets/AppendRow. Another important difference to note is the payload. The payload inputs depend on the information that Temboo needs to execute the choreo specified in the URL. The amount of inputs and their values will differ for each choreo library. To figure out which input values you need, go to the desired library on the Temboo web page and click on the desired choreo. In a box labeled input you can see all the values that are required in the payload. See the picture below of the required values (in yellow) for the Facebook SetStatus choreo.

  • Choreo Inputs

Now that you have created the listener, any time you run the Arduino sketch lights status should be sent automatically to your Facebook account.

Now that you have successfully connected Altair SmartWorks to Temboo, you can use Temboo's thousands of libraries and Altair SmartWorks listeners to simply push your data anywhere you want. The solution is easy. Explore and enjoy!