How to Develop and Publish a Windows Live Messenger Activity
Here is the tutorial that a lot of people have been waiting for since a few days ago, how to create your own personal Windows Live Messenger activity, publish it and release it so everyone can use it!
Firstly, it is not at all difficult to create a Messenger Activity. All it takes is a tiny amount of Javascript knowledge, and a PHP script to make, or one you've made already to intergrate it into. It is just as easy as making a normal PHP application, and then adding a couple of lines of Javascript to it!
In this tutorial, I am going to teach you just a few of the methods that are available in the Messenger Activity API - if you want to learn how to use some of the more powerful (and perhaps dangerous) ones, visit the Messenger API section on MSDN, at http://msdn2.microsoft.com/en-us/library/aa751024.aspx. To use the things, all you have to do is place the things between <script> tags. Now, lets go over how it works:
The Basics
Before you run any of the API commands, you have to define what section of commands it is in. For example, sending messages comes under the "channel" object and opening WLM dialog boxes comes under the "messenger" object. If you want to use the channel object, you define it like this:
Once you have done that, you can run the API commands. In this example, they will begin with myChannel, and then a dot, then the API command, and then the parameter in brackets.myChannel = window.external.Channel;
Commands
EnterIM
This is one of the commands that come under the channel object. What it does it puts a message of your choice into the message box of the person who is running the activity. Then they either have to press enter or click send to send to message to their contact. As I showed above, you have to define the channel object, and then run the command:
What will happen when this is used, is that the text "The text that is here will be put into the message box" will be put into the message box. This can be used dynamically, as any of the commands can, to send a PHP variable like this:myChannel = window.external.Channel;
myChannel.EnterIM("The text that is here will be put into the message box");
SendIMmyChannel = window.external.Channel;
myChannel.EnterIM("Your contact would like to share a file with you. You can download the shared file at <?php echo $file_url; ?>");
This is very similar to the above command, but instead of entering it into the text input box, it will be sent automatically, and if published using the Windows Live Messenger Activity Centre, it will appear as "Windows Live Messenger Activity Centre says:". Here is how to use it, including PHP variables.
Messenger.OptionsmyChannel = window.external.Channel;
myChannel.SendIM("A picture is available for you to view! To look at it, visit <?php echo $picture; ?>");
This command is different, and uses a different object to do it. When it is run, it opens the Windows Live Messenger options dialog, and opens it on a specific section if it is specified. It uses the "window.external.Messenger" object! Here is how you define it:
Then, from there, it works like most of the other commands! To open the Personal tab, use:myMessenger = window.external.Messenger;
And to open the General tab of the options, use:myMessenger = window.external.Messenger;
myMessenger.Options();
How to Make Your ActivitymyMessenger = window.external.Messenger;
page = 5;
myMessenger.Options(page);
Now you know how to use a lot of the Javascript, you need to implement it. You need to add it to the pages where you want things to happen, once you have customised it. If there is anything you would like to do, but I haven't said how, look on the MSDN link I said earlier, and it is likely to be in the "Technical Reference" section there. If you have read everything, it shouldn't be too difficult to use it how you want to - if you need some help, PM me and I'll help you as soon as I can.
Once you have added the code to where you need it, you are ready to test and publish it so that anyone who wants to can use it!
How to Publish and Test Your Activity
Now for the really fun bit - seeing if your new activity works properly! To get your activity added to the system, first you need to upload all the files you have made to your web hosting.
Next, visit www.tim-rogers.co.uk/activity, and type the name of the activity, the address of it and your name into the right boxes, then click Submit. Your activity has been added, and it is ready to be used by anyone who has the Activity Centre installed.
Now is for the moment of truth - testing your PHP script and the WLM functions. First, visit http://habboxforum.com/showthread.php?t=310634 and follow the instructions of how to install the XML activity file. Once you have installed it as you are told, open a WLM conversation and go into the Actions menu - a new option should have appeared between "Video" and "Start an Activity..." called "Start Windows Live Messenger Activity Centre". Click it, and then click OK in the next dialog box, and you will be brought to the page you saw earlier, but this time from within Windows Live Messenger. Click the name of your site that you added earlier, and then test whether what you did works.
If it doesn't work properly, then a script error may come up. If it doesn't, then it is another problem, and it'd be a good idea to compare your code to the examples in this tutorial. The script error, if it comes up, should give you information of what line of your code there's a problem, and what piece of Javascript the problem is with - look at it, then check for errors - if it has errored, there must be a problem with the coding. If it all works, congratulations on building a brilliant brand new Windows Live Messenger activity. If it doesn't, and you eventually give up, or want to change any of the information you entered, PM me on here, and I'll change it or delete it for you.
Thank you for reading the tutorial! I hope it helped you to create yourself an activity to be proud of! I'd like to thank Luckyrare for persauding me to make my first activity, and all the people that asked for a tutorial and liked the original activity, Uploadz Uploader. If you need any help with anything, send me a PM as I have said already - I'll try to get back to you as soon as I possibly can.






Reply With Quote
, can't keep up with your awesome projects and tutorials!




