Use the ThingTweet app to link a Twitter® account to your ThingSpeak™ account. Devices and channels can update via Twitter using the TweetControl API. For example, you can make a device tweet you when the temperature in your greenhouse drops or when the batteries in a device are running low.
If you are logged in to a Twitter account, ThingTweet automatically associates the available Twitter account to your ThingSpeak user account. Log out of Twitter to associate a different account.
Sign In to ThingSpeak.
Select Apps > ThingTweet.
Click Link Twitter Account.
You are redirected to Twitter. When asked to authorize ThingTweet to use your account:
Enter your Twitter username and password.
Click Authorize app.
After you confirm the Twitter account, click the link Back to ThingTweet to return to the ThingTweet App page.
Notice that your Twitter account is now linked to ThingSpeak
The app generates a ThingTweet API Key for you to use. Use this API key and a message to send a request to ThingTweet. The message gets relayed to Twitter. You can use all parameters of the Twitter API to send the message. See statuses / update in the Twitter documentation for more information. To view the ThingTweet API key for each ThingTweet app, select Apps > ThingTweet.
To update your Twitter status with ThingTweet, send an HTTP POST or GET with the ThingTweet API key and your status message.
|Title||HTTP Request to Update Twitter Status|
|HTTP Method||POST or GET|
|POST HTTP Header||X-THINGSPEAKAPIKEY=XXXXXXXXXXXXXXX|
|Sample POST HTTP Call|
|Sample GET HTTP Call|
|Notes||ThingTweet API key must appear in either the HTTP header or in the body section of the POST, or it can appear in both|
You can use POSTMAN to try out your HTTP requests using the RESTful API for ThingSpeak. Select the Body of the request as x-www-form-urlencoded. Test the tweet request by configuring POSTMAN as shown.
You can include channel data in your Twitter message. ThingTweet
"%%channel_CHANNEL-ID_field_FIELD-NUMBER%%" with the last value of the specified channel
and field. To update your Twitter status with the last value
from Channel 1417,
field1, send an HTTP POST.
|Title||HTTP POST Request to Update Twitter status with Last Value from Channel Field|
|Sample HTTP Call|
|Notes||ThingTweet API key must appear in either the HTTP header or in the body section, or it can appear in both|
You can use POSTMAN to try out your HTTP requests using the RESTful API for ThingSpeak. Test the tweet request using POSTMAN and configuring as shown.
To update a channel and simultaneously post a tweet from your device, see Write Data.
You can pass data to your apps using replacement keys. The following table summarizes the standard and custom replacement keys you can use. Some keys are specific to a particular type of request, as indicated in the last column.
|ThingHTTP replaces this custom replacement value with data in the trigger request that has the label "YOUR_CUSTOM_LABEL".|
|The last value of the specified channel and field. Replacement requests to private channels not owned by the same user as the ThingHTTP request return blank values.|
|The full date and time when the TimeControl or React ran.|
|TimeControl or React|
|The name of the weekday when TimeControl ran.|
|The zero-based index of the weekday starting on Sunday.|
|The hour of the day when TimeControl ran.|
|The minute of the hour when the TimeControl ran.|
|The value that triggered React.|
|The channel ID that triggered React.|