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

Safe HaskellNone
LanguageHaskell2010

Web.FBMessenger.API.Bot.Requests

Contents

Description

This module contains data objects which represents requests to Messenger Platform Bot API

Synopsis

Types

data Button Source #

Button object for structured messages payloads

Constructors

Button 

Fields

  • btn_type :: ButtonType

    Value is "web_url" or "postback"

  • btn_title :: Text

    Button title

  • btn_url :: Maybe Text

    For web_url buttons, this URL is opened in a mobile browser when the button is tapped. Required if type is "web_url"

  • btn_payload :: Maybe Text

    For postback buttons, this data will be sent back to you via webhook. Required if type is "postback"

Instances

data BubbleElement Source #

Bubble element object for structured messages payloads

Constructors

BubbleElement 

Fields

data FileUpload Source #

This object represents data (image, video, ...) with mime type to upload.

Constructors

FileUpload 

Fields

data FileUploadContent Source #

This object represents data (image, video, ...) to upload.

data NotificationType Source #

Push notification type for the message

Constructors

Regular

will emit a sound/vibration and a phone notification (default)

SilentPush

will just emit a phone notification

NoPush

will not emit either

data PaymentSummary Source #

Payment summary object for Receipt Template messages

Constructors

PaymentSummary 

Fields

data Recipient Source #

Informations about the recipient of the message

Constructors

Recipient 

Fields

Instances

Eq Recipient Source # 
Show Recipient Source # 
Generic Recipient Source # 

Associated Types

type Rep Recipient :: * -> * #

ToJSON Recipient Source # 
FromJSON Recipient Source # 
type Rep Recipient Source # 
type Rep Recipient = D1 (MetaData "Recipient" "Web.FBMessenger.API.Bot.Requests" "fbmessenger-api-0.1.0.1-KiBYdpfyJ4MK1Fa6nGNanN" False) (C1 (MetaCons "Recipient" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "recipient_id") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text))) (S1 (MetaSel (Just Symbol "recipient_phone_number") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)))))

data ReceiptItem Source #

Constructors

ReceiptItem 

Fields

Instances

Eq ReceiptItem Source # 
Show ReceiptItem Source # 
Generic ReceiptItem Source # 

Associated Types

type Rep ReceiptItem :: * -> * #

ToJSON ReceiptItem Source # 
FromJSON ReceiptItem Source # 
type Rep ReceiptItem Source # 

data ShippingAddress Source #

Shipping address object for Receipt Template messages

Constructors

ShippingAddress 

Fields

Instances

Eq ShippingAddress Source # 
Show ShippingAddress Source # 
Generic ShippingAddress Source # 
ToJSON ShippingAddress Source # 
FromJSON ShippingAddress Source # 
type Rep ShippingAddress Source # 

data SendTextMessageRequest Source #

This object represents a text message request The message text must be UTF-8, with 320 character limit

Functions

bubbleElement :: Text -> BubbleElement Source #

Take the bubble element title. The buttons will appear as call-to-action in Messenger. Return a bubble Element

localFileUpload :: FilePath -> FileUpload Source #

Return a FileUpload from a given FilePath. At the moment, only png and jpg images are supported by the API.

postbackButton :: Text -> Text -> Button Source #

Take the button title and the button payload (this data will be sent back to you via webhook) and return a "postback" button

recipient :: Maybe Text -> Maybe Text -> Maybe Recipient Source #

Take reciptient id (optional) or phone_number (optional) and return a Maybe Recipient object. Return Nothing when values are either both (Just _) or both Nothing.

sendButtonTemplateMessageRequest :: Maybe NotificationType -> Recipient -> Text -> [Button] -> SendStructuredMessageRequest Source #

Take a notification type (optional), a recipient, the text of the message and a list of buttons (they will appear as call-to-actions). Return a SendStructuredMessageRequest for a structured message with button template

sendGenericTemplateMessageRequest :: Maybe NotificationType -> Recipient -> [BubbleElement] -> SendStructuredMessageRequest Source #

Take a notification type (optional), a recipient, a list of ButtonElement. Return a SendStructuredMessageRequest for a structured message with generic template

sendImageMessageRequest :: Maybe NotificationType -> Recipient -> Text -> SendStructuredMessageRequest Source #

Take a notification type (optional), a recipient, an image url. Return a SendStructuredMessageRequest for a structured message with image attachment

sendReceiptTemplateMessageRequest :: Maybe NotificationType -> Recipient -> Text -> Text -> Text -> Text -> Maybe Text -> Maybe Text -> [ReceiptItem] -> Maybe ShippingAddress -> PaymentSummary -> Maybe [PaymentAdjustment] -> SendStructuredMessageRequest Source #

Take a notification type (optional), a recipient and all the informations needed to construct a ReceiptTemplate object. Namely: the recipient name, the order number (must be unique), the currency, the payment method, the timestamp (optional), the order url (optional), a list with the receipt items, the shipping address (optional), the payment summary and, finally, a list of payment adjustments (optional). Return a SendStructuredMessageRequest for a structured message with receipt template

sendTextMessageRequest :: Maybe NotificationType -> Recipient -> Text -> SendTextMessageRequest Source #

Take a notification type (optional), a recipient and a text. Return a SendTextMessageRequest. Raise an error if the text is longer than 320 characters.

setWelcomeButtonTemplateMessageRequest :: Text -> [Button] -> WelcomeMessageRequest Source #

Take the text of the message and a list of buttons (they will appear as call-to-actions). Return a WelcomeMessageRequest for a structured message with button template

setWelcomeGenericTemplateMessageRequest :: [BubbleElement] -> WelcomeMessageRequest Source #

Take a list of ButtonElement. Return a WelcomeMessageRequest for a structured message with generic template

setWelcomeImageMessageRequest :: Text -> WelcomeMessageRequest Source #

Take an image url. Return a WelcomeMessageRequest for a structured message with image attachment

setWelcomeTextMessageRequest :: Text -> WelcomeMessageRequest Source #

Take a text. Return a WelcomeMessageRequest

uploadImageMessageRequest :: Recipient -> FileUpload -> UploadImageMessageRequest FileUpload Source #

Take a recipient and FileUpload (relative to a jpg or png). Return a (UploadImageMessageRequest FileUpload) for a structured message contatining and image uploaded using multipart form data.

webUrlButton :: Text -> Text -> Button Source #

Take the button title and the button url (this URL is opened in a mobile browser when the button is tapped) and return a "web_url" button