Twitter Enterprise Connector in Action

Posted by on in Tutorial

Update Subscription customers can join the beta and download beta builds for 70+ Enterprise Connectors via the GetIt Package Manager for RAD Studio 10.2. 

In today's post, I thought I would highlight how easy it is to create an application that shows your Twitter feed.

 

Step 1)  Create a new app at apps.twitter.com

Login using your Twitter account credentials and select "Create an application". Enter your app name, description and website URL. Set the Callback URL to 127.0.0.1.

Next, select the option to generate the consumer key and secret.

 

2) Install the Twitter Enterprise Connector Component

In RAD Studio 10.2, navigate to Tools > GetIt Package Manage to install the Twitter Enterprise Connector beta build. After installing the component, you will be asked to restart the IDE. You will then be able to access the new component from the tool palette.

 

3) Create your FireMonkey or VCL Windows Application

For this example, I created a FireMonkey application. From the Data Explorer, right-click on CData Twitter Data Source and select to create a new Connection.

After creating the new connection, enter your Consumer Key ("ClientID"), Consumer Secret ("ClientSecret"), Access Token and Access Secret.

If you're setting the access token and secret explicitly, it performs the OAuth flow for you.

If you're only setting the consumer key, secret and callback URL, it will retrieve the access token and will perform the OAuth flow for you after asking you to login the first time. If you use that approach, creating them via Twitter's API settings is not needed.

For OAuth providers where the token expires, CData handles the refreshing of the token by checking the time value to see if it's expired or within a couple of minutes of expiring, and then requests a new access token. This keeps users from having to worry about the access token and requesting new ones as the CData connector handles that automatically.

 

Next, double-click on your connection, and expand Tables and select CData.Tweets. This will display all tweets from everyone you follow, not just your own tweets.

 

Optionally, you can right click on the TweetsTable component, and select 'Query Editor'. This will allow you to enter a custom SQL command, to just show your own tweets, for example.

In-depth documentation is installed for each component.

 

On your form, ensure that your TFDConnection Twitter component is set to Connected and your TFDQuery Twitter component is set to Active. In this example, one of the included Windows 10 styles is used.

 Go to View > Tool Windows > Live Bindings Designer and visually bind the data source into the grid.

 

 

4) Deploy your application

Here you can see a screenshot of my FireMonkey Windows application.

 

 

 Interested in finding out more about our Enterprise Connectors? Visit https://www.embarcadero.com/products/enterprise-connectors



About
Gold User, Rank: 5, Points: 558
Senior Product Manager, RAD Studio

Comments

Check out more tips and tricks in this development video: