This documentation is for WSO2 Stream Processor 4.3.0. View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

Twitter Analytics solution allows you to create a Twitter application that can be integrated into your service, and monitor the Tweets generated from it. This solution is packed in WSO2 SP by default. To use this solution, follow the steps below:

Step 1: Set up the Twitter Analytics solution

This step involves setting up the Twitter Analytics solutions by defining how the execution needs to be done using information specific to your Twitter application. In order to do this, you need to create a business rule using the predefined business rules template, Popular Tweets Analysis shipped with this solution. For more information about Business Rules, see Working with Business Rules.

Before you begin:

Create a Twitter application and collect the required information as follows:

  1. Create your Twitter Application in Twitter Application Management.
  2. Open the created application, and click on the Permissions tab. Select the Read and Write option and click Update Settings.
  3. Click on the Keys And Access Tokens tab. Generate a new access token by clicking Create My Access Token.
  4. Collect following values from the Keys and Access Tokens tab:
    • Consumer Key
    • Consumer Secret
    • Access Token
    • Access Token Secret

To create a business rule to set up the Twitter Analytics solution, follow the procedure given below:

  1. In your terminal, navigate to the <SP_HOME>/bin directory. Then issue one of the following commands to start the dashboard server.
    • On Windowsdashboard.bat --run
    • On Linux/Mac OS: ./
  2. Start a WSO2 SP worker runtime by issuing one of the following commands from the <SP_HOME>/bin directory.
    • On Windowsworker.bat --run
    • On Linux/Mac OS./
  3. Access the Business Rules Manager via one of the following URLs.
  4. If you do not have any business rules that are already created, click Create. If there are existing rules, click to create a new rule.
  5. Click Template to create the business rule from the business template that is already available in the Twitter Analytics solution.
  6. Click on Twitter Analytics to create your business rule from the template,Twitter Analytics

    This opens the Twitter Analytics page. 
  7. Select Popular Tweets Analysis in the Rule Template field.

    The Popular Tweets Analysis template opens with the template-specific fields.
  8. To specify how the tweets generated by your application needs to be processed, enter information in the fields displayed as follows:

    Business Rule NameA unique name for the business rule.
    Consumer KeyThe API key to access your Twitter application.
    Consumer SecretThe API secret to access your Twitter application.
    Access TokenThe access token via which Tweets are generated from your Twitter account.
    Access Token SecretThe access token secret to secure the Tweets generated via the access token from your Twitter account.
    Filtering KeywordsThe Tweets are filtered by the keywords entered in this field.
    Filtering LanguageThe Tweets are filtered by the language entered in this field.
    QueryThe query that defines how the Tweets need to be filtered.
    CountThe maximum number of Tweets that should be displayed on a page at a given time.
    Polling IntervalThe time interval (in seconds) at which the Tweets need to be polled.
  9. Click Save and Deploy.

Step 2: Monitor Twitter activity

To monitor Twitter activity via the Twitter Analytics dashboard, follow the procedure below:

  1. Access the Dashboard Portal via one of the following URLs.
  2. Log in with your credentials. The Twitter Analytics dashboard is included in the dashboard listing as shown below.
  3. Click on the Twitter Analytics dashboard to open it. Information is displayed in the widgets as shown in the example below.

  • No labels