How to send a message to a user who is offline using开发者_开发问答 Facebook API?
Since there's no details, I'm assume you'll be using PHP-SDK. So just grant the publish_stream
permission and use something like:
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'APP_ID',
'secret' => 'APP_SECRET',
'cookie' => true,
));
$post_id = $facebook->api("/USER_ID/feed","POST",array("message"=>"Hello Offline!"));
if(!empty($post_id["id"]))
echo $post_id["id"];
Irrespective of user online or offline, you can not send message to a user. If you have offline_access and read_mailbox permissions you can read mails.
But there are few workaround for this. One is to send a normal email as example@facebook.com. This will work only if that user has enabled Facebook email for the account.
Other-one is to write on their wall. But this is not private.
精彩评论