mweibel / facebook.ex Goto Github PK
View Code? Open in Web Editor NEWFacebook Graph API Wrapper written in Elixir
Home Page: http://hexdocs.pm/facebook/
License: MIT License
Facebook Graph API Wrapper written in Elixir
Home Page: http://hexdocs.pm/facebook/
License: MIT License
I'm not using this library since a while now and that's also the reason why there's not much activity going on.
I'd be glad if someone could take over maintenance which uses the library.
Maybe @bugant?
Error, when using Facebook.me()
** (UndefinedFunctionError) undefined function :hmac.hexlify/2 (module :hmac is not available)
To get around this I needed to specify the github repo in mix.exs
I would like to add support for batch requests. I think this will necessitate some design changes. In particular, I think it means many of the API methods should return a request instead of a response, and then adding a new function that sends one or a batch of requests together and returns a response.
Here's how it might(?) look:
pages = Repo.all(Page)
|> Enum.map(fn page -> Facebook.page(page.facebook_page_id) end)
|> Facebook.requestBatch()
Hello I followed the example in the readme but I got this error.
** (ArgumentError) application :facebook is not loaded, or the configuration parameter :appsecret is not set
(elixir) lib/application.ex:281: Application.fetch_env!/2
lib/facebook.ex:488: Facebook.add_app_secret/2
lib/facebook.ex:73: Facebook.me/2
Please can you provide a sample mix configuration.
Hello, Facebook API is huge and you can't cover all things in your lib. So I think it would be nice to make it extendable. Like this:
project_name/lib/project_name/api_wrappers/facebook.ex
defmodule ProjectName.ApiWrappers.FacebookApi do
use Facebook # your lib
def my_custom_api_call(args) do
HTTPoison.get ...
end
end
As a result, we can use your lib API along with our custom.
Is it currently possible to upload videos/images with this package?
Any plans to start using httppoison at leat to 1.0? 0.13 is a bit old and brings inconsistency to project.
By convention, method names should be in snake_case
, see https://github.com/elixir-lang/elixir/blob/master/lib/elixir/pages/Naming%20Conventions.md#casing
Elixir developers must use snake_case when defining variables, function names, module attributes, etc
It's super weird to use your library when it's the only one using camel case.
An example of usage would be really nice, e.g.
Facebook.me("name,birthday,first_name,last_name,address,gender,email", "<your access token>")
Also (and maybe this is obvious to a non-beginner like me), I needed to install httpoison as per the instructions here:
I want to pin the API version my app will be using. To do so, I set the graph_url
with Facebook's versioning scheme to a specific version, like this one: https://graph.facebook.com/v2.11/
.
This, however, breaks the long_lived_access_token
call as the uri used therein (/oauth/access_token
) isn't available in versioned paths, only at root.
Maybe the config could introduce a parameter graph_api_version
which will be appended only to the calls which are available under versioned urls. What do you think?
Hello, sorry if this is not the right place to ask,
I see how to set the App Secret
but nothing about the App ID ?
how does this work?
thanks
I'm having the following error:
** (RuntimeError) unable to read env key: appsecret for app: facebook lib/facebook/config.ex:2: Facebook.Config.get_env/1 lib/facebook.ex:71: Facebook.me/2
Even after setting the environment variable in a .env file, and setting the config.exs like so:
config :facebook, Users.Facebook, appsecret: System.get_env("FB_ACCESS_TOKEN")
Any advice?
I am writing a little experimental service in Elixir and need to access info about a user's facebook pages. Would you accept a PR for adding a basic wrapper for the /page
node?
It looks like I could pretty easily follow the current code for /me
, any concerns or other design we should do?
Could you release the new version to hex.pm?
I request to /me
fields = ["name", "birthday", "first_name", "last_name", "address", "gender", "email"]
Facebook.me(fields, access_token)
But it raise an error:
[error] #PID<0.1058.0> running App.Endpoint terminated
Server: localhost:80 (http)
Request: POST /api/users/fb_sign_in
** (exit) an exception was raised:
** (UndefinedFunctionError) undefined function: :hmac.hexlify/2 (module :hmac is not available)
:hmac.hexlify(<<101, 133, 65, 126, 95, 129, 67, 126, 54, 42, 27, 31, 160, 99, 106, 211, 84, 26, 178, 44, 77, 212, 157, 80, 223, 244, 216, 36, 8, 154, 254, 179>>, [:string, :lower])
lib/facebook.ex:79: Facebook.me/3
(app) web/controllers/api/user_controller.ex:31: App.Api.UserController.fb_sign_in/2
(app) web/controllers/api/user_controller.ex:1: App.Api.UserController.action/2
(app) web/controllers/api/user_controller.ex:1: App.Api.UserController.phoenix_controller_pipeline/2
(app) lib/phoenix/router.ex:255: App.Router.dispatch/2
(app) web/router.ex:1: App.Router.do_call/2
(app) lib/app/endpoint.ex:1: App.Endpoint.phoenix_pipeline/1
(app) lib/plug/debugger.ex:90: App.Endpoint."call (overridable 3)"/2
(app) lib/phoenix/endpoint/render_errors.ex:34: App.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
Thank you for all the effort, a really useful library to have in elixir.
One issue faced was providing custom parameters like "since" etc and also, not having a clean abstraction for things like getting the next page in a feed or the previous. I have started designing the flow a bit.
Is it something that current users of the library will find useful ? If yes, I will get a PR ready in a short while.
Thanks.
Hi.
I have followed the instructions to get my user's basic info, and I'm getting a missing Hackney config error. These are the steps I'm taking:
{:facebook, "~> 0.20.0"}
Create my own Facebook app and get an access token
When I try to follow the example, I get
Facebook.me("name,first_name", TOKEN)
=> ** (ArgumentError) argument error
(stdlib) :ets.lookup_element(:hackney_config, :mod_metrics, 2)
/app/deps/hackney/src/hackney_metrics.erl:27: :hackney_metrics.get_engine/0
/app/deps/hackney/src/hackney_connect.erl:69: :hackney_connect.create_connection/5
/app/deps/hackney/src/hackney_connect.erl:37: :hackney_connect.connect/5
/app/deps/hackney/src/hackney.erl:316: :hackney.request/5
lib/httpoison/base.ex:439: HTTPoison.Base.request/9
lib/facebook.ex:174: Facebook.me/2
Am I missing some configuration?
Please how do i get the code passed to the accessToken function? I can't seems to figure out what the code is.
Noticed that some methods return a tuple, like:
{:json, %{"email" => email}} = Facebook.me([fields: "email"], access_token)
Whereas other methods return a map, like:
%{"access_token" => access_token} = Facebook.accessToken
Is this done for a particular reason? If not, would you be open to a PR that makes the returns consistent?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.