Twitter Analytics
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:
- Create your Twitter Application in Twitter Application Management.
- Open the created application, and click on the Permissions tab. Select the Read and Write option and click Update Settings.
- Click on the Keys And Access Tokens tab. Generate a new access token by clicking Create My Access Token.
- 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:
- In your terminal, navigate to the
<SP_HOME>/bin
directory. Then issue one of the following commands to start the dashboard server.- On Windows:
dashboard.bat --run
- On Linux/Mac OS:
./dashboard.sh
- On Windows:
- Start a WSO2 SP worker runtime by issuing one of the following commands from the
<SP_HOME>/bin
directory.- On Windows:
worker.bat --run
- On Linux/Mac OS:
./worker.sh
- On Windows:
- Access the Business Rules Manager and log in with your credentials.
- URL:
https://<SP_HOST>:<HTTPS_PORT>/business-rules
(e.g.,https://localhost:9643/business-rules
) - User Name: admin
- Password: admin
- URL:
- 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.
- Click Template to create the business rule from the business template that is already available in the Twitter Analytics solution.
- Click on Twitter Analytics to create your business rule from the template
Twitter Analytics
.
This opens the Twitter Analytics page. - Select Popular Tweets Analysis in the Rule Template field.
The Popular Tweets Analysis template opens with the template-specific fields.
To specify how the tweets generated by your application needs to be processed, enter information in the fields displayed as follows:
Field Description Business Rule Name A unique name for the business rule. Consumer Key The API key to access your Twitter application. Consumer Secret The API secret to access your Twitter application. Access Token The access token via which Tweets are generated from your Twitter account. Access Token Secret The access token secret to secure the Tweets generated via the access token from your Twitter account. Filtering Keywords The Tweets are filtered by the keywords entered in this field. Filtering Language The Tweets are filtered by the language entered in this field. Query The query that defines how the Tweets need to be filtered. Count The maximum number of Tweets that should be displayed on a page at a given time. Polling Interval The time interval (in seconds) at which the Tweets need to be polled. - Click Save and Deploy.
Step 2: Monitor Twitter activity
To monitor Twitter activity via the Twitter Analytics dashboard, follow the procedure below:
- Access the Dashboard Portal and log in with your credentials.
- URL:
https:
//<SP_HOST>:<HTTPS_PORT>/portal
(e.g.,https://localhost:9643/portal
) - User Name: admin
- Password: admin
- URL:
- The Twitter Analytics dashboard is included in the dashboard listing as shown below.
- Click on the Twitter Analytics dashboard to open it. Information is displayed in the widgets as shown in the example below.