fbmessenger-api: High-level bindings to Facebook Messenger Platform API

[ bsd3, library, program, web ] [ Propose Tags ]

Please see README.md

[Skip to Readme]
Versions [faq],,,,,,, (info)
Dependencies aeson, base (>=4.7 && <5), bytestring, case-insensitive, fbmessenger-api, http-client, http-client-tls, http-media, http-types, mime-types, monad-logger, servant (==0.7.*), servant-client (==0.7.*), servant-server (==0.7.*), stm, string-conversions, text, transformers, unordered-containers, wai, wai-logger, warp [details]
License BSD-3-Clause
Copyright 2016 Marcello Seri, Federico Rampazzo
Author Marcello Seri
Maintainer marcello.seri@gmail.com
Category Web
Home page https://github.com/mseri/fbmessenger-api-hs#fbmessenger-api
Source repo head: git clone https://github.com/mseri/fbmessenger-api-hs
Uploaded by mseri at Sun Jun 19 13:29:37 UTC 2016
Distributions NixOS:
Executables example
Downloads 2209 total (90 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for fbmessenger-api-

[back to package description]

FBMessenger API

Build Status Hackage Hackage Dependencies Haskell Programming Language BSD3 License

High-level bindings to the Messenger Platform API based on servant library. We try to maintain the overall structure compatible with telegram-api.

There was an incongruence between the spec and the actual serialization of the webhook requests that became apparent when testing an actual messenger bot. For this reason you should use only versions of the library that are >= 0.1.1!

This library is alpha software and the API design could change to improve composability, ergonomicity and ease of use. We recommend using stack for dealing with this library (you will need to add it to the extra-deps in stack.yaml).

<!-- Useful links: - [servant tutorial](http://haskell-servant.readthedocs.io/en/stable/tutorial) - [simple python bindings for the messenger api](https://github.com/geeknam/messengerbot) - [bytemyapp](http://bitemyapp.com/archive.html) - [aeson tutorial](https://artyom.me/aeson) - [haskell is easy](https://haskelliseasy.readthedocs.io/en/latest/) / -->


Before being able to test and use the bot, you will need to verify your key. The example app in example-app/example.hs contains a servant server that implements the verification and a trivial echo-server. You can run it with

VERIFY_TOKEN="your_token_goes_here" stack exec example  

and pass it some data (here assuming you have httpie installed)

http get 'localhost:3000/webhook/?hub.verify_token=your_token_goes_here&hub.challenge=test'
http post :3000/webhook < test-files/wsTextMessageRequest.json

Otherwise run stack ghci then copy and paste the following

:m +Network.HTTP.Client
:m +Network.HTTP.Client.TLS
:m +Data.Text

let token = Token $ Data.Text.pack "your_token_goes_here"
let manager = newManager tlsManagerSettings
manager >>= \m -> subscribedApps $ Just token m

You should get a positive response or (in case of inactive token):

Left (FailureResponse {responseStatus = Status {statusCode = 400, statusMessage = "Bad Request"}, responseContentType = application/json, responseBody = "{\"error\":{\"message\":\"Invalid OAuth access token.\",\"type\":\"OAuthException\",\"code\":190,\"fbtrace_id\":\"ESxHmUos2B+\"}}"})


  1. Fork repository
  2. Do some changes
  3. Create pull request
  4. Wait for CI build and review

You can use stack to build the project

stack build

To run tests

stack test