Capture details of Facebook message in application database
In my Facebook application I am displaying a **message window using FB.ui** { method: 'send' ...}. I would like to **capture the list of recipients** (stored in the 'recipitents []' hidden form field) as well as the **message text** in my **application database**.

Is there a way to do that?

Here's what I have come up with so far:

1. Dynamically **set the onclick attribute** in the <input name='publish' ... > DOM element (which corresponds to the Send button. So far I have been able to do that using the browser development tools (e.g. F12 in IE9) but not in code; it could be tricky since the dialog doesn't exist at load time). Unfortunately I haven't been able to define a Javascript function that was in the right scope (I thought there was only a global scope) for the onclick callback to find it.

2. **Construct** the Facebook Send dialog **from more elementary building block** (e.g., friend picker, send method invocation) so I 'own' the click event.

3. **Clone** the FB.ui() **code and modify** it to include additional parameters when calling the redirect url.

4. Require the user to include me in the To list (really only last resort), or default the 'to' field to the application's user id.

Finally, I expect to be able to call my web service from Javascript to record the message details in my application database.

Capture details of Facebook message in application database
===

In my Facebook application I am displaying a **message window using FB.ui** { method: 'send' ...}. I would like to **capture the list of recipients** (stored in the 'recipitents []' hidden form field) as well as the **message text** in my **application database**.

Is there a way to do that?

Here's what I have come up with so far:

1. Dynamically **set the onclick attribute** in the <input name='publish' ... > DOM element (which corresponds to the Send button. So far I have been able to do that using the browser development tools (e.g. F12 in IE9) but not in code; it could be tricky since the dialog doesn't exist at load time). Unfortunately I haven't been able to define a Javascript function that was in the right scope (I thought there was only a global scope) for the onclick callback to find it.

2. **Construct** the Facebook Send dialog **from more elementary building block** (e.g., friend picker, send method invocation) so I 'own' the click event.

3. **Clone** the FB.ui() **code and modify** it to include additional parameters when calling the redirect url.

4. Require the user to include me in the To list (really only last resort), or default the 'to' field to the application's user id.

Finally, I expect to be able to call my web service from Javascript to record the message details in my application database.
