The ThingTweet App allows you to update a Twitter status via ThingSpeak. Twitter requires Open Authentication (OAuth) which is difficult for a low level device to interface with. ThingTweet acts a Twitter proxy, so the device can use Twitter by making simple API calls.
App Setup
Sign in to
ThingSpeak, select Apps from the menu, and then click on
ThingTweet.
Under the ThingTweet App, select "Link new Twitter account". This will redirect you to Twitter to see if you want the app to have the ability to access your account. You can Allow or Deny the process. Once you have confirmed the right Twitter account, Twitter will send you back to ThingSpeak.
The app generates a ThingTweet API Key for you to use. If you send an HTTP POST with your ThingTweet API Key, then the message will be relayed to Twitter. All of the parameters from the Twitter API (
statuses/update) are possible including geolocation.
Update Twitter Status
To update your Twitter status send an HTTP POST to
http://160.16.121.247:3000/apps/thingtweet/1/statuses/update
and include your ThingTweet API key and message.
Example POST:
POST http://160.16.121.247:3000/apps/thingtweet/1/statuses/update
api_key=XXXXXXXXXXXXXXXX
status=I just posted this from my thing!
The response will be
1
if the update was successful, and
-1
if there was an error.
Channel Values
You can retrieve the last value from a Channel field by including the following in the ThingTweet status:
%%channel_CHANNEL_ID_field_FIELD_NUMBER%%
For example, you can send a Tweet that includes the last value from Channel 1417, field 1:
status=The current CheerLights color is %%channel_1417_field_1%%.
Update Channel Feed and Twitter Status
Your Twitter status can also be updated when a
Channel feed is updated by specifying the
twitter and
tweet parameters.
Example Channel feed update that also updates a Twitter status:
POST http://160.16.121.247:3000/update.json.xml
api_key=XXXXXXXXXXXXXXXX
field1=73
twitter=thingspeaktest
tweet=I just posted this from my thing!