License | BSD3 |
---|---|
Maintainer | Marcello Seri <marcello.seri@gmail.com> |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
This module contains types and helpers to parse the responses from the
Messenger Platform API.
See also SendAPI
.
- data MessageResponse = MessageResponse {}
- data SendErrorCode
- data SendErrorObject = SendErrorObject {
- eoMessage :: Text
- eoType :: Text
- eoCode :: SendErrorCode
- eoErrorData :: Text
- eoFbtraceId :: Text
- data SubscriptionResponse = SubscriptionResponse {}
- data UserProfileResponse = UserProfileResponse {}
- data WelcomeMessageResponse = WelcomeMessageResponse {
- wmr_result :: Text
- errorInfo :: SendErrorObject -> (SendErrorCode, Text)
- extractSendError :: ServantError -> Maybe SendErrorObject
Types
data MessageResponse Source
This object contais the response after a message has been succesfully sent
data SendErrorCode Source
Send API Error Codes (see: https://developers.facebook.com/docs/messenger-platform/send-api-reference#errors)
Code Description 2 Send message failure. Internal server error. 10 Application does not have permission to use the Send API 100 No matching user found 613 Calls to this api have exceeded the rate limit.
data SendErrorObject Source
Send API Error response object (see: https://developers.facebook.com/docs/messenger-platform/send-api-reference#errors)
{ "error":{ "message":"Invalid parameter", "type":FacebookApiException, "code":100, "error_data":"No matching user found.", "fbtrace_id":D2kxCybrKVw }
SendErrorObject | |
|
data SubscriptionResponse Source
This object represents the subscribed_apps
success response
data UserProfileResponse Source
This objects contains the User Profile informations
UserProfileResponse | |
|
data WelcomeMessageResponse Source
This objects contains informations on the succesful setup of a welcome message
Functions
errorInfo :: SendErrorObject -> (SendErrorCode, Text) Source
Take a Send API error object and return a tuple containing the error code and the error_data (seems to always be the description)
extractSendError :: ServantError -> Maybe SendErrorObject Source
Extracts a Send API Error object from the ServantError
(when possible).