Hello James and all readers, I have successfully attained the twitter credentials (key, secret, etc.) to post tweets using the twitter4j shell scripts: updateStatus.sh, showStatus.sh etc.

The scripts reference the twitter4j 3.0.4 snapshot jar and I have included the maven dependency in the clone of the Pebble project for twitter4j 3.0.3 so the code referenced by the Yamamoto shell scripts should still work.

Using git flow I created a branch under the git development branch with the label: twitter4j_updatestatus but now I have a nagging compile time complaint from Intellij:

Cannot resolve symbol <StaticPageType> line #140 FileStaticPageDAO.java

Googling the above returns:

http://pebble.sourceforge.net/cobertura/net.sourceforge.pebble.dao.file.StaticPageType.html

I cloned the project I thought correctly from github.

Intellij VCS->git->show current revision returns:

FileStaticPageDAO.java Current version is b670ed79187e11baec7e1beba5c16b213038b8cc.
Modified by James Roper 1/28/11 8:18 AM Update copyright notices

Have I somehow missed a dependency or cloned the wrong revision?

Please advise, David.


On 01/01/2013 05:15 PM, James Roper wrote:
The fact is, the code in Pebble that posts to Twitter is only a couple of
lines of code, there's no abstraction layer because none is needed.  Those
few lines of code and can just directly be replaced with code that talks to
a new library.

Now if you have an API key and secret, and an access key and secret, then
the work is really easy, just change the plugins.xml to allow a user to
configure those things, and you're done.  However, getting an access key
and secret is not a straight forward thing, I don't know if Twitter
provides a way to manually get one?  So you would have to implement some
actions in Pebble to do the OAuth dance, and this is where things are
complex.

On 2 January 2013 06:01, David Brown <[email protected]> wrote:

Hi, pls excuse the top post.

Using Christian's suggestion I created a so-called Twitter app and
received a consumer key and a consumer secret.

Plugging in the consumer key and secret at the command line:

java -jar twitter4j-2.0.10.jar -Dtwitter4j.oauth.consumerKey=[mykey]
-Dtwitter4j.oauth.consumerSecret=[mysecret]
twitter4j.examples.OAuthUpdate "Hello World"

only returns the following:

Twitter4J 2.0.10

Studying the Pebble code in twitter4j.examples.OAuthUpdate.java I don't
even understand where the string above is returned so obviously the
twitter4j.jar is broken and is definitely not supported by Twitter.

The only thing I found supported by Twitter for Java is the old
kenai.com project hosting now defunct:

http://kenai.com/projects/twitterapime/pages/Home

So answering my own post it appears James is right and there exists no
straight up API from twitter to perform any type of communication w/
Twitter.

There appears to be Ruby, C#, PHP, et. al. support but no Java.


On 01/01/2013 11:13 AM, David Brown wrote:
Hi Christian, thnx for the reply.

However, I'm more conflicted then b4 posting this.

Please see below my response to some of your comments.

This is what I have to study this issue:

* A local clone of Pebble from github:
https://github.com/pebbleblog/pebble (thanks to James Pebble is much
easier to work with than in the past).

* Running: mvn:site run at the command line spits out this: Building
Pebble 2.6.5-SNAPSHOT

* I have the Pebble clone in my Intellij and this is what I have found
under Project:External Libraries:
** The twitter4j-2.0.10.jar
** package twitter4j.examples
** public class OAuthUpdate

The class OAuthUpdate method main() has a usage comment that references
your suggestions below:

Usage: java -Dtwitter4j.oauth.consumerKey=[consumer key]
-Dtwitter4j.oauth.consumerSecret=[consumer secret]
twitter4j.examples.OAuthUpdate [message]

Though the example code does not look like what you have provided below.

I'm tempted to attempt running the OAuthUpdate main to see what happens
if I can acquire the tokens from Twitter as specified below.

If I can get the Pebble/Twitter example to work then I would like to
create a git branch (I'm using gitflow) to tinker with this issue in an
effort to get it to work.

The original author was: Yusuke Yamamoto.

Maybe someone can chime in.

Regards, David.


On 01/01/2013 07:32 AM, Christian Bockermann wrote:
Hi David,

the UI way is definitely not the only solution. A few weeks ago I worked
with the twitter API for crawling purposes and had to connect my code to
their API. I used the 'scribe' library to accomplish the oauth stuff.

The only needed pieces have been the 'consumerKey', 'consumerSecret' and
the application tokens 'accessToken' and 'accessTokenSecret'. The UI way
you mentioned is *one* way to obtain a temporary accessToken+secret.

However, you can log into the twitter developer API and create a new
application for yourself. This application will then be equipped with a
permanent access token+secret that you can further use in your API:


       // create a new OAuth service
       //
       authService = new ServiceBuilder().provider(TwitterApi.class)
                              .apiKey(consumerKey)
                                   .apiSecret(consumerSecret)
                                   .build();

       // if you already have the accessToken+secret from the developer
       // API you're done:
       //
       Token token = new Token(accessToken, accessTokenSecret);


Then I accessed the twitter REST API directly. For sure, that's not
as convenient as it should be, but at least it's a way to access Twitter
without the UI solution.


I haven't looked into the pebble code for a long time and do not know
much about it. If it uses the twitter4j library directly, it will be
difficult to modify it. If there is a thin custom layer in between, it
might be possible to extend it with scribd.
I went to scribd.com (wrong site?).
I'm not the most up-to-date tech guy but I don't see any hint of an API
or library at scribd (sorry).
Happy new year to all!

Chris




Am 01.01.2013 um 05:47 schrieb David Brown <[email protected]>:

Hi James. Thnx for the reply. I anticipated this answer. Unfortunate.
Looking into the Fb and twitter APIs it appears their UI way is the only
solution.
James Roper <[email protected]> wrote:

Pebbles support for posting to Twitter was implemented before Twitter
introduced their oauth only authentication policy.  It still tries to use a
username and password, which Twitter now disallows, hence it simply won't
work.  A few years ago I had a look at what it would take to add OAuth
support, and found that the Twitter library that Pebble uses doesn't
support OAuth, and it didn't look like it ever would.  Adding OAuth support
would probably require rewriting that plugin, and would require
implementing new actions to support doing the OAuth dance to get the access
token from Twitter for the account you want to post with.  This is no small
task.
As far as I am aware, Pebble has never supported posting to Facebook.
  It does support commenters getting their username and profile picture from
Facebook automatically associated with their posts, but that's all.  This
is mostly done client side.  Posting to Facebook would require server side
work, and would not be trivial.
What Pebble does support is rendering social links below a blog post,
this includes Twitter and Facebook I think, and when you click them brings
up a popup from those websites that let you share the link to the blog
post.  These links are incredibly out of date, and include links to sites
that no longer exist.  It needs to be updated by someone who is interested
in using these features still.
On 1 January 2013 12:00, David Brown <[email protected]> wrote:
Hi All, in some previous Pebble revision long ago I know that Pebble
would post to either FB or Twitter.

Looking at the Pebble plugin config and the 2.6.4 sourcecode FB and
attemping to use a so-called FB app id it appears posting to FB might
be
a longshot for Pebble.

Twitter on the otherhand appears more likely to work since I have been
able to get some Pebble logs feedback.

If anyone has something to say about the logs posted below please
advise.
Thanks in advance, David.


************************************************************************************************
Jan 1, 2013 12:51:40 AM
net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
getProperty
SEVERE: Twitter credentials (url) not found. Please configure
twitter.url in order to post to twitter
Jan 1, 2013 12:51:41 AM
net.sourceforge.pebble.event.blogentry.PostToTwitterBlogEntryListener
getProperty
SEVERE: Twitter credentials (simulate) not found. Please configure
twitter.simulate in order to post to twitter
Jan 1, 2013 12:51:43 AM

net.sourceforge.pebble.webservice.UpdateNotificationPingsClient$UpdateNotificationPingsAsyncCallback
handleResult


************************************************************************************************

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and
experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Pebble-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebble-user


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and
experts.
SALE $99.99 this month only - learn more at:

http://p.sf.net/sfu/learnmore_122512_______________________________________________
Pebble-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebble-user
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and
experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Pebble-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebble-user

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Pebble-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebble-user


------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
Pebble-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebble-user



------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512


_______________________________________________
Pebble-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebble-user

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Pebble-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebble-user

Reply via email to