Send private message using facebook API

In the last tutorial of facebook API I have explained you  Share application request with facebook API

In this tutorial I will explain you how to send private message using facebook api.
First you need to create facebook application. To create facebook application go to this this link
After creating the facebook application you will get a application ID. Note down the ID you will need it later on. Now click on the setting and fill the required field. You will see the add platform click on it and select website and fill your website url.
In next step click on the app details and select the category to games and subcategory anything.
now click on status and review and click on the yes button to activate the application.

Now create a file facebook.php and copy and paste the below code

<html xmlns:fb="">
<script src=""></script>
<div id="fb-root"></div>
function message()
FB.init({appId: 'here your application ID', xfbml: true, cookie: true});
method: 'send',
link: '',
}, function(response){
<a href='#' onclick="message();"> send message</a>

Now run the facebook.php file and send message.
Hope this small tutorial of send private message using facebook API will help you.

  • Rishav

    Great article