Please guide me in the Google Open social API

2 views
Skip to first unread message

hem

unread,
Sep 15, 2008, 8:36:02 AM9/15/08
to Orkut Developer Forum
Dear Friends,
can you help me in google opensocial API, I am Creating one
application in that i want to send the message or scrap through my
application when the user click his/her friend and click on send
button.
Even i read documentation where there mention that google not
gave this permission to developer for sending messages and scrap.
There is only one way to send the message that is PostUpdate but in
this the application message are shown to all of his/her friends,
But we want that if he select only one friend the message shown
to only one person and if he/she select to all of them then it show to
all of his/her friends.

so, please give ur ideas and facts about opensocial API that how can i
send message, scrap to a particular person.

Highly appreciate your help
Thanks in advance....

Jason

unread,
Sep 16, 2008, 7:44:22 PM9/16/08
to Orkut Developer Forum
At the moment, there is no way to access or post scraps from an
application, although you can send private messages using
opensocial.requestSendMessage. This blog entry has example code that
you can use to get started:

http://orkutdeveloper.blogspot.com/2008/05/new-users-and-new-interactions.html

If you want to send a message to a single person, just include the
OpenSocial ID of the user as the recipient. A dialog will be presented
to the user allowing him/her to send a private message to that person.
Depending on the recipient's settings, the message will appear in his/
her orkut inbox, email inbox, or both.

Let me know if you have any other questions on this.

- Jason

hem

unread,
Sep 25, 2008, 1:18:41 AM9/25/08
to Orkut Developer Forum
In my application, the user type message in a textarea which is
defined by me. I take that message in a variable and i want to show
that message on the message textbox if user want sending a message to
the recipients, not postupdate.

Means in my apps i want that, user have all the option to send a
message or postupdate on the option selection. So that user not type
same message again on message Block and textarea message automatically
copy on the message Block.

here

textarea is defined by me.
message Block is defined by google, on the call of following method.
opensocial.requestSendMessage(recipient, message);

With that i also want to show the sender image and funny Image to the
recipient.
In message the sender image is shown which is comes from the orkut
site, but the funny Image is not shown which is comes from our server.
Is that possible that the funnyImage is shown on message. Even in that
function i used a alert method that show funny image path.

Even I used following method also
params[opensocial.Message.Field.TITLE]="funny image source";
and
params[opensocial.Message.Field.BODY]="funny image source";
but not working.

Highly appreciate your help
Thanx in advance

On Sep 17, 4:44 am, Jason <apija...@google.com> wrote:
> At the moment, there is no way to access or post scraps from an
> application, although you can send private messages using
> opensocial.requestSendMessage. This blog entry has example code that
> you can use to get started:
>
> http://orkutdeveloper.blogspot.com/2008/05/new-users-and-new-interact...

Jason

unread,
Sep 25, 2008, 6:08:55 PM9/25/08
to Orkut Developer Forum
The requestSendMessage dialog is always going to appear and there is
no way to automatically insert any text into the message block, even
though you can stick it in the BODY field. But users will still see a
large, empty text area to write in, even when their text is copied to
the message body, so you may only choose to show the text input when
users choose "Activity." When they choose "Message," display the
requestSendMessage dialog instead -- either way, they only have to
type their text once.

Can you post the content of the activity that you're trying to display
(including the image URL from your server) and explain how it's not
working (e.g. error, unexpected output, etc.). Thanks.

- Jason
Message has been deleted
Message has been deleted

hem

unread,
Sep 26, 2008, 9:54:11 AM9/26/08
to Orkut Developer Forum

Thanx for reply Mr. Jason,

In my apps there is one strange thing is happens when i run that apps
in orkut, it gave me undefined result,
when i open firebug it gave me error

In Param Tabs errors:---

authz
bypassSpecCache
container orkut-sandbox
contentType TEXT
gadget http://hosting.gmodules.com/ig/gadgets/file/blah/blah.xml
getSummaries false
headers
httpMethod GET
numEntries 3
postData
refresh 3600
signOwner true
signViewer true
st
url http://mycompany/FunnyMoneyGifts/GiftItems.action

In Headers Tabs errors:----

Response Headers

Cache-Control no-cache, no-store, max-age=0, must-
revalidate
Pragma no-cache
Expires Fri, 01 Jan 1990 00:00:00 GMT
Content-Type text/html; charset=UTF-8
Content-Encoding gzip
Date Fri, 26 Sep 2008 10:43:47 GMT
X-Content-Type-Options nosniff
Content-Length 117
Server GFE/1.3

Request Headers

Host
j39png9jh9q1r97d6s9bce8s9suv4dog.sandbox.orkut.gmodules.com
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US;
rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2
Accept text/html,application/xhtml
+xml,application/
xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
Referer gave me some data which open my apps


Even this project working perfectly till yesterday now it gave me
error.
Whereas the same code implemented on Hi5 and it perfectly working.

I have also check my response page which is perfectly working in my
server and also check through the http://validator.w3.org site to find
out that there is any html error, but it gave me no error and no
warning.

With that i also paste a few code of my xml file may be it helps you
to find out the problem.......

function makeRequest(url) // passing the URL
{
var params = {};
alert(url); // it gave me proper result
params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.GET;
gadgets.io.makeRequest(url, responseData, params);

}

function responseData(obj)
{
alert(obj.text); // it gaves me undefined.
document.getElementById("funnyImageDisplay").innerHTML = obj.text;

}

with that this is the message sending code..................
function sendMessage()
{
thumb = viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);
var html = "<img src='" + thumb + "'/>"+" send a Funny Gifts "+"<img
src='" + funnyImagePath + "'/>";

alert("The HTML value is :-- \n"+html); \\ it show me user and
funnyimage path properly...

var params = [];
var titleName = viewer.getDisplayName()+" Send Message to you through
Funny Money Gift Application ..!";

params[opensocial.Message.Field.TITLE]=titleName; //
titlename put in Title
var body="This is Funny Images for just for kidding.. Don't Mind it.";

var textarea=document.getElementById("messageText").value;
alert(textarea); // gave me same message...

// here we add the user image and funnyimagepath url in body
body += "<img src='" + thumb + "'/>"+" send a Funny Gifts "+"<img
src='" + funnyImagePath + "'/>";

// here thumb is user image which is shown in the message dialog box..
// funnyImagePath is the path of funny image which located in our
server..

body += "with Message is "+textarea;

var message = opensocial.newMessage(body, params);

var recipient = opensocial.DataRequest.Group.VIEWER_FRIENDS;
alert("The recipient are "+recipient);
opensocial.requestSendMessage(recipient, message);

}


On Sep 26, 4:12 pm, hem <hemantfu...@gmail.com> wrote:
> Thanx for reply Mr. Jason,
>
> In my apps there is one strange thing is happens when i run that apps
> in orkut, it gave me undefined result,
> when i open firebug it gave me error
>
> In Param Tabs errors:---
>
> authz
> bypassSpecCache
> container               orkut-sandbox
> contentType     TEXT
> gadget          http://hosting.gmodules.com/ig/gadgets/file/blah/blah.xml
> getSummaries    false
> headers
> httpMethod      GET
> numEntries      3
> postData
> refresh         3600
> signOwner       true
> signViewer      true
> st
> url    http://mycompany/FunnyMoneyGifts/GiftItems.action
>
> In Headers Tabs errors:----
>
> Response Headers
>
> Cache-Control                   no-cache, no-store, max-age=0, must-
> revalidate
> Pragma                          no-cache
> Expires                         Fri, 01 Jan 1990 00:00:00 GMT
> Content-Type                    text/html; charset=UTF-8
> Content-Encoding                gzip
> Date                                    Fri, 26 Sep 2008 10:43:47 GMT
> X-Content-Type-Options  nosniff
> Content-Length                  117
> Server                          GFE/1.3
>
> Request Headers
>
> Host
> j39png9jh9q1r97d6s9bce8s9suv4dog.sandbox.orkut.gmodules.com
> User-Agent                  Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
> rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2
> Accept                      text/html,application/xhtml+xml,application/
> xml;q=0.9,*/*;q=0.8
> Accept-Language     en-us,en;q=0.5
> Accept-Encoding     gzip,deflate
> Accept-Charset              ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive                          300
> Connection                  keep-alive
> Refererhttp://j39png9jh9q1r97d6s9bce8s9suv4dog.sandbox.orkut.gmodules.com/ga...
>
> Even this project working perfectly till yesterday now it gave me
> error.
> Whereas the same code implemented on Hi5 and it perfectly working.
>
> I have also check my response page which is perfectly working in my
> server and also check through thehttp://validator.w3.orgsite to find
> out that there is any html error, but it gave me no error and no
> warning.
>
> With that i also paste a few code of my xml file may be it helps you
> to find out the problem.......
>
> function makeRequest(url)      // passing the URL
> {
> var params = {};
> alert(url);                             // it gave me proper result
> params[gadgets.io.RequestParameters.METHOD] =
> gadgets.io.MethodType.GET;
> gadgets.io.makeRequest(url, responseData, params);
>
> }
>
> function responseData(obj)
> {
> alert(obj.text);         // it gaves me undefined.
> document.getElementById("funnyImageDisplay").innerHTML = obj.text;
>
> }
>
> with that this is the message sending code..................
>  function sendMessage()
> {
> thumb = viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);
> var html = "<img src='" + thumb + "'/>"+" send a Funny Gifts "+"<img
> src='" + funnyImagePath + "'/>";
>
> alert("The HTML value is :-- \n"+html);    \\ it show me user and
> funnyimage path properly...
>
> var params = [];
> var titleName = viewer.getDisplayName()+" Send Message to you through
> Funny Money Gift Application ..!";
>
> params[opensocial.Message.Field.TITLE]=titleName;                      //
> titlename put in Title
> var body="This is Funny Images for just for kidding.. Don't Mind it.";
>
> var textarea=document.getElementById("messageText").value;
> alert(textarea);        // gave me same message...
>
> // here we add the user image and funnyimagepath url in body
> body += "<img src='" + thumb + "'/>"+" send a Funny Gifts "+"<img
> src='" + funnyImagePath + "'/>";
>
> // here thumb is user image which is shown in the message dialog box..
> // funnyImagePath is the path of funny image which located in our
> server..
>
> body += "with Message is "+textarea;
>
> var message = opensocial.newMessage(body, params);
>
> var recipient = opensocial.DataRequest.Group.VIEWER_FRIENDS;
> alert("The recipient are "+recipient);
> opensocial.requestSendMessage(recipient, message);

Jason

unread,
Sep 30, 2008, 1:14:47 PM9/30/08
to Orkut Developer Forum
Your source looks fine to me. Can you reply with the URL to your
complete specification? You mention that your application is working
correctly in hi5. Are you using <Optional feature="hi5"/> by any
chance? orkut is currently behaving unpredictably when two or more
<Optional/> elements are used, such as "content-rewrite", "hi5", and
"hi5-lifecycle" and I'm wondering if this is part of the problem. I'm
also interested in why your makeRequest is failing, since your syntax
looks good. Please reply with your URL and I'll take a closer look.
Thanks.

- Jason
> Accept                      text/html,application/xhtml
> +xml,application/
> xml;q=0.9,*/*;q=0.8
> Accept-Language     en-us,en;q=0.5
> Accept-Encoding     gzip,deflate
> Accept-Charset              ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive                          300
> Connection                  keep-alive
> Referer                  gave me some data which open my apps
>
> Even this project working perfectly till yesterday now it gave me
> error.
> Whereas the same code implemented on Hi5 and it perfectly working.
>
> I have also check my response page which is perfectly working in my
> > server and also check through thehttp://validator.w3.orgsiteto find
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages