What's new? | Help | Directory | Sign in
Google
                
Search
for
Updated Jun 27, 2008 by api.kur...@google.com
SendingMessages  
Sending messages

0.8 - Handling responses

Handle responses by supplying a callback function to the sendMessage call:

function sendEmail() {
  var params = [];
  params[opensocial.Message.Field.TITLE]="Hola!";
  var body="Como estas?";   
  var message = opensocial.newMessage(body, params);
  var recipient = opensocial.DataRequest.PersonId.OWNER;
  opensocial.requestSendMessage(recipient, message, callback);
}

function callback(data) {
  if (data.hadError()) {
    alert(data.getErrorCode());
  } else {
    alert("Ok");
  }
};

sendEmail();

Comment by rajaveernapu, Jul 23, 2008

this code is working fine but when i pass the "recipient" as an array of ids it is throwing javascript error."d has no properties"

can any one help me here

Comment by apija...@google.com, Jul 23, 2008

Sign in to add a comment