14
Research Facebook CÔNG TY TNHH TOÀN CẦU XANH FACEBOOK API

Facebook 29082011 Final

  • Upload
    jellydn

  • View
    109

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Facebook 29082011 Final

Research Facebook

CÔNG TY TNHH TOÀN C U XANHẦ

FACEBOOK API

Page 2: Facebook 29082011 Final

Research Facebook

M c l cụ ụI. Muc đích.....................................................................................................................................................3

II. Nôi dung nghiên cưu..................................................................................................................................4

1. Facebook Concept...................................................................................................................................4

a) Social design....................................................................................................................................4

b) Social plugin....................................................................................................................................4

c) Open Graph protocol.....................................................................................................................10

d) Social Channel...............................................................................................................................11

e) Authentication................................................................................................................................11

III. Single single on.....................................................................................................................................13

IV. Invite friend...........................................................................................................................................13

V. Sharing content.........................................................................................................................................13

VI. PHP SDK vs Javascript SDK................................................................................................................13

Page 3: Facebook 29082011 Final

Research Facebook

I. Mu c đích

Tìm hiểu và nghiên cưu Facebook API về các tương tác của hệ thống JustLook với Facebook.Khả năng tích hợp giữa 2 hệ thống. Bên cạnh, tìm hiểu cách xây dựng 1 ưng dụng dựa trên facebook API, vấn đề tương tác giữa website với facebook. Các đưa thông tin từ trang của mình lên facebook, comment,like,…

STT Nôi dung nghiên c u ư Th i gianơ

1 Facebook Concept

2 Single Sign On

3 Invite friend

4 Sharing content

4 PHP SDK vs Javascript SDK

Page 4: Facebook 29082011 Final

Research Facebook

II. Nô i dung nghiên cưu

1. Facebook Concept

a) Social designThiết kế social lấy kinh nghiệm xã hội làm trung tâm. Nó gồm có 3 thành phần chính là cộng đồng(community), trao đổi (conversation) và định danh.

Community : Chỉ đến những người ta biết và ảnh hưởng đến quyết định của ta.

Conversation : Những tương tác của chúng ta với cộng đồng

Identity : xác định ta là ai và mọi người thấy ta như thế nào.

b) Social plugin

Facebook có hỗ trợ nhiều plugin như sau :

1.b.1. Like Button

Page 5: Facebook 29082011 Final

Research Facebook

Nút Like khi tích hợp vào trang web của người dùng se cho phep người dùng trang web đó tương tác lên nó như một trang của facebook. Khi số lượng like nhiều thì có nghi thông tin đó rất hữu ích. Đồng thời, khi nhấn nút like thì thông tin về trang được gởi lên trên Wall của người dùng trên facebook, bao gồm các thông tin sau:

Favicon của trang

Meta description của trang

Link đến trang

1.b.2. Send Button

Nút Send Button allows cho phep người dùng gởi thông tin đến một người bạn trên facebook, nhóm trên facebook hoăc email nào đó.

Page 6: Facebook 29082011 Final

Research Facebook

1.b.3. Comments

Comments Box is a social plugin that enables user commenting on your site. Features include moderation tools and distribution.

Social Relevance: Comments Box uses social signals to surface the highest quality comments for each user. Comments are ordered to show users the most relevant comments from friends, friends of friends, and the most liked or active discussion threads, while comments marked as spam are hidden from view.

Distribution: Comments are easily shared with friends or with people who like your Page on Facebook. If a user leaves the “Post to Facebook” box checked when she posts a comment, a story appears on her friends’ News Feed indicating that she’s made a comment on your website, which will also link back to your site.

Page 7: Facebook 29082011 Final

Research Facebook

1.b.4. Activity Feed

The Activity Feed plugin displays the most interesting recent activity taking place on your site. Since the content is hosted by Facebook, the plugin can display personalized content whether or not the user has logged into your site. The activity feed displays stories when users like content on your site, when users share content from your site in Facebook or if they comment on a page on your site in the Comments box. If a user is logged into Facebook, the plugin will be personalized to highlight content from their friends. If the user is logged out, the activity feed will show recommendations from across your site, and give the user the option to log in to Facebook.

The plugin is filled with activity from the user's friends. If there isn't enough friend activity to fill the plugin, it is backfilled with recommendations. If you set the recommendations param to true, the plugin is split in half, showing friends activity in the top half, and recommendations in the bottom half. If there is not enough friends activity to fill half of the plugin, it will include more recommendations.

1.b.5. Recommendations

Recommendations plugin đưa ra những gợi y cho người dùng về các thông tin của trang.

Page 8: Facebook 29082011 Final

Research Facebook

1.b.6. Like Box

Like Box cung giống như Like button và kem theo các thông tin hoạt động gần đây của trang.

Page 9: Facebook 29082011 Final

Research Facebook

1.b.7. Login Button

Login Button hiển thị hình ảnh của bạn của bạn đã đăng ky và đăng nhâp tại site.

Page 10: Facebook 29082011 Final

Research Facebook

1.b.8. Registration

Registration plugin cho người dùng đăng ky tại site với thông tin của tài khoản trên Facebook.

Page 11: Facebook 29082011 Final

Research Facebook

c) Open Graph protocol

Open graph protocol cho phep một trang web như một đối tượng của social graph. Trang web đó se có đầy đủ chưc năng như 1 Facebook page. Bằng cách thêm thẻ tag và nút Like vào trang web thì mình se co một trang tích hợp như là của Facebook page. Lấy ví dụ là một trang movie ở dưới

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:og="http://ogp.me/ns#"

xmlns:fb="http://www.facebook.com/2008/fbml">

<head>

<title>The Rock (1996)</title>

<meta property="og:title" content="The Rock"/>

<meta property="og:type" content="movie"/>

<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>

<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>

<meta property="og:site_name" content="IMDb"/>

<meta property="fb:admins" content="USER_ID"/>

<meta property="og:description"

content="A group of U.S. Marines, under command of

a renegade general, take over Alcatraz and

threaten San Francisco Bay with biological

weapons."/>

...

</head>

...

</html>

Open Graph protocol yêu cầu thuộc tính sau:

og:title – Tiêu đề của đối tượng.

og:type – Loại đối tượng (xem)

og:image – Hình ảnh hiển thị

og:url – URL của trang

Để quản lí trang, mình phải gắn trang đó với tài khoản facebook của mình.

<meta property="fb:admins" content="USER_ID1,USER_ID2"/>

Hoăc để kết nối trang của bạn với 1 ưng dụng facebook thong qua app_id của bạn.

Page 12: Facebook 29082011 Final

Research Facebook

<meta property="fb:app_id" content="1234567"/>

d) Social Channel

Social channel là những kênh mà giúp bạn có thể chia sẻ thong tin của bạn đến với bạn be thong qua facebook.

1.d.1. News Feed

Mỗi khi bạn đăng nhâp vào facebook là thấy được những câp nhât mới nằm ở trong phần này. Có một số cách để đưa thong tin lên đây là : Feed Dialog, Feed Graph object và Like Button.

1.d.2. Request

Là cách ưng dụng cho phep người dung mời bạn be sử dụng tham gia vào ưng dụng. Có 2 cách tạo ra invite là người dùng và ưng dụng.

Người dùng : tương tác trên dialog và chọn friend để invite (http://developers.facebook.com/blog/post/453)

Ứng dụng : chỉ invite khi người dùng đã cho phep (authorization) và send request bằng cách sử dụng facebook api.

e) Authentication

Facebook sử dụng OAuth 2.0 protocol cho mục đích authentication và authorization. Facebook hỗ trợ nhiều cách để tích hợp.

Page 13: Facebook 29082011 Final

Research Facebook

1.e.1. User login

1.e.2. App Login

1.e.3. Page Login

Page 14: Facebook 29082011 Final

Research Facebook

III. Single single on

Với plugin của Facebook hay Facebook API, ta dê dàng cho phep người dùng đăng ky tại trang của mình với thông tin của tài khoản facebook hoăc đăng nhâp vào trang của mình bằng tài khoản facebook.

IV. Invite friend

Sử dụng facebook API để invite friend tham gia vào trang của mình

V. Sharing content

Chia sẻ nội dung từ trang mình lên facebook qua nhiều cách : like button, send button, ...

VI. PHP SDK vs Javascript SDK

Có 2 cách để sử dụng Facebook API qua là qua PHP SDK hoăc qua Javascript SDK. Nếu như sử dụng nhằm mục đích tương tác đơn giản, không qua sử lí server thì dùng Javascript SDK. Con không thì sử dụng PHP SDK.