ThingSpeak

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

ThingTweet App

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.

Associate Twitter Account with ThingSpeak Account

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.

  1. Sign In to ThingSpeak.

  2. Select Apps > ThingTweet.

  3. 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.

  4. 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.

Update Twitter Status

To update your Twitter status with ThingTweet, send an HTTP POST with the ThingTweet API key and your status message.

TitleHTTP POST Request to Update Twitter Status
URLhttps://api.thingspeak.com/apps/thingtweet/1/statuses/update
HTTP MethodPOST
HTTP Header X-THINGSPEAKAPIKEY=XXXXXXXXXXXXXXX
Data Parametersapi_key=XXXXXXXXXXXXXXX
status=I just posted this from my thing!
Success Response 1
Error Responses–1
Sample HTTP CallPOST /apps/thingtweet/1/statuses/update
HTTP/1.1 Host: api.thingspeak.com
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache

api_key=YOUR_THINGTWEET_API_KEY
status=I+just+posted+this+from+my+Thing!
NotesThingTweet API key must appear in either the HTTP header or in the body section, or it can appear in both

Example POSTMAN Request

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.

Update Twitter Status with Last Value from Channel

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.

TitleHTTP POST Request to Update Twitter status with Last Value from Channel Field
URLhttps://api.thingspeak.com/apps/thingtweet/1/statuses/update
HTTP MethodPOST
HTTP Header X-THINGSPEAKAPIKEY=XXXXXXXXXXXXXXX
Data Parametersapi_key=XXXXXXXXXXXXXXXX
status=The current CheerLights color is %%channel_1417_field_1%%
Success Response 1
Error Responses–1
Sample HTTP CallPOST /apps/thingtweet/1/statuses/update
HTTP/1.1 Host: api.thingspeak.com
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache

api_key=YOUR_THINGTWEET_API_KEY
status=The+current+CheerLights+color+is+%25%25channel_1417_field_1%25%25
NotesThingTweet API key must appear in either the HTTP header or in the body section, or it can appear in both

Example POSTMAN Request

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 Update a Channel Feed.

Related Topics

Was this topic helpful?