If you've visited the Live Alerts developer site then you know that Live Alerts comes in two flavors, the SDK and a simple web interface where you supply a link to your RSS feed. The latter is quite useful for offering your users a way to subscribe to your RSS feed(s) and receive alerts via their mobile, IM or email when your feed is updated. However, the SDK can be used to develop customized alerts, that is, you can programmatically send alerts to groups or even individual users at will, under any circumstance.

If you only wish to alert your users when your blog is updated, then by all means, make use of the Live Alerts for RSS Feeds, however, if you wish to deliver updates to your users that, aren't available via RSS, then the Live Alerts SOAP web service(s) are what the doctor ordered. The service is awesome and actually quite easy to work with. Keep in mind that the SDK documentation supplied by Microsoft isn't quite as complete as, say the Virtual Earth documentation, nevertheless, the information is there! It may also be useful to take a peak at the WSDL (Web Service Definition Language) file downloaded into Visual Studio when the web service is registered as a reference.

What I'm going to do now is present you some "gotchas" when working with the SDK.

Message Headers and Identification

Prior to sending any request to the Live Alerts web service endpoint you must build the request header object and an identification object. The header object is of type RecServicesHeader and the identification object is of type RecServicesIdentification. It seems simple enough, however the "gotcha" is that the message service and subscription web service both use the same object name, thus they should be referenced via the fully qualified name, that is, namespace.objectname. This is fine, however, this also means that any Live Alerts wrapper that we build must take this into account. In the Alerting Your Users With Live Alerts and ASP.NET AJAX tutorial we took the easy way out and simply built two methods, as shown below.

Subscription service:

image

Message service:

image

Note that Live.Alerts is the namespace the web service was registered with when referenced in Visual Studio.

Sending Group Messages

First and foremost, group messages are sent using the GroupDeliver() method exposed by the Message web service. This method accepts, as a parameter, an object of type RecServicesGroupMessage, which defines the message to be sent, that is, the content of the message, recipients, etc. When sending group messages, the fromContacts property of the RecServicesGroupMessage object must be supplied, this is of type RecServicesContact and should simply define the transport type and the from username, as shown below.

image

When sending group messages, this is the only required data, however, if messages are to be delivered to users, the to property must be specified and should be the registered user ID of the recipient. Finally, the RecServicesGroupMessage object should be constructed, as follows.

image

All fairly simple, however what you should be aware of is that the content property defines the plain-text content, that is, no HTML tags are supported and the messengerMessage and emailMessage properties are used to define the email and messenger messages respectively. These messages should be enclosed in <p></p> tags, that is:

<p>This is an email message.</p>

If the tags are omitted, the Live Alerts service will consider the markup to be malformed and the plain-text property will be used. Finally, the "gotcha" is that content by endpoint must be enabled for the email and messenger message to be delivered. If this isn't enabled, the plain-text message will be delivered. You should email the Live Alerts support requesting that the content by endpoint be enabled. This was something that got me scratching my head, I was checking and rechecking my code and couldn't figure out why the email message wasn't be delivered, as expected.

For further details, checkout my tutorial Alerting Your Users With Live Alerts and ASP.NET AJAX.