In the last project of this chapter, we are going to see how to interact with Facebook from the ESP8266 Wi-Fi chip, via Temboo. We will see how to simply post a status update, but you can use it to post something on a friend's wall, post data on a page, and much more!
Temboo
username:publish_actions
):Temboo
library that we actually want to use, which is the library to publish a post on Facebook:https://temboo.com/library/Library/Facebook/Publishing/Post/
This is how it should look at the end:
#include <SPI.h> #include <ESP8266WiFi.h> #include <Temboo.h> #include "TembooAccount.h" // Contains Temboo account information
loop()
function, we post the message on the Facebook wall at every iteration of the loop:if (numRuns <= maxRuns) { Serial.println("Running Post - Run #" + String(numRuns++)); TembooChoreo PostChoreo(client); // Invoke the Temboo client PostChoreo.begin(); // Set Temboo account credentials PostChoreo.setAccountName(TEMBOO_ACCOUNT); PostChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); PostChoreo.setAppKey(TEMBOO_APP_KEY); // Set Choreo inputs String MessageValue = "A simple message from the ESP8266!"; PostChoreo.addInput("Message", MessageValue); String AccessTokenValue = "accessToken"; PostChoreo.addInput("AccessToken", AccessTokenValue); // Identify the Choreo to run PostChoreo.setChoreo("/Library/Facebook/Publishing/Post"); // Run the Choreo; when results are available, print them to serial PostChoreo.run(); while(PostChoreo.available()) { char c = PostChoreo.read(); Serial.print(c); } PostChoreo.close(); } Serial.println(" Waiting... "); delay(30000); // wait 30 seconds between Post calls }
You can now use Temboo to post on Facebook using the ESP8266 Wi-Fi chip!
3.135.191.86