How to send Yahoo Messenger messages from java

Ray DeBruyn8 Jul 2010 1:42 PM
I played with the ymsg package a couple of years ago and successfully sent and retrieved messages from java. I revisited this code yesterday to find it was failing to log in.

It appears that source forge has taken over this project. I downloaded the latest copy (ymsg_code_source_v0_64.zip) and still failed. The code compiles and runs, but fails to log in.

Is anyone using this package? If not, is there still a way to do this? I've been poking around and there appears to be a new set of APIs. If these do what I need, it would also appear that I need a combination of APIs. Can anyone shed some light for me. What I need is to send text messages and potentially confirm if a user is online. The previous code would take parameters of an ID and message, send the message, start a listener and display recived messages in the console.

If I can confirm that the ymsg package is still in use by others and is working, I'll attempt to get it working.

If I can confirm that the ymsg package is no longer in use by others and/or does not work, I'll abandon it.

If you suggest the new APIs or some other method, I would appreciate what ever advice you can give.

Thanks in advance,
Ray
Jonathan LeBlanc12 Jul 2010 8:39 AM
Hi Ray,

Unfortunately we no longer support the messenger API, so the functionality for working with it has been turned off. Unofficially, the one utility which I know of that can access Messenger is Libpurple: http://developer.pidgin.im/wiki/WhatIsLibpurple. I should note that this is not supported by Yahoo! and we offer no guarantees that it will remain functional with Messenger.

I hope that helps,
Jon
Ray DeBruyn12 Jul 2010 3:01 PM
No wonder it was so hard to find info on this!

I'd started from scratch and created a java app using OAuth2, but so far failed have a NullPointerException in the org.opensocial.Response.getParser code. I think I need a different value for VIEWER_ID than my yahoo email address.

Is there any functionality in this to verify if friends are online?

Can you shed any light on what to use for the VIEWER_ID as in the code below. The choke point is on the response = client.send(request); line:

Provider provider = new YahooProvider();
AuthScheme scheme = new OAuth2LeggedScheme(CONSUMER_KEY, CONSUMER_SECRET, VIEWER_ID);
Client client = new Client(provider, scheme);
Request request;
Response response;

request = PeopleService.getViewer();

try
{
response = client.send(request);
}
catch (IOException e)
{
System.out.println("IOException " + e.getMessage());
}
catch (RequestException e)
{
System.out.println("RequestException " + e.getMessage());
}
catch (Exception e)
{
e.printStackTrace();
}