I want to send notification from app via notification API to a user who has authenticated my app. Can anyone help me regarding it? Any help will be appreciated.
Lets say, I want user to get a notification when certain events happens in my app
Thanks in advance
I found its solution myself. Developer need to follow following steps:
Code:
require_once "facebook-php-sdk/facebook.php";
$facebook = new Facebook();
$app_id = YOUR_APP_ID;
$app_secret = YOUR_APP_SECRET;
$app_access_token = $app_id . '|' . $app_secret;
$response = $facebook->api( '/RECEIVER_USER_ID/notifications', 'POST', array(
'template' => 'You have received a new message.',
'href' => 'RELATIVE URL',
'access_token' => $app_access_token
) );
print_r($response);
Array
(
[success] => 1
)
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