# facebook.notifications.sendRequest related question

**URL:** <https://www.ruby-forum.com/t/facebook-notifications-sendrequest-related-question/108010>\
**Category:** Rails\
**Created:** [June 28, 2007, 12:06pm UTC](https://www.ruby-forum.com/t/facebook-notifications-sendrequest-related-question/108010 "2007-06-28T12:06:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arjun\_ghosh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@arjun\_ghosh](https://www.ruby-forum.com/u/arjun_ghosh)\
**Post date:** [June 28, 2007, 12:06pm UTC](https://www.ruby-forum.com/t/facebook-notifications-sendrequest-related-question/108010/1 "2007-06-28T12:06:01Z")

</div>

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](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](http://api.faceb)  
[ook.com/1.0/](http://ook.com/1.0/) [http://api.facebook.com/1.0/facebook.xsd](http://api.facebook.com/1.0/facebook.xsd)" xmlns:xsi="  
[http://www.w3](http://www.w3).  
org/2001/XMLSchema-instance" xmlns=“[http://api.facebook.com/1.0/](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

---

<div class="post-metadata">

**Author:** ![arjun\_ghosh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@arjun\_ghosh](https://www.ruby-forum.com/u/arjun_ghosh)\
**Post date:** [June 28, 2007, 2:06pm UTC](https://www.ruby-forum.com/t/facebook-notifications-sendrequest-related-question/108010/2 "2007-06-28T14:06:52Z")

</div>

> ```
> 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](http://developers.facebook.com/documentation.php?v=1.0&method=notifications.sendRequest))  
the :content parameter should contain FBML.

---

<div class="post-metadata">

**Author:** ![arjun\_ghosh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@arjun\_ghosh](https://www.ruby-forum.com/u/arjun_ghosh)\
**Post date:** [June 29, 2007, 8:30am UTC](https://www.ruby-forum.com/t/facebook-notifications-sendrequest-related-question/108010/3 "2007-06-29T08:30:41Z")

</div>

On Jun 28, 3:06 pm, David F. \<rails-mailing-l…@andreas-  
[s.net](http://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/](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…

---

<div class="post-metadata">

**Author:** ![arjun\_ghosh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@arjun\_ghosh](https://www.ruby-forum.com/u/arjun_ghosh)\
**Post date:** [July 4, 2007, 5:08pm UTC](https://www.ruby-forum.com/t/facebook-notifications-sendrequest-related-question/108010/4 "2007-07-04T17:08:32Z")

</div>

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](http://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/](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…

---

<div class="post-metadata">

**Author:** ![arjun\_ghosh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@arjun\_ghosh](https://www.ruby-forum.com/u/arjun_ghosh)\
**Post date:** [July 4, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/facebook-notifications-sendrequest-related-question/108010/5 "2007-07-04T17:11:12Z")

</div>

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](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
