This blog demonstrates how to design a dashboard with live Twitter feeds using the Syncfusion Dashboard Platform. You can link any Twitter account with the Syncfusion Dashboard Platform for this and design the dashboard accordingly.
Twitter features OAuth support, allowing users to access its APIs through which data can be retrieved from a Syncfusion dashboard.
To access the Twitter API, register your application on Twitter Apps and fill out the necessary forms. You will receive a client ID and client secret which you can use to establish an authorized and secure connection with the Syncfusion Dashboard. For more details about registration, click here.
From the Syncfusion Dashboard Designer, in the New Connection wizard, choose Web Data Source connection type, OAuth authentication type, Twitter provider, set an endpoint URL to connect to, and fill in all other details. At the end, click Get Access for the login information to access your account.
Figure 1: Connecting to a Twitter account
On successful connection, you can view tables from a valid Twitter API endpoint URL. Start placing widgets in the dashboard and bind them with the appropriate table column to create a meaningful dashboard showing Twitter account information.
Figure 2: Mapping widgets with the table columns to design a dashboard
Once the dashboard design is completed, you can schedule your dashboard to view the up-to-date Twitter account information by following this procedure:
- Schedule periodic refreshes of the hosted dashboard.
- Configure the target server database using the Syncfusion Dashboard Data Agent.
- Schedule periodic refreshes of the data source.
We’ll now walk-through these steps.
Scheduling periodic refreshes of the hosted dashboard
To show the live feeds, we’ll first schedule to refresh the dashboard at regular intervals. To do this, select Server > Refresh Setting from the Dashboard Designer toolbar, and set the appropriate time to refresh the dashboard at regular intervals.
Figure 3: Dialog to refresh the dashboard periodically
Configuring the target server database using the Syncfusion Dashboard Data Agent
Using the Syncfusion Data Agent Tool, we need to register the target server details. The fact here is that we cannot pass SQL or non-SQL queries via the Twitter API for results as those APIs just carry JSON information on request. Moreover, operations like filtering, sorting, top N, etc., need to be handled, so a target server database is preferred for better data manipulation.
In this example, a SQL Server database has been used as the target server database. Its details have been added to the connection part in the Data Agent tool.
Note: The Syncfusion Dashboard Data Agent should be installed in the production server where the dashboard is published for public access.
Figure 4: Adding a target server
Scheduling periodic refreshes of the data source
In the Dashboard Designer, under the Server > Publish > Dashboard module, select the Data Agent (Scheduled Refresh) option to schedule the publishing of a dashboard to the production server. It requires the Data Agent’s IP, port, and connection (target server database connection handled in the previous section).
Figure 5: Agent IP and port number from the Data Agent tool
The schedule time can be applied in seconds, minutes, hours, and days format. Each of the data sources listed in the left side panel that is connected to Twitter needs to be scheduled individually in order to move the updated JSON information from the Twitter API endpoint URL to the target server database periodically. Once the time is scheduled, the publishing process is completed.
Figure 6: Scheduling the dashboard for periodic update
Figure 7: Published Twitter dashboard
Now Twitter is connected to our dashboard, and account information like tweets, likes, retweets, recent tweets, likes for recent tweets, retweets for recent tweets, followers, following, etc., are showcased in a dashboard for a unique, live experience using the Syncfusion Dashboard Platform. Now you can try on your end with a free-trial download and the supporting resources available online. Happy dashboarding!