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

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

Web.FBMessenger.API.Bot.WebhookAPI

Contents

Description

This module contains types and helpers to parse the webhook requests coming from the Messenger Platform API. You can find a complete example with the source code of this library on github.

Synopsis

Types

data RemoteEvent Source

A webhook request contains a list of RemoteEvents, objects containing an id, a time and a list of messaging events.

Constructors

RemoteEvent 

Fields

evt_id :: Text

Page ID of page

evt_time :: Int

Time of update

evt_messaging :: [EventMessage]

Array containing objects related to messaging

data EventMessage Source

This is an event message, for additional information refer to the official Messenger Platform API.

Constructors

EventMessage 

Fields

evtSenderId :: Text

Sender user ID

evtRecipientId :: Text

Recipient user ID

evtTimestamp :: Maybe Int
 
evtContent :: EventMessageContent
 

data EventMessageContent Source

Constructors

EmTextMessage Text Int Text

Message ID; Message sequence number; Message text.

EmStructuredMessage Text Int [EventMessageAttachment]

Message ID; Message sequence number; Array containing attachment data (image, video, audio)

EmAuth Text

data-ref parameter that was defined with the entry point

EmDelivery Int Int (Maybe [Text])

Sequence No.; Watermark: all messages that were sent before this timestamp were delivered; Array containing message IDs of messages that were delivered (optional)

EmPostback Text

Contains the postback payload that was defined with the button

Functions

extractMessagingEvents :: RemoteEventList -> [EventMessage] Source

Helper to extract all messaging events from the RemoteEventList in the webhook call body