Facebook

Provides API wrappers for the Facebook Graph API

See: https://developers.facebook.com/docs/graph-api

Source

Summary

fanCount(page_id, access_token)

Get the count of fans for the provided page_id

init()

Callback implementation of :supervisor.init/1

me(fields, access_token)

Basic user infos of the logged in user (specified by the access_token)

myLikes(access_token)

Likes of the currently logged in user (specified by the access_token)

objectCount(scope, object_id, access_token)

Gets the number of elements that a scope has in a given object

objectCount(atom1, react_type, object_id, access_token)

Gets the number of reactions that an object has

page(page_id, access_token)

Basic page information for the provided page_id

page(page_id, access_token, fields)

Get page information for the specified fields for the provided page_id

pageFeed(scope, page_id, access_token, limit \\ 25, fields \\ "")

Gets the feed of posts (including status updates) and links published by this page, or by others on this page

pageLikes(page_id, access_token)

Deprecated: Please use fanCount instead

permissions(user_id, access_token)

Retrieves a list of granted permissions

picture(user_id, type, access_token)

A Picture for a Facebook User

setAppsecret(appsecret)

If you want to use an appsecret proof, pass it into set_appsecret:

start(type, args)

Start hook

start_link()

Supervisor start

Types

fields :: list

response :: {:json, HashDict.t} | {:body, String.t}

using_appsecret :: boolean

reaction :: :reaction

Functions

fanCount(page_id, access_token)

Specs:

Get the count of fans for the provided page_id

Example

iex> Facebook.fanCount("CocaColaMx", "<Your Token>")

See: https://developers.facebook.com/docs/graph-api/reference/page/

Source
init()

Callback implementation of :supervisor.init/1.

Source
me(fields, access_token)

Specs:

Basic user infos of the logged in user (specified by the access_token).

Example

iex> Facebook.me([fields: "id,first_name"], "<Your Token>")

See: https://developers.facebook.com/docs/graph-api/reference/user/

Source
myLikes(access_token)

Specs:

Likes of the currently logged in user (specified by the access_token)

Example

iex> Facebook.myLikes("<Your Token>")

See: https://developers.facebook.com/docs/graph-api/reference/user/likes

Source
objectCount(scope, object_id, access_token)

Gets the number of elements that a scope has in a given object.

An object stands for: post, comment, link, status update, photo.

If you want to get the likes of a page, please see fanCount.

Expected scopes:

  • :likes
  • :comments

Example

iex> Facebook.objectCount(:likes, "1326382730725053_1326476257382367", "<Token>")
2
iex> Facebook.objectCount(:comments, "1326382730725053_1326476257382367", "<Token>")
2

See: https://developers.facebook.com/docs/graph-api/reference/object/likes See: https://developers.facebook.com/docs/graph-api/reference/object/comments

Source
objectCount(atom1, react_type, object_id, access_token)

Specs:

Gets the number of reactions that an object has.

Expected type of reactions:

  • :haha
  • :wow
  • :thankful
  • :sad
  • :angry
  • :love
  • :none

Examples

iex> Facebook.objectCount(:reaction, :wow, "769860109692136_1173416799336463", "<Token>")
2
iex> Facebook.objectCount(:reaction, :haha, "769860109692136_1173416799336463", "<Token>")
12
iex> Facebook.objectCount(:reaction, :thankful, "769860109692136_1173416799336463", "<Token>")
33
Source
page(page_id, access_token)

Specs:

Basic page information for the provided page_id

Example

iex> Facebook.page("CocaColaMx", "<Your Token>")

See: https://developers.facebook.com/docs/graph-api/reference/page

Source
page(page_id, access_token, fields)

Specs:

Get page information for the specified fields for the provided page_id

Example

iex> Facebook.page("CocaColaMx", "<Your Token>", "id")

See: https://developers.facebook.com/docs/graph-api/reference/page

Source
pageFeed(scope, page_id, access_token, limit \\ 25, fields \\ "")

Gets the feed of posts (including status updates) and links published by this page, or by others on this page.

This function can retrieve the four types:

  • feed
  • posts
  • promotable posts (Admin permission needed)
  • tagged posts

A scope must be provided. It is a string, which represents the type of feed.

A limit of posts may be given. The maximum number that must be provided is 100.

Examples

iex> Facebook.pageFeed(:posts, "CocaColaMx", "<Your Token>")
iex> Facebook.pageFeed(:tagged, "CocaColaMx", "<Your Token>", 55)
iex> Facebook.pageFeed(:promotable_posts, "CocaColaMx", "<Your Token>")
iex> Facebook.pageFeed(:feed, "CocaColaMx", "<Your Token>", 55, "id,name")

See: https://developers.facebook.com/docs/graph-api/reference/page/feed

Source
pageLikes(page_id, access_token)

Deprecated: Please use fanCount instead.

Get the count of fans for the provided page_id

Example

iex> Facebook.pageLikes("CocaColaMx", "<Your Token>")

See: https://developers.facebook.com/docs/graph-api/reference/page/

Source
permissions(user_id, access_token)

Specs:

Retrieves a list of granted permissions

Example

iex> Facebook.permissions("<Some Id>", "<Your Token>")

See: https://developers.facebook.com/docs/graph-api/reference/user/permissions

Source
picture(user_id, type, access_token)

Specs:

A Picture for a Facebook User

Example

iex> Facebook.picture("<Some Id>", "small", "<Your Token>")

See: https://developers.facebook.com/docs/graph-api/reference/user/picture/

Source
setAppsecret(appsecret)

If you want to use an appsecret proof, pass it into set_appsecret:

Example

iex> Facebook.setAppsecret("appsecret")

See: https://developers.facebook.com/docs/graph-api/securing-requests

Source
start(type, args)

Start hook

Source
start_link()

Supervisor start

Source