Codeigniter facebook send notification

Hello when i was trying to find how to send a notification to a user from a facebook app i found many solutions but it was difficult to figure what was going on.
So at the end i found the solution.
First you need a facebook application, or with javascript sdk or with php sdk. After that you must take the application user id when the user like your app and allow your app.
After that you must download facebook SDK. Facebook link codeigniter.
You put the files exactly where it tells you and you insert in the config files the facebook app key and facebook secret key.
After that in a model where you will call to do the notification you must put

$this->load->library('Facebook',array('appId' => $appId,
'secret' => $secret,
'cookie' => true

$facebook = new Facebook(
array(‘appId’ => $appId,
‘secret’ => $secret,
‘cookie’ => true

$template = $notification_text;

$param = array(
‘template’ => $template,
‘href’ => ‘’,
‘access_token’ => $facebook->getAccessToken(),

try {
$facebook->api(“/”.$user_facebook.”/notifications”, “POST”, $param);

} catch (Exception $e) {
// an error occurred
echo $e->getMessage();

where $user_facebook is the app user id of the user that you must have it to send the notification. Not the graph user id.
The template is the message you want to send to the person.

So that’s it. You can now post to every user that you have in your application