使用Facebook API邀请朋友吗? [英] Using Facebook API to invite friends?

本文介绍了使用Facebook API邀请朋友吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的网站上单击邀请朋友"链接,然后单击该链接,您将获得一个Facebook对话框,要求您选择要邀请的朋友.然后,这些朋友会收到申请请求,Facebook电子邮件或至少一封邀请他们加入我的网站的贴子.

I want an "Invite Friends" link on my website where you click it and you get a Facebook dialog that asks you to choose which of your friends you'd like to invite. Those friends then either get an application request, Facebook email or at least a wall post inviting them to join my website.

我对执行此操作的正确方法有些困惑.现在看来,唯一不被弃用的方法是通过请求"对话框.因此,我像他们给出的示例一样调用FB.ui Javascript方法:

I'm a bit confused over what is the proper way to do this. It seems the only non-deprecated way now is through the Requests Dialog. So I call the FB.ui Javascript method like the example they give:

FB.ui({
    method: 'apprequests', 
    message: 'You should learn more about this awesome game.',
    data: 'tracking information for the user'
});

然后,被邀请者登录Facebook时将收到应用程序请求.当他们接受"该请求时,他们将被定向到我的Facebook画布应用程序,在该应用程序中,我读取了从Facebook传递来的初始请求ID,因此我知道这是关于什么的,然后我可以将用户重定向到我的网站了?我不喜欢这样,因为我现在必须学习如何构建canvas应用程序,但这是通过Facebook功能邀请朋友的正确方法吗?

Then the invitees will get application requests when they login to Facebook. When they "accept" that request, they'll be directed to my Facebook canvas application where I read the initial request id passed from Facebook so I know what this is about and then I guess I can redirect the user to my website? I don't like this as I now have to learn how to build a canvas application, but is this the proper way to have an invite friends through Facebook feature?

理想情况下,邀请朋友"按钮将调出Facebook朋友选择器(如果用户尚未登录FB,则请登录),然后在这些朋友的墙上发帖.发布的消息将有一个简单链接返回我的网站.这可能吗?

Ideally the invite friends button brings up the Facebook friend selector (or login if the user isn't logged in to FB yet) and then posts on those friends' walls. That message posted would have a simple link back to my website. Is this possible?

推荐答案

我遇到了同样的问题.尽管回答问题已经很晚了,但是它将对某人有所帮助.这就是为什么要回答这个问题.

I had same problem. Though it is very late for answering question, it will help somebody. That's why answering this question.

要发送邀请时,请调用此Javascript函数.

Call this Javascript function when want to send invitations.

function sendRequestViaMultiFriendSelector() {
    FB.ui({
        method: 'apprequests',
        message: "This message is displayed in invitation"
    },send_wall_invitation);

}

function send_wall_invitation(response) {
   // alert(response.to);
    var send_invitation_url=base_url+'send_invitation';
    jQuery.ajax({
        url:send_invitation_url,
        data:{
            to:response.to
            },
        dataType:"json",
        type: 'POST',
        success: function(data){
//            alert("");
        }

    })
}

发送由ajax邀请的朋友数组,然后为每个朋友发送帖子.

Sending array of friends invited by ajax and then send post for each friend.

<罢工> 我可以通过PHP API张贴在用户的好友墙上. 试试这个:

I can post on the user's friends walls via the PHP API. Try this :

$facebook->api('/[FRIEND_ID]/feed', 'post', array(
          'message' => 'test message',
          'link' => 'http://google.com',
          'name' => 'test name',
          'caption' => 'test caption',
          'description' => 'test long description',
      ));

现在无法在2013年2月之前在朋友墙上发帖.

Posting on friends wall is not possible now by Feb 2013. How to post on a friend's Timeline after the February 2013 migration takes effect?

$facebook->api('/[Loggedin_user_id]/feed', 'post', array(
              'message' => 'test message',
              'link' => 'http://google.com',
              'name' => 'test name',
              'caption' => 'test caption',
              'description' => 'test long description',
          ));

但是用户仍然可以在他的墙上发帖,并在帖子或图片中标记朋友.

But user can still post on his wall and tag friends in post or image.

请参阅:

  1. 从应用程序上传照片并发布它到用户的墙
  2. 标记朋友的照片
  1. FB upload photo from application and post it to user's wall
  2. Tags friends photo

这篇关于使用Facebook API邀请朋友吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆