Twitter Sentiment Analysis

This flow listens for tweets mentioning a specific term, passes it through sentiment analysis and then routes the messages to one of three outputs depending if the sentiment is positive, neutral or negative.

To use this flow, the twitter node will need to be edited to add your credentials. The search term, currently set to ibm can also be configured in the twitter node.

The Switch node emits positive tweets through the top output, neutral through the middle output and negative through the bottom output.

[{"id":"dad6854b.252978","type":"twitter in","twitter":"","tags":"ibm","user":"false","name":"","topic":"tweets","x":100,"y":100,"z":"e1c9f85b.1e3608","wires":[["d63b18d.f29c4e8"]]},{"id":"d63b18d.f29c4e8","type":"sentiment","name":"","x":240,"y":100,"z":"e1c9f85b.1e3608","wires":[["ac27ffb5.53d8"]]},{"id":"ac27ffb5.53d8","type":"switch","name":"","property":"sentiment.score","rules":[{"t":"gt","v":"0"},{"t":"eq","v":"0"},{"t":"lt","v":"0"}],"checkall":"false","outputs":3,"x":380,"y":100,"z":"e1c9f85b.1e3608","wires":[[],[],[]]}]

Flow Info

created 3 years, 6 months ago
updated 3 years, 1 month ago

Node Types

  • sentiment (x1)
  • switch (x1)
  • twitter in (x1)


  • twitter
  • sentiment
  • analysis
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option