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 with the ThingTweet API key and your status message.
Title | HTTP POST Request to Update Twitter Status |
---|---|
URL | https://api.thingspeak.com/apps/thingtweet/1/statuses/update |
HTTP Method | POST |
HTTP Header | X-THINGSPEAKAPIKEY=XXXXXXXXXXXXXXX |
Data Parameters | api_key=XXXXXXXXXXXXXXX |
Success Response | 1 |
Error Responses | –1 |
Sample HTTP Call | POST /apps/thingtweet/1/statuses/update |
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. 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
replaces "%%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 |
---|---|
URL | https://api.thingspeak.com/apps/thingtweet/1/statuses/update |
HTTP Method | POST |
HTTP Header | X-THINGSPEAKAPIKEY=XXXXXXXXXXXXXXX |
Data Parameters | api_key=XXXXXXXXXXXXXXXX |
Success Response | 1 |
Error Responses | –1 |
Sample HTTP Call | POST /apps/thingtweet/1/statuses/update |
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
.