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

LicenseBSD3
MaintainerMarcello Seri <marcello.seri@gmail.com>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Web.FBMessenger.API.Bot.SendAPI

Contents

Description

This module contains a servant client for the Messenger Platform API and helpers useful to construct the appropriate requests and parse the responses.

Synopsis

Functions

getUserProfileInfo :: Maybe Token -> Text -> Manager -> IO (Either ServantError UserProfileResponse) Source

Get the profile informations of a user. In addition to the token, you need to provide the user_id. Return a record containing the profile informations.

removeWelcomeMessage :: Maybe Token -> Text -> Manager -> IO (Either ServantError WelcomeMessageResponse) Source

Remove the welcome message. In addition to the token, you need to provide the facebook page_id. Return a simple object containing a string indicating if the welcome message is correctly removed.

sendTextMessage :: Maybe Token -> SendTextMessageRequest -> Manager -> IO (Either ServantError MessageResponse) Source

Send text messages. On success, minor informations on the sent message are returned.

sendStructuredMessage :: Maybe Token -> SendStructuredMessageRequest -> Manager -> IO (Either ServantError MessageResponse) Source

Send a structured messages. This can be an image message (containing an image url) or any template message (generic, button, receipt). On success, minor informations on the sent message are returned.

setWelcomeMessage :: Maybe Token -> Text -> WelcomeMessageRequest -> Manager -> IO (Either ServantError WelcomeMessageResponse) Source

Set a welcome message, this can be an image message (containing an image url) or any template message (generic, button, receipt). In addition to the token and the message request, you need to provide the facebook page_id. Return a simple object containing a string indicating if the welcome message is correctly registered.

subscribedApps :: Maybe Token -> Manager -> IO (Either ServantError SubscriptionResponse) Source

Test if your bot's auth token is enabled. Requires no parameters. Return a simple object containing a boolean value indicating if the token is correctly registered.

uploadImageMessage :: Maybe Token -> UploadImageMessageRequest FileUpload -> Manager -> IO (Either ServantError MessageResponse) Source

Upload an image and send a structured messages containing it. On success, minor informations on the sent message are returned.

API

api :: Proxy FBMessengerSendAPI Source

Proxy for Messenger Platform Bot Send

type FBMessengerSendAPI = (GraphAPIAccessToken :> ("me" :> ("messages" :> (ReqBody `[JSON]` SendTextMessageRequest :> Post `[JSON]` MessageResponse)))) :<|> ((GraphAPIAccessToken :> ("me" :> ("messages" :> (MultipartFormDataReqBody (UploadImageMessageRequest FileUpload) :> Post `[JSON]` MessageResponse)))) :<|> ((GraphAPIAccessToken :> ("me" :> ("messages" :> (ReqBody `[JSON]` SendStructuredMessageRequest :> Post `[JSON]` MessageResponse)))) :<|> ((GraphAPIAccessToken :> ("me" :> ("subscribed_apps" :> Post `[JSON]` SubscriptionResponse))) :<|> ((GraphAPIAccessToken :> (Capture "page_id" Text :> ("thread_settings" :> (ReqBody `[JSON]` WelcomeMessageRequest :> Post `[JSON]` WelcomeMessageResponse)))) :<|> ((GraphAPIAccessToken :> (Capture "page_id" Text :> ("thread_settings" :> (ReqBody `[JSON]` WelcomeMessageRequest :> Delete `[JSON]` WelcomeMessageResponse)))) :<|> (GraphAPIAccessToken :> (QueryParam "fields" Text :> (Capture "user_id" Text :> Get `[JSON]` UserProfileResponse)))))))) Source

Messenger Platform Send API

Types

newtype Token Source

Messenger Platform PAGE_ACCESS_TOKEN

Constructors

Token Text