facebook.notifications.sendRequest related question


#1

Hi,
Has any one successfully used facebook.notifications.sendRequest in
sending request in rails. If any one can throw any light it would be a
great
help. When ever i googled this i get only in PHP based. I am doing this

def invite
@type = “Super app”
@content = “TEST NOTIFICATION”
@invite = ‘invitation’
@image = "
http://photos-055.ak.facebook.com/photos-ak-sf2p/v77/96/17/683262164/t683262164_235055_6270.jpg
"
xml_return = fbsession.notifications_sendRequest(:to_ids =>
‘683262164’, :type => @type, :content => @content, :image => @image,
:invite
=> @invite)
end

I even checked the xml_return value and it seem OK as per the return xml
on
the face book document. Can any one help?
The return xml wrapped in Hapricot is the following…if this helps:-

#<Hpricot::Doc {xmldecl “<?xml version=\"1.0\" encoding=\"UTF-8\"?>”}
{text
“\n”
} {elem <notifications_sendrequest_response xsi:schemalocation="
http://api.faceb
ook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" xmlns:xsi="
http://www.w3.
org/2001/XMLSchema-instance" xmlns=“http://api.facebook.com/1.0/”> {text
“http:/
/www.facebook.com/send_req.php?from=683262164&id=15483”}
</notifications_sen
drequest_response>} {text “\n”}>

Thanks and Regards
AG


#2
  xml_return = fbsession.notifications_sendRequest(:to_ids =>

‘683262164’, :type => @type, :content => @content, :image => @image,
:invite
=> @invite)

I’ve only had a small play with the facebook api, but at first glance
I’ve noticed a couple of things that may be wrong. The :to_ids param
should contain an array of IDs, so [‘683262164’] instead of just
‘683262164’. Also according to the API docs
(http://developers.facebook.com/documentation.php?v=1.0&method=notifications.sendRequest)
the :content parameter should contain FBML.


#3

On Jun 28, 3:06 pm, David F. <rails-mailing-l…@andreas-
s.net> wrote:

the :content parameter should contain FBML.


Posted viahttp://www.ruby-forum.com/.

@invite could also be invalid, since the API documentation describes
it as a boolean, so use @invite = true instead…
However, your xml_return seems to be valid anyway, so all you need to
do is to redirect the user to the url sent inside the
<notifications_sendRequest_response> tag: “http://www.facebook.com/
send_req.php?from=683262164&id=15483”…
Also, I am not sure if sending an invitation to yourself works! It
probably should though.
You should probably use something like:
@redirect_url = xml_return.search(’/
notifications_sendrequest_response’).innerHTML

and then in the view, use the fb:redirect tag to redirect the user to
the invitation confirmation:
<fb:redirect url="<%= @redirect_url -%>"/>

Good Luck…


#4

Anybody know what is supposed to happen after users are redirected to
the URL returned?

Marwan ALJubeh wrote:

On Jun 28, 3:06 pm, David F. <rails-mailing-l…@andreas-
s.net> wrote:

the :content parameter should contain FBML.


Posted viahttp://www.ruby-forum.com/.

@invite could also be invalid, since the API documentation describes
it as a boolean, so use @invite = true instead…
However, your xml_return seems to be valid anyway, so all you need to
do is to redirect the user to the url sent inside the
<notifications_sendRequest_response> tag: “http://www.facebook.com/
send_req.php?from=683262164&id=15483”…
Also, I am not sure if sending an invitation to yourself works! It
probably should though.
You should probably use something like:
@redirect_url = xml_return.search(’/
notifications_sendrequest_response’).innerHTML

and then in the view, use the fb:redirect tag to redirect the user to
the invitation confirmation:
<fb:redirect url="<%= @redirect_url -%>"/>

Good Luck…


#5

Did you ever get this to work? I’m getting URL in response and
redirecting to it, but the account I’m inviting is not getting any
notifications of any kind.

arjun ghosh wrote:

Hi,
Has any one successfully used facebook.notifications.sendRequest in
sending request in rails. If any one can throw any light it would be a
great
help. When ever i googled this i get only in PHP based. I am doing this

def invite
@type = “Super app”
@content = “TEST NOTIFICATION”
@invite = ‘invitation’
@image = "
http://photos-055.ak.facebook.com/photos-ak-sf2p/v77/96/17/683262164/t683262164_235055_6270.jpg
"
xml_return = fbsession.notifications_sendRequest(:to_ids =>
‘683262164’, :type => @type, :content => @content, :image => @image,
:invite
=> @invite)
end