Clarke Messenger is Clarke UI plugin to interact with the Facebook Messenger Platform.
In your messenger route code
require 'clarke'
require 'clarke/messenger'
Clarke::Messenger::Config.facebook_page_token = 'your_facebook_page_token'
post '/messenger' do
request_body = JSON.parse(request.body.read)
Clarke.process_request(Clarke::Messenger, request_body)
end
There is 4 types of events:
TextMessage
(includeClarke::TextMessage
)Button
(includeClarke::Button
)Media
(includeClarke::Media
)Metadata
(includeClarke::Metadata
)
All the Messenger Events have to the following attributes:
id
timestamp
sender
(the sender id)
A TextMessage
have to the following attribute: text
A Button
have to the following attribute: action
that is the messenger payload
A TextMessage
have to the following attributes: type
and media
.
type
is 'image', 'audio', 'video' or 'file'
media
is the url of the attachment
Not implemented yet