Configuring the Twitter API for TweetScheduler

With our Joomla! extension TweetScheduler you can automatically post tweets through the Twitter API. This tutorial shows you how to configure the OAuth credentials within TweetScheduler to make use of the Twitter API.

Required details

To configure the Twitter API within TweetScheduler, you will need the following details:

  • Consumer key
  • Consumer secret
  • Access token (optional)
  • Access token secret (optional)
These details are obtained from the Twitter site.

Setting up your Twitter-account for OAuth

You probably already have a Twitter-account. If you don't, register yourself at the Twitter website. While you normally login to Twitter using an username and password, this is not how the TweetScheduler works. Your username and password are only kept on the Twitter website, and not within your Joomla! website. This makes things more secure.

Create a new Twitter application

Through the OAuth protocol, you can grant the Joomla! extension TweetScheduler access to your twitter-account. To do this, first login to the right Twitter-account. Next, browse to the URL twitter.com/oauth and hit the link Register a new application.

The details you need to enter for your new Twitter-application are:

  • Application name = This can be anything, but the name must be unique - not just for you, but unique for the entire world. Just choose something like My XYZ TweetScheduler, or include your domainname. This name will also appear in twitter-logging tools like TweetDeck.
  • Description = This can be anything.
  • Website = The URL to your Joomla! website
  • Callback URL = This is very important, and is discussed below. Do NOT skip this value.

tweetscheduler twitterapi1

After this, save this app. You still need to modify the access-level of this new app. Browse to the Settings tab, and modify the Access level to Read and Write. Without this modification, you will unable to post tweets using the Twitter API. Note that it might take some time (say, 10 minutes) before these changes are actually applied.

tweetscheduler twitterapi2

Please note that you have to create a new Twitter Application for every Joomla! website you wish to run TweetScheduler on. Within the app-settings you can add extra domains, but this needs to be disregarded: The Callback URL can only be set once per app.

The value of the Callback URL

The Callback URL is used by Twitter to redirect you to after a so-called token is generated. If you do not return to the right URL, the TweetScheduler extension does not know whether authentication is accepted by Twitter, and therefor no tweets will be placed.

The URL looks the following (this should be a single line):

http://JOOMLA/administrator/index.php?option=com_tweetscheduler&view=account&task=accountConfirm

If your Joomla! website would be installed under http://example.com/ and your Joomla! backend would be available under http://example.com/administrator/, the Callback URL that you need to to use would be (as a single line):

http://example.com/administrator/index.php?option=com_tweetscheduler&view=account&task=accountConfirm

Application-specific values generated by Twitter

After you have created your new Twitter application, Twitter will display the following values under the Details tab. Make sure you write down these values, because you will need to configure them within TweetScheduler:

  • Consumer key
  • Consumer secret
  • Access token
  • Access token secret
tweetscheduler twitterapi3

Configuring Joomla! TweetScheduler

Login to the Joomla! Administrator and browse to Components > TweetScheduler > Accounts. Click on New to create a new account. You can give the new account any title you like. But make sure to copy the exact same Consumer Key and Consumer Secret as was generated by Twitter (see above). Save the account afterwards.

Authorize the account

Now that the account is created, the details need to be verified with Twitter and the application you created needs to be authorized. Within the Accounts overview, click on the link Authorize. This will redirect you to a Twitter page where you can choose whether to allow or to deny access. Click Allow. After this, you should be redirected to the Accounts overview within the Joomla! Administrator.

Reauthorize and test

To reauthorize the account, for instance if you have regenerated the Consumer Key and/or Consumer Secret, just hit the link Reauthorize. If you just want to check whether the authorization is working, just click on Test. This should give you a notice with your Twitter screenname.

Authorization does not work (manual configuration)

If the authorization described above, there is another way to configure TweetScheduler. Go back to your Twitter account-page and navigate to the Details tab. In the botttom, you will find a button to generate an Access Token. Instead of letting TweetScheduler detect a new access-token, you can also generate those details yourself and configure TweetScheduler manually.

Open up the Account within the TweetScheduler backend. Manually copy the value of Access token to the field OAuth Token. Manually copy the value of Access token secret to the field OAuth Token Secret. Save the account. Use the Test link to check if this works.

Do NOT use the Reauthorise link in this case. This will reset your manual values.