My favorites | Sign in
Google
                
Search
for
Updated Jun 27, 2008 by api.kurrik.g00g1e
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
Comment by saidigitals223, Jan 29, 2009

hayy where to paste this code??? in body tag ?? or in head tag???????

Comment by p.agnihotry, Jun 10, 2009

Hi, this code worked correctly some days back but is giving error "Unknown RPC Call" right now.. please suggest how this can be resolved. Thanks.


Sign in to add a comment