{"id":16717168,"url":"https://github.com/mseri/fbmessenger-api-hs","last_synced_at":"2025-06-15T09:34:16.611Z","repository":{"id":62435952,"uuid":"60780182","full_name":"mseri/fbmessenger-api-hs","owner":"mseri","description":"High-level bindings to the Messenger Platform API based on servant library.","archived":false,"fork":false,"pushed_at":"2017-03-01T17:21:33.000Z","size":95,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T16:47:00.465Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mseri.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-09T14:15:39.000Z","updated_at":"2024-06-27T21:01:55.000Z","dependencies_parsed_at":"2022-11-01T21:33:57.704Z","dependency_job_id":null,"html_url":"https://github.com/mseri/fbmessenger-api-hs","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mseri/fbmessenger-api-hs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Ffbmessenger-api-hs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Ffbmessenger-api-hs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Ffbmessenger-api-hs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Ffbmessenger-api-hs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mseri","download_url":"https://codeload.github.com/mseri/fbmessenger-api-hs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mseri%2Ffbmessenger-api-hs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259952402,"owners_count":22936953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T21:30:24.083Z","updated_at":"2025-06-15T09:34:16.561Z","avatar_url":"https://github.com/mseri.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FBMessenger API\n\n[![Build Status](https://travis-ci.org/mseri/fbmessenger-api-hs.svg?branch=master)](https://travis-ci.org/mseri/fbmessenger-api-hs)\n![Hackage](https://img.shields.io/hackage/v/fbmessenger-api.svg)\n![Hackage Dependencies](https://img.shields.io/hackage-deps/v/fbmessenger-api.svg)\n![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)\n![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)\n\nHigh-level bindings to the [Messenger Platform API](https://developers.facebook.com/docs/messenger-platform/) based on [servant](https://haskell-servant.github.io/) library.\nWe try to maintain the overall structure compatible with [telegram-api](https://github.com/klappvisor/haskell-telegram-api).\n\nThere 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 `\u003e= 0.1.1`**!\n\nThis 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`).\n\nNOTE (1.6.2016): the WelcomeMessageSendAPI recently changed. The Platform no-longer accepts any welcome message api-wise (only a custom payload is now allowed). The library will be updated to reflect this change as soon as I can (otherwise you are welcome to submit a PR). To setup/modify the Welcome Message you have to use the online interface.\n\n# Usage\n\nBefore being able to test and use the bot, you will need to verify your key.\nThe example app in `example-app/example.hs` contains a servant server that implements the verification and a trivial echo-server.\nYou can run it with\n\n```{.bash}\nVERIFY_TOKEN=\"your_token_goes_here\" stack exec example\n```\n\nand pass it some data (here assuming you have `httpie` installed)\n\n```{.bash}\nhttp get 'localhost:3000/webhook/?hub.verify_token=your_token_goes_here\u0026hub.challenge=test'\nhttp post :3000/webhook \u003c test-files/wsTextMessageRequest.json\n```\n\nOtherwise run `stack ghci` then copy and paste the following\n\n```{.haskell}\n:m +Network.HTTP.Client\n:m +Network.HTTP.Client.TLS\n:m +Data.Text\n\nlet token = Token $ Data.Text.pack \"your_token_goes_here\"\nlet manager = newManager tlsManagerSettings\nmanager \u003e\u003e= \\m -\u003e subscribedApps $ Just token m\n```\n\nYou should get a positive response or (in case of inactive token):\n\n```{.haskell}\nLeft (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+\\\"}}\"})\n```\n\n# Contribution\n\n1. Fork repository\n2. Do some changes\n3. Create pull request\n4. Wait for CI build and review\n\nYou can use stack to build the project\n\n    stack build\n\nTo run tests\n\n    stack test\n\n# TODO\n\n- Tests for the network part of the api (hard, requires a bot setted up and permanently running just for the tests)\n- Check if assumption on https://github.com/mseri/fbmessenger-api-hs/blob/master/src/Web/FBMessenger/API/Bot/WebhookAPI.hs#L99 is safe\n- Cleanup Webhooks API Requests and add higher level helpers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmseri%2Ffbmessenger-api-hs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmseri%2Ffbmessenger-api-hs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmseri%2Ffbmessenger-api-hs/lists"}