3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

FacebookSDKを使ってMessageを送信する方法

Last updated at Posted at 2013-11-17

FacebookのJavascriptSDKを使って、Message送信を実装する方法です。

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
    appId  : 'appID',
    status : true, 
    cookie : true,
    xfbml  : true  
});

function sendMessage(){
      FB.ui(
      { 
          method: 'send', 
          to: '送りたい相手のID',
          link: "https://developers.facebook.com",
          picture: "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/174597_20531316728_2866555_q.jpg"
      }, 
      function(param){
        //callback
      }
      );
}
</script>
<input type="button" value="sendMessage" onclick="sendMessage();">

FBのダイアログが出て、メッセージの内容を打ちこんで送信することができます。
注意: mobileのデバイスでは使えないみたいです。WebViewで使いたかった。。。iOSのアプリからFBのMessage送れる方法あるんであれば教えてほしいですm(__)m

参照: https://developers.facebook.com/docs/reference/dialogs/send/

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?