All Projects → mweibel → Facebook.ex

mweibel / Facebook.ex

Licence: mit
Facebook Graph API Wrapper written in Elixir

Programming Languages

elixir
2628 projects

Labels

Projects that are alternatives of or similar to Facebook.ex

Flutter Reaction Button
Flutter reaction button plugin it is fully customizable widget such as Facebook reaction button
Stars: ✭ 111 (-14.62%)
Mutual labels:  facebook
Faitagram
(Doesn't work anymore)
Stars: ✭ 117 (-10%)
Mutual labels:  facebook
Sharer.js
🔛 🔖 Create your own social share buttons. No jquery.
Stars: ✭ 1,624 (+1149.23%)
Mutual labels:  facebook
Flutter auth buttons
Flutter buttons for social platforms
Stars: ✭ 114 (-12.31%)
Mutual labels:  facebook
Flexlib
FlexLib是一个基于flexbox模型,使用xml文件进行界面布局的框架,融合了web快速布局的能力,让iOS界面开发像写网页一样简单快速
Stars: ✭ 1,569 (+1106.92%)
Mutual labels:  facebook
Facebook
📨 Facebook Notifications Channel for Laravel
Stars: ✭ 120 (-7.69%)
Mutual labels:  facebook
Tkkeyboardcontrol
TKKeyboardControl adds keyboard awareness and scrolling dismissal (like iMessages app) to any view with only 1 line of code for Swift.
Stars: ✭ 110 (-15.38%)
Mutual labels:  facebook
Botkit
Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
Stars: ✭ 10,555 (+8019.23%)
Mutual labels:  facebook
Facebook Video Downloader
Facebook Video Downloader in PHP
Stars: ✭ 117 (-10%)
Mutual labels:  facebook
Concierge
Modular chat bot. (Karma + Sassy + Hubot) * (Discord + Facebook + Messenger + Slack + Skype + Telegram + Hipchat + ...) = Concierge
Stars: ✭ 121 (-6.92%)
Mutual labels:  facebook
Ui Mention
Facebook-like @mentions for text inputs built around composability
Stars: ✭ 115 (-11.54%)
Mutual labels:  facebook
Draft Js Typeahead
Typeaheads for Draft.js inspired by Facebook.com 🔭
Stars: ✭ 117 (-10%)
Mutual labels:  facebook
Laravel Facebook
A Facebook bridge for Laravel
Stars: ✭ 120 (-7.69%)
Mutual labels:  facebook
Deepface
Keras implementation of the renowned publication "DeepFace: Closing the Gap to Human-Level Performance in Face Verification" by Taigman et al. Pre-trained weights on VGGFace2 dataset.
Stars: ✭ 113 (-13.08%)
Mutual labels:  facebook
Facebook audience network
Flutter Facebook Audience Network
Stars: ✭ 122 (-6.15%)
Mutual labels:  facebook
Spring Webmvc Pac4j
Security library for Spring Web MVC: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 110 (-15.38%)
Mutual labels:  facebook
Facebook adblock
An open-source Ad Blocker for Facebook™
Stars: ✭ 118 (-9.23%)
Mutual labels:  facebook
Assent
Multi-provider framework in Elixir
Stars: ✭ 126 (-3.08%)
Mutual labels:  facebook
React File Drop
React component for Gmail or Facebook -like drag and drop file uploader
Stars: ✭ 123 (-5.38%)
Mutual labels:  facebook
Fbreaction
Demonstration for blog post
Stars: ✭ 121 (-6.92%)
Mutual labels:  facebook

facebook.ex

Build Status

Facebook Graph API Wrapper written in Elixir. (documentation)

Installation

Add facebook.ex as a dependency in your mix.exs file.

defp deps do
  [{:facebook, "~> 0.24.0"}]
end

After you are done, run this in your shell to fetch the new dependency:

$ mix deps.get

Configuration

You can configure facebook.ex in your mix config.exs (or, if you're using the Phoenix Framework, in your config/dev.exs|test.exs|prod.exs, respectively) with the following keys, which state the library defaults:

config :facebook,
  app_id: nil,
  app_secret: nil,
  app_access_token: nil,
  graph_url: "https://graph.facebook.com",
  graph_video_url: "https://graph-video.facebook.com",
  request_conn_timeout: nil,
  request_recv_timeout: nil

For graph_url and video_graph_url, Facebook automatically uses the oldest active Graph API version available if you don't specify a version in the url. You may use versioned urls to pin your calls to a specific API versions (recommended), e.g. like so:

  graph_url: "https://graph.facebook.com/v2.11",
  graph_video_url: "https://graph-video.facebook.com/v2.8"

Note that you must not end the urls with a slash or the requests will fail (Facebook will report an error about unknown url components)!

app_id, app_secret and app_access_token do not need to be supplied if you are using no Graph API calls that require them (e.g. payment calls).

If you supply the app_secret, an appsecret_proof will be submitted along with the Graph API requests. The app_secret can be changed (or set) at runtime using Facebook.set_app_secret("<app secret>").

You can also configure facebook.ex library in runtime using {:system, _} tuples:

config :facebook,
  app_id: {:system, "APP_ID"},
  app_secret: {:system, "APP_SECRET"},
  app_access_token: {:system, "APP_ACCESS_TOKEN"},
  graph_url: {:system, "GRAPH_URL"},
  graph_video_url: {:system, "GRAPH_VIDEO_URL"},
  request_conn_timeout: {:system, :integer, "REQUEST_CONN_TIMEOUT"},
  request_recv_timeout: {:system, :integer, "REQUEST_RECV_TIMEOUT"}

Note that if you use {:system, _} (or {:system, :integer, _}) tuple but don't provide the corresponding environment variable application will crash on startup to prevent unexpected behaviour later.

Usage

  1. Register an application on developer.facebook.com
  2. Get an access_token from Facebook's Access Token Tool

Then you can get started with code.

Start an iex shell in your project folder:

$ iex -S mix

Then try some API calls:

iex(1)> Facebook.me("first_name", "ACCESSTOKEN")
{:ok, %{"first_name" => "Michael"}} # <--- that's the return value

iex(2)> Facebook.object_count(:likes, "262588213843476_801732539929038", "ACCESSTOKEN")
{:ok, 48} # <--- that's the return value

Contributing

We encourage contribution from anyone! If you've got an improvement to the documentation or feature you've implemented, please open a pull request. This project uses credo for code analysis. Running mix credo will give you a nice output which will tell you if any of the changes you've made aren't consistent with the rest of our codebase.

The Facebook Graph API is fairly large and as such we're not using every facet of it, so if you're not seeing an edge that is handled, please report an issue or open a pull request to add it.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].