I have already included this in my page html:
<div id="fb-root"></div>
<script type="text/javascript" language="javascript">
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
And that I have facebook-like box
in my page already, however I need to do now a way to send messages to email using the Facebook Javascript API. Is this configuration enough to call a "send message"?
I have a custom HTML form in which when I click send I like it to send a message on my Facebook page's behalf. I have my page up in Facebook.
I will answer your questions separately:
If it can be a simple message to a facebook user, you have to use the FB.ui send dialog: https://developers.facebook.com/docs/reference/dialogs/send/ That´s pretty much the only way for you, you can just try putting in an email address in the popup. According to the documentation, it should work.
That´s where even the send dialog will not work anymore. You cannot prefill the message parameter, what you want would only be possible with the PHP SDK of Facebook. But then again: Why would you program the textfield on your own, if Facebook already offers everything in that dialog?
Without that dialog, there is no way to just send a message in the background without a server side language like PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With