Question

I am trying to create an IM bot and I haven't been able to find the necessary resources.


UPDATE

There was an issue with Imified making gtalk bots not appear online (and not responding), it works now so I'm closing this.

This tutorial does work.


Original question not deleted for reference purposes

First, I did find a great tutorial on How to Write Your Own IM Bot, but it uses the IMified platform which looks dead (last blog post in septembre 2008, no feedback on their help forum, ...).

I did manage to create a beta bot using their service but as I can see in their help forum, it will never be online.

So, any one managed to do it?

Notes

I'm looking for something that would be:

  • Free
  • Works with PHP* or some free hosting solution (like IMified but that works)
  • Works for Google Talk (I don't really care about the other)

Of course, do post answers about any solution that doesn't fit these criteria, it might help.

*I have a Linux hosting plan on GoDaddy

Was it helpful?

Solution 2

Taken from the tutorial in case it ever disappears:

Step 1: Go to imified.com and request an invite. You should also give your bot a decent name because you can have just one bot per email address.

Step 2: An email with a secret key should arrive in your Inbox the next minute. Copy that key to the clipboard and go here to redeem that key.

Step 3: Now it's time to create a bot which is actually a simple script that resides on your public web server. It could be in PHP, Perl, Python or any other language. More here.

This is the source of the PHP script I wrote for the labnol IM bot - pretty self explanatory - it reads your message, gets the relevant data from Google Suggest and echoes it back to the IM window.

<?php   // Get all the related keywords from Google Suggest
    $u = "http://google.com/complete/search?output=toolbar";   $u = $u . "&q=" . $_REQUEST['msg'];

    // Using the curl library since dreamhost doesn't allow fopen
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $u);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $xml = simplexml_load_string(curl_exec($ch));
    curl_close($ch);

    // Parse the keywords and echo them out to the IM window
    $result = $xml->xpath('//@data');
    while (list($key, $value) = each($result))
    {
        echo $value ."<br>";
    }
?>

Step 4: Once your script is ready, put it somewhere on your web server and copy the full URI to the clipboard.

Now login to your imified account, paste the script URL and add that im bot your friends list. That's it.

OTHER TIPS

Google Talk uses jabber, where the protocol is called XMPP. A quick google search for "xmpp bot php" led me here. This should be enough for a start ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top