Secrets of implementing a Gtalk Bot

I have read an article on implementing a Gtalk bot. I found it intresting so, I thought to write the concepts behind Google Talk and implementing your own Google Talk Bot.

Google Talk (GTalk) is a free Windows and web-based instant messaging application offered by Google Inc .

Instant messaging between the Google Talk servers and its clients uses an open protocol, XMPP, Protocol.

XMPP (Extensible Messaging and Presence Protocol) is an open technology for instant messaging. The core technology behind XMPP was invented by Jeremie Miller in 1998, refined in the Jabber open-source community in 1999 and 2000, and formalized by the IETF in 2002 and 2003, resulting in publication of the XMPP RFCs in 200.

Google talk uses XMPP for authentication, presence and messaging so any client that supports XMPP can connect to the Google Talk service . Google Talk seervice is hosted at on 5222 port.

To write a Google Talk bot you need to implement XMPP client API of your choice in your choice of platform. For example SMACK is java XMPP client API.

Steps required to write a Gtalk Bot:

1. Download SMACK client API from
2. Extract smack.jar, smackx.jar, smackx-debug.jar
3. Write Gtalk Service Code.

Sending and Receiving Message using SMACK:

public class MyGtalkClient implements MessageListener {

public void processMessage(Chat chat,Message message) {
/*Callback method from MessageListener interface .
It is called when a message is received */

System.out.println("Received message: " + message.getBody());

public static void main(String [] args) throws XMPPException,IOException {

BufferedReader br = new BufferedReader(new InputStreamReader(;

/*Login to GTalk service*/
ConnectionConfiguration config = new ConnectionConfiguration (
XMPPConnection connection = new XMPPConnection(config);

connection.connect(); /* Connect to the XMPP server */

connection.login("gtalkid","gtalk pass");
/*Enter your username & password to login to the gtalk service */
Chat chat = connection.getChatManager().createChat(
your_friend_id",new MyGtalkClient());

System.out.println(" ****Welcome to MyGtalkClient**** ");
System.out.println("****Enter your message, one per line ."+
"To stop chat enter stop****");

while( !(msg=br.readLine()).equals("stop")) {
chat.sendMessage(msg); //Send the message

connection.disconnect() ; //Disconnect

This is a very basic example here your buddy is hard coded and you are initiating the chat.
I will write implementing a calculator bot in next part which will provide concepts of listening for a packet, process that packet and send result back to that user.


Mst Info said...

Thx aloot

this topic is very helpful

Siva said...

Just the link I was looking for. Thank You

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!