Pipeline: Count of Who is Tweeting About Us

On this Page

Scenario

I want to see who is tweeting about our company and count how often they are. 

Requirements

Snaps Used

For this scenario, the following Snaps are used:

  • Twitter Query
  • Structure
  • Aggregate
  • Sort
  • CSV Formatter
  • File Writer

Other Requirements

  • A Twitter account configured in SnapLogic Manager. See Accounts for more information on configuring an account.


Configuration


  1. Create a new pipeline by clicking the (+) tab.
     
  2. 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.
       
  3. 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
  4. 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:
      • $fromUserID
      • $name, Name
      • <null>, Total
    • Set Result to Total.
    • Set Aggregate to $fromUser.
    • Set Aggregate function to COUNT.
  5. Add a CSV Formatter Snap.
  6. 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.