Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how send message facebook friend through graph api using Accessstoken

Can anyone help me to send message to facebook friends using graph api.

I tried

$response = $facebook->call_api("/me/feed", "post", "to=john","message=You have a Test message"); 

It's not working. I have the accesstoken of the user in my hand.only I am confused on sending process.

like image 690
JAMES Avatar asked May 31 '10 11:05

JAMES


2 Answers

You can't send messages using a Facebook application. You used to be able to do that, but the (predictable?) colossal amount of abuse led to the revocation of this ability.

Provided Alice, your user, has given you the necessary extended permissions, you have the following options:

  • Post to Alice's wall on her behalf
  • Send email to Alice
  • Create events on behalf of Alice
    • invite Bob (not your user) to said events
  • Issue a request/invitation on behalf of Alice to Bob
  • Issue a request from the App to Alice
like image 194
Julio Santos Avatar answered Oct 08 '22 11:10

Julio Santos


You could open the Send Dialog in a popup.

 $parameters = array(     'app_id' => $facebook->getAppId(),     'to' => $facebookUserId,     'link' => 'http://google.nl/',     'redirect_uri' => 'http://my.app.url/callback'  );  $url = 'http://www.facebook.com/dialog/send?'.http_build_query($parameters);  echo '<script type="text/javascript">window.open('.json_encode($url).', ... 

For detailed options see: https://developers.facebook.com/docs/reference/dialogs/send/

like image 21
Bob Fanger Avatar answered Oct 08 '22 11:10

Bob Fanger