Forum: Ruby on Rails facebook.notifications.sendRequest related question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2f515221472e537a7642f0ead9c7772c?d=identicon&s=25 arjun ghosh (Guest)
on 2007-06-28 12:06
(Received via mailing list)
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/v...
"
      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&amp;id=15483"}
</notifications_sen
drequest_response>} {text "\n"}>

Thanks and Regards
AG
690247bbedee9ee592827abfbc23f715?d=identicon&s=25 David Fitzgibbon (davyfitz)
on 2007-06-28 14:06
>       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...)
the :content parameter should contain FBML.
258b9e6c34849e1286236cc2c3ba1d0e?d=identicon&s=25 Marwan ALJubeh (Guest)
on 2007-06-29 08:30
(Received via mailing list)
On Jun 28, 3:06 pm, David Fitzgibbon <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...
0ab34d2b45720a2b4060b6d7abeef339?d=identicon&s=25 Guest (Guest)
on 2007-07-04 17:08
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 Fitzgibbon <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...
0ab34d2b45720a2b4060b6d7abeef339?d=identicon&s=25 awt (Guest)
on 2007-07-04 17:11
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/v...
> "
>       xml_return = fbsession.notifications_sendRequest(:to_ids =>
> '683262164', :type => @type, :content => @content, :image => @image,
> :invite
> => @invite)
> end
>
This topic is locked and can not be replied to.