On this Page
I want to see who is tweeting about our company and count how often they are.
For this scenario, the following Snaps are used:
- Twitter Query
- CSV Formatter
- File Writer
- A Twitter account configured in SnapLogic Manager. See Accounts for more information on configuring an account.
- Create a new pipeline by clicking the (+) tab.
- Add and configure a Twitter Query Snap.
- The the Accounts tab, select your configured Twitter account.
- For the Twitter query field, enter the query you want to use. For this use case, set the query to @SnapLogic.
- Add and configure a Structure Snap. For this use case, we want to see who is tweeting what, but don't need all of the details Twitter provides with our query.
- Set Pass through to [None] - new map.
- Add two rows to the Mapping table, with the following values:
- $fromUser, move, $fromUser
- $user.name, move, $name
- $text, move, $text
- Add and configure an Aggregate Snap. We will use this to see how many tweets come from each user.
- Add three rows to the GROUP-BY fields table:
- $fromUser, ID
- $name, Name
- <null>, Total
- Set Result to Total.
- Set Aggregate to $fromUser.
- Set Aggregate function to COUNT.
- Add a CSV Formatter Snap.
- Add and configure a File Writer Snap. This will create a CSV file with the number of tweets for each of the 3 groups listed in the Conditional Snap.
- For each output, set the File Name to the name of the file where you want the results written to, including a path if necessary.
The resulting file from the Count branch will now tell you how many tweets per user.