The fb package

[Tags:bsd3, library, test]

This package exports bindings to Facebook's APIs (see http://developers.facebook.com/). Does not have any external dependencies and tries to use as little resources (such as memory, sockets and CPU) as possible by using packages such as aeson, attoparsec, bytestring, conduit, http-conduit, text and others.

While we would like to have a complete binding to Facebook's API, this package is being developed on demand. If you need something that has not been implemented yet, please send a pull request or file an issue on GitHub (https://github.com/psibi/fb/issues).


[Skip to Readme]

Properties

Versions 0.1, 0.2, 0.2.1, 0.3, 0.3.1, 0.4, 0.4.0.1, 0.4.0.2, 0.5, 0.6, 0.6.0.1, 0.6.0.2, 0.7, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7.4.1, 0.7.5, 0.8, 0.9, 0.9.1, 0.9.3, 0.9.4, 0.9.5, 0.9.5.1, 0.9.6, 0.9.7, 0.11, 0.11.1, 0.11.2, 0.11.2.1, 0.12, 0.12.2, 0.12.3, 0.12.3.4, 0.12.4.1, 0.12.5, 0.12.6, 0.12.7, 0.12.8, 0.12.9, 0.13, 0.13.1, 0.13.2, 0.13.3, 0.13.4, 0.13.4.1, 0.13.4.2, 0.14, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.14.4.1, 0.14.5, 0.14.6, 0.14.7, 0.14.7.1, 0.14.8, 0.14.9, 0.14.10, 0.14.11, 0.15.0, 0.15.1, 0.15.1.1, 0.15.2, 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.0.11, 1.0.12, 1.0.13, 1.1.0, 1.1.1
Change log CHANGELOG.md
Dependencies aeson (>=0.8.0.2), attoparsec (>=0.10.4 && <0.14), base (==4.*), base16-bytestring (>=0.1), base64-bytestring (>=0.1.1), bytestring (>=0.9 && <0.11), cereal (>=0.3 && <0.6), conduit, conduit-extra, crypto-api (>=0.11 && <0.14), cryptohash (>=0.7), cryptohash-cryptoapi (==0.1.*), data-default, http-client (>=0.4.18.1), http-conduit (>=2.0), http-types, lifted-base (>=0.1 && <0.3), monad-control, monad-logger (>=0.3), old-locale, resourcet, text (>=0.11 && <1.3), time (>=1.4), transformers (>=0.2 && <0.6), transformers-base, unordered-containers [details]
License BSD3
Copyright (c) Prowdsponsor
Author Felipe Lessa, Sibi
Maintainer Sibi <sibi@psibi.in>
Category Web
Home page https://github.com/psibi/fb
Bug tracker https://github.com/psibi/fb/issues
Source repository head: git clone git@github.com:psibi/fb.git
Uploaded Wed Apr 5 05:40:52 UTC 2017 by psibi
Distributions Debian:1.0.13, NixOS:1.1.1, Stackage:1.1.1
Downloads 18387 total (583 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2017-04-05 [all 1 reports]

Modules

[Index]

Flags

NameDescriptionDefaultType
debugPrint debugging info.DisabledAutomatic

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for fb

Readme for fb-1.1.1

fb

Build Status

Haskell bindings to Facebook's API

Example code to get User Access token

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

import Facebook
import Network.HTTP.Client
import Network.HTTP.Client.TLS
import Control.Monad.Trans.Control
import Control.Monad.Trans.Resource
import Control.Monad.IO.Class
import Data.Monoid ((<>))
import Data.ByteString.Char8 (pack)
import Data.Text hiding (pack)
import Data.Aeson
import qualified Data.Text.Encoding as TE

myCreds :: Credentials
myCreds =
  Credentials
  { appName = "Your_APP_Name"
  , appId = "your_app_id"
  , appSecret = "xxxxxxxxxxxxxxxxx"
  }

main :: IO ()
main = do
  mgr <- newManager tlsManagerSettings
  let redirectUrl = "https://www.yourdomain.com/"
  runResourceT $
    runFacebookT myCreds mgr $
    do url1 <- getUserAccessTokenStep1 redirectUrl ["public_profile", "email"]
       liftIO $ print ("Paste the url in browser and get code: " <> url1)
       code <- liftIO $ getLine
       token <- getUserAccessTokenStep2 redirectUrl [("code", pack code)]
       liftIO $ print token

Snippet to get your Profile Picture:

       (picture :: Value) <-
         getObject "/me/picture" [("redirect", "0")] (Just token)
       liftIO $ print picture

Snippet to get your firstname, lastname:

       user <- getUser "me" [("fields", "first_name,last_name")] (Just token)
       liftIO $ print user