Chapter 1. Introduction to the Yahoo Messenger IM SDK

Yahoo Messenger is the premier instant messaging (IM) platform, used on a wide variety of desktop and mobile clients. Millions of users throughout the world depend on Yahoo Instant Messenger to manage their social contacts, group lists, and presence information; hold real-time instant communications; and perform data transfer to and from contacts throughout the world. All instantly.

This tutorial will help you get started developing clients for the Yahoo Messenger IM SDK. In particular, we’ll show you how to perform five steps common to any Yahoo Messenger IM SDK client.

  1. Create a Yahoo Messenger Open Authentication (OAuth) API Key.
  2. Authenticate with the Yahoo Messenger IM SDK servers.
  3. Create a new session.
  4. Obtain and update presence information.
  5. Obtain the current contact list, as well as more detailed information on a particular contact.
  6. Send and receive a message from another contact.

As you’ll see, developing for the Yahoo Messenger IM SDK platform is effortless. The only pre-requisite is knowledge of basic HTTP and JavaScript Object Notation (JSON).

Creating a Yahoo Messenger OAuth API Key

The first thing you will need in order to use the Yahoo Messenger IM SDK platform is an Open Authentication (OAuth) API key. You can create a key with your Yahoo account by accessing the site Once there, click the option for #2 Build, "Get an API Key and create your app", as shown in the figure below.

At this point, simply login and accept the terms of use, and you should see a screen similar to the following figure.

This screen contains all the application projects that you have created. In order to use Yahoo Messenger in your application, click the "New Project" button near the top of the page. At this point, the following dialog box should appear.

Be sure to choose the second option, shown in the dialog, that creates an application that uses the Yahoo Open Authentication (OAuth) APIs. Once you click "Continue", you'll see the page shown below. Here, you can fill out the information fields that describe your application in more detail. Under "Access Scopes", click the option to "This app requires access to private user data", as shown in the following figure.

Once you click the option to enable access to private user data, you will be presented with a number of Yahoo applications that your OAuth credentials can access. Select Read/Write access for Yahoo Messenger, fill out any remaining fields, and click "Get API Key." The final screen, shown below, contains the OAuth data, which consists of two essential fields: the OAuth Consumer Key and the Consumer Secret Key. These values are required in your API calls to use the Yahoo Messenger IM SDK.

Table of Contents