Last updated January 16, 2013. Created by vertikal.dk on January 6, 2011.
Edited by Sam-Inet, juampy, steinmb, eleven. Log in to edit this page.
This guide explains the steps to configure the Post to twitter form field when editing content.
Instructions for:
Twitter 7.x
Start by following the Twitter Installation instructions. It is important to set your Twitter Application keys and to make sure that your application at http://dev.twitter.com has read and write permissions.
Enable Twitter Post. And go to Administration > Configuration > Web Services > Twitter. Then open the POST tab to view Twitter Post settings.

Select the content types from which you want to be able to Post to Twitter and edit the wording of the default Twitter message that will be posted. You can use different replacement tokens as shown under the field.
Several Twitter accounts can be attached to the single Drupal user, but this will require that the user logs in to Twitter as the different users. A user can select to have the Twitter account made global, which will allow other users to post to Twitter in the name of this account. This will typically be used for announcing content to a site wide Twitter-account.
Now when you create or edit content that it is allowed to be posted to Twitter you should see an Post to Twitter.com. Unpublished nodes are not tweeted.

Twitter 6.x-5.x
Twitter 6.x-3.x
{How much of the above 7.x applies to 6.x, I'm not sure. I've repopulated specific information pertaining to 6.x-3.x from the revisions comparison. Some of this is absolutely critical to 6.x-3.x, so please! don't remove it. If you need additional information to setup 6.x, please review the revisions of this page.}
Make sure the Twitter and OAuth-modules are installed OK and that all your credentials are set up properly, meaning that you have registered your application with Twitter and entered the OAuth Consumer key and OAuth Consumer secret from the registration on the Twitter settings page in Drupal /admin/settings/twitter.
Select the content types you want to be able to announce on Twitter under the Post tab /admin/settings/twitter/post and edit the wording of the default Twitter message that will be posted. You can use different replacement tokens as shown under the field.
Also set the OAuth cryptography to RSA-SHA1 under the OAuth-settings /admin/settings/oauth
This is the basic setup, which will allow Drupal to communicate with Twitter using OAuth. There are even more details on this process here.
But each user whose postings are supposed to go out as Tweets also needs to go into his or her user settings /user and go to the Edit tab /user/%/edit where % is the user ID and there select the sub tab Twitter accounts /user/%/edit/twitter.
The user has to add his or her Twitter account details here by clicking the button Add account. This will take the user to Twitter where a confirmation is needed. The user needs to log in or already be logged in to Twitter to confirm the connection. After this the user will be returned to Drupal, and the account will appear with different options, which can be changed as wanted and then saved.
When all this is done, the user should now see a Post to twitter.com option when editing nodes of any type selected to be “postable” to Twitter. Check this box and leave or edit the default post text as wanted, and the post will be tweeted when the node is saved and published. Unpublished nodes are not tweeted.
If several Twitter accounts are attached to one user or global accounts are attached to the node type, the user can select which account to tweet to in a selector below the text field.
| Attachment | Size |
|---|---|
| twitter_post.png | 36.6 KB |
| twitter_post_field.png | 40.95 KB |
Comments
Doesn't seem to be tweeting
I have this all set up according to the directions, and everything looks fine on the Drupal end. I have it associated with my twitter account, and the confirmation looks good. When I make a new post, I get a confirmation that my new post has been tweeted. But nothing appears in my twitter feed.
I've gone over the directions here and at http://drupal.org/node/649714 (Twitter Sign-In). I just don't know what I'm missing.
Using Drupal 6.20, Twitter 6.x-3.0-beta3, and OAuth module 6.x-2.02. It's a bare test account with no other non-default modules enabled.
Any tips as to what I could be missing?
--
Lloyd Dunn
Lloyd, I just ran through my
Lloyd,
I just ran through my own Twitter installation and configuration to check that I hadn't missed something. My description above seems to include all points as far as I can see.
My versions are:
Drupal 6.17
Twitter 6.x-3.0-beta3
OAuth 6.x-2.02
That combo still works fine here.
Could the error be in the Twitter end? I had fairly clear errors in Drupal when my setup didn't work.
Martin
Thanks, I have to assume you
Thanks, I have to assume you are right. From the Drupal side everything seems to be all right. So I will try to figure it out from the Twitter end.
--
Lloyd Dunn
Solved?
Lloyd, have you been able to resolve your issue? I see the very same here and I'm stuck, too.
Thanks,
Stephan
Error by adding twitter account
Hi,
If have installed the twitter modules and Oauth as described withe RSA-SHA1. I have also copied the consumer key and te secret line.
When i go to my profile page i got the next message:
========================
Woah there!
This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.
=========
When i looked in the address line is see: http://twitter.com/oauth/authorize?oauth_token=
What's wrong?
Thnaks,
Fred
Fred, Judging from the URL
Fred,
Judging from the URL you use to go to the Twitter Oauth/Token page there is no token. The oauth_token argument in the URL is empty, and the error message erroneous, because your token hasn't been used, but is simply empty.
http://twitter.com/oauth/authorize?oauth_token= <------ argument missing
Did Drupal or did Twitter provide this link? I don't remember going through this step, and certainly haven't met the error message.
Martin
Hi Martin, I found out that
Hi Martin,
I found out that the callback url was not correct. I used http://genealogie.hcc.nl/drupal/twitter/oauth.
After I changed it to http://www.genealogie.hcc.nl/drupal/twitter/oauth , yes with www, i could registrate the applications. The systemmanager puts also the firewaal in the state so i can access twitter.com and api.twitter.com. I saw also that the time zone was not correct. I corrected this, now drupal has the same settings as the server.
After all these changes, it is possible to put sometime a tweet on the right place, but two of the five messages are not tweeted. Could it be that i got a time-out somewhere?
Thanks,
Fred
Fred, When I submit nodes
Fred,
When I submit nodes that are to be tweeted, Drupal returns immediately and tells me in a Drupal message that the node has been saved and that a tweet has been sent. I haven't experienced that the tweet didn't get sent. Every time I use the facility, it seems to work fine.
If it works sometimes, I guess that your Drupal-system is correctly configured, but that the problem lies in the network, firewall, webserver, with Twitter or somewhere else in your system outside Drupal. I have no idea where that could be. A timeout somewhere in the process would most likely mean a timeout in Drupal too, so some part of the process fails or gets executed, but has no effect.
I hope you are able to locate the problem and fix it.
Martin
Martin, I had in the tweet
Martin,
I had in the tweet message also !tinyurl. When I removed that i see all tweets! BTW with !tinyurl the url wasn't shorten. Must I install a shorten module? so yes which one?
Thanks,
Fred
p.s. maybe the firewall blocked the tinyurl
Fred, My message template is
Fred,
My message template is "New post: !title !tinyurl" and it works like a charm. All tweets go through and all URLs get shortened with TinyURL. I haven't installed any modules or other libraries to obtain this, but just used the built-in tokens, which are listed in the Twitter/Post setup:
"The given text will be posted to twitter.com. You can use !url, !url-alias, !tinyurl, !title, and !user as replacement text."
There are several shorten modules in Drupal, but I don't know whether they all integrate with the Twitter module. The module Shorten does:
http://drupal.org/project/shorten
ShortURL doesn't it seems:
http://drupal.org/project/shorturl
As I said: mine worked right out of the box and I use neither of the above.
Martin
The time on your server could be a problem
If the time on your server is incorrect you can have problems, see http://drupal.org/node/1046948
Agileware
Australian Drupal Developers
http://agileware.com.au
Was working until a week ago.....
Been using this module for months with no problem but around march 3rd it suddenly stopped working. Everything worked fine on the Drupal end and I did receive the message saying the tweet was successfully sent but the tweets do not arrive on our Twitter page. After reading the comments on this page, I thought it might be because of the change from RSA-SHA1 to hmac-sha1. Unfortunately by that point I had already deleted the account from my user in the hopes that I could reset things. I changed the setting anyway but when I try to re-add the account, I get sent to http://twitter.com/oauth/authorize?oauth_token= and the message mentioned above appears:
Woah there!
This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again … it was probably an honest mistake.M
I have checked the callback URL and see no problems. I have deleted the original application through Twitter and then created a new application and used those settings. I also created a brand new user, gave it appropriate permissions and tried adding a new account from there. All of these efforts lead to the same result, the Woah page. I'm not sure what the next step would be. The only thing that comes to mind is deleting everything, including the db tables and starting again. But I'm not sure that will work since the problem seems to be with Twitter.
We can rule out firewall issues since this was working fine until a week ago and nothing has changed on my end. Plus this problem is affecting people who do not use the same internet connection (ie. one is in Portland, the other in NYC)
Twitter 6.x-3.0-beta3 (just updated today from beta2, problem was pre update)
Oauth 6.x-2.02
Any suggestions?
Thanks, Jen
j.a.w.
Jen, I had some major
Jen,
I had some major blackouts on Twitter yesterday with their services being totally unavailable for hours. This might not be the cause for your problems, but before clearing out everything, you might want to confirm that the problem persists.
Apart from that I can't see what might have caused your problem, and can't add further to what's already mentioned above.
Martin
use this module in devel
hey guys,
how does one use this module whilst still in development on localhost ?
there's always light at the end of the tunnel
How to make it work from local host
Ok, so I needed to set-up twitter on a test box. Here is what I did *in general*. Your steps will vary.
Here is what we are going to do:
1) Create a port forward on your home router that forwards TCP port 80 to your web server.
2) Create a domain name that points to your home routers *Internet* or *WAN* IP address.
3) Set-up .htaccess to change your domain name in step #2 to whatever your server name is.
4) Authorize Twitter
5) Disable the port forward
6) Run cron to get new tweets.
Step 1) First, we need to grant access for the call-back. What that means is that when you authorize an app, Twitter will redirect your browser to the URL you enter. Set-up a port forward for port 80 to your drupal installation's IP address. Yes IP address.
Step 2) Next, figure out how hostname points to your routers Internet IP address. We will use this in the call back. You can try to do a reverse look-up on your home router IP address or use dynamic DNS to create a dns name that is updated automatically. You can get a free account from dyndns.com. Mine was example.dyndns-home.com. Once you get that set-up (it's also pretty easy), it's time to test.
Step 3) Now, you have to set-up .htaccess (I am assuming you are using linux. I don't know how to do this on Windows) so that you can rewrite a public domain name to the one you use on your web server. If you don't, the Twitter client will fail when you try to authorize it. You need the domain name from step 2 and you need to know the hostname of your virutal host in httpd.conf.
In your Drupal install directory, make a copy of your .htaccess file by typing 'cp .htaccess .htaccess.orig'
Edit the .htaccess with your favorite editor. After these lines:
RewriteEngine on
add these lines:
RewriteCond %{HTTP_HOST} ^example\.dyndns-home\.com$ [NC]
RewriteRule ^(.*)$ http://sam/$1 [L,R=301]
where example\.dyndns-home\.com is the domain name from step 2. You MUST use slash-period \. and not just a period between the name parts like I did between example and dyndns-home and com. In the second line, replace 'http://sam' with 'http://'
Save the file.
Follow the steps above to configure and authorize Twitter. The call back you will enter when setting up the app on Twitter is 'http:///twitter/oauth'. In my example it is 'http://example.dyndns-home.com/twitter/oauth'
Step 4) Authorize Twitter and it should be successful. If not, see troubleshooting steps in this thread.
Step 5) disable or remove the port forward. You don't need it any longer.
Step 5) run cron manually so that the new messages are received.
That should do it.
No "Post to Twitter" link
There is no link on the content creation page.
All things are done, generating auth key, adding twitter ot account, setting it to global and added SHA1 key by creating a new context.
Jwalant Natvarlal Soneji, BE IT, India
select content type to post twitter
@ jwalantsoneji,
do you select content type to post twitter before you create content page?
there is a simple tutorial to use twitter module step by step:
http://psdtucss.com/drupal/use-twitter-module-to-post-twitter-and-import...
Is there a way to manually add a user?
I have a development site that is not on the Internet, therefore, I can't authorize the app. How can I do this manually within the module?
Can't find content type settings
Hello,
I can't figure out where to configure the content type to post on twitter so that I can't see any post to twitter button.
I've probably missed something, but I can't find what.
In the admin/settings/twitter I don't have any tab ‘post’
Does anyone have an idea?
Drupal 7.7
OAuth 7.x-3.0-alpha1
Twitter 7.x-3.x-dev
admin/config/twitter/post
I had the same problem. I looked through the code and found the post admin location:
admin/config/twitter/post
I am not sure why it does not display in the admin nav.
Callback URL: must have trailng slash "/"
For anyone having problems getting Drupal to post your tweets from Drupal to Twitter using this module. In your Twitter account's "Application type" under Callback URL be sure to include the trailing slash on the URL example.com/twitter/oauth/
I also had to change Access to "Read and Write"
This may have been covered by someone else but this info would have saved me an hour if it was mentioned in this how-to.
Still works for me
I don't know why this was changed to Deprecated... it still works nicely for me on Drupal-installations where it's been set up months ago following this very guide. The guide was actually written after setting it up, just to share my experiences. There might be updates to the modules that I missed, but my sites are up to date with critical core and module updates, and still tweet nicely when I post. These were all posted by a system set up as described: https://twitter.com/#!/slewvid
Martin
Problem with adding Twitter account
When I hit (under admin) "Add Account" browser redirects to twitter page http://clip2net.com/s/2lnKy, and after click on "Autorize App" redirects to this page http://clip2net.com/s/2lnNV and then I can go to Homepage.
The question is: WHERE to enter this PIN to complete authorization process? In admin panel nothing changed: I steel have empty list of twiter accounts http://clip2net.com/s/2lo4P
I don't understand what's wrong. Module version is 7.x-3.2
----------------------------------
Ok, problem was because I didn't enter Callback URL while registering new application at Twitter.com (http://[yoursite.com]/twitter/oauth)
:)
Posts from several users to be published to one twitter account
I have a news site where several users with the role Editor can post nodes. The newspaper has one Twitter account where I want all the nodes to be published to.
How can I do this? Currently only nodes created from the Administrator (in which account the twitter account was added) are ported to Twitter.
Thakns