1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/social/twitter
Matt Borja 640a6d0cb2
Improve error handling for read-only applications (#709)
Applications pending approval will return a different response body than what is presently supported.

Below is a copy of the actual response that comes back in this scenario:
```
{"status":401,"rateLimitTimeout":null,"body":{"request":"/1.1/statuses/update.json","error":"Read-only application cannot POST."}}
```

Whereas the current implementation assumes the presence of an `errors` array, reading off the first element (i.e. `result.body.errors[0]`), the above scenario throws an exception as `result.body.errors` is now `undefined` and cannot be indexed).

The proposed update seeks to account for this while retaining existing functionality and has been tested (error message in debug now properly says "Read-only application cannot POST."
2020-11-11 11:26:56 +00:00
..
icons Add twitter icon to twitter node to remove dependency on core icon 2019-06-21 14:09:50 +01:00
locales bump sentiment, rbe, email, feedparser, twitter, tail nodes 2019-12-05 21:36:59 +00:00
27-twitter.html Move English help to en-US directory (#592) 2019-12-05 21:18:59 +00:00
27-twitter.js Improve error handling for read-only applications (#709) 2020-11-11 11:26:56 +00:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
package.json bump sentiment, rbe, email, feedparser, twitter, tail nodes 2019-12-05 21:36:59 +00:00
README.md Add events to Twitter node 2016-11-12 11:43:25 +00:00

node-red-node-twitter

Node-RED nodes to talk to Twitter.

The Twitter API will NOT deliver 100% of all tweets. This does NOT give access to the Twitter Firehose.

Tweets of who you follow will include their retweets and favourites.

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

    npm install node-red-node-twitter

Usage

Provides two nodes - one to receive messages, and one to send.

Input

Twitter input node. Can be used to search either:

  • the public or a user's stream for tweets containing the configured search term
  • all tweets by specific users
  • direct messages received by the authenticated user

Use space for and, and comma , for or when searching for multiple terms.

Sets the msg.topic to tweets/ and then appends the senders screen name.

Sets msg.location to the tweeters location if known.

When returning events it sets the msg.payload to the twitter event, a full list is documented by Twitter.

Sets msg.tweet to the full tweet object as documented by Twitter.

Note: This node is not connected to the FireHose, so will not return 100% of all tweets to a busy @id or #hashtag.

Sets msg.tweet to the full tweet object as documented by Twitter.

Note: when set to a specific user's tweets, or your direct messages, the node is subject to Twitter's API rate limiting. If you deploy the flows multiple times within a 15 minute window, you may exceed the limit and will see errors from the node. These errors will clear when the current 15 minute window passes.

Output

Tweets the msg.payload.

To send a Direct Message (DM) - use a payload like.

    D {username} {message}

If msg.media exists and is a Buffer object, this node will treat it as an image and attach it to the tweet.

If msg.params exists and is an object of name:value pairs, this node will treat it as parameters for the update request.