Skip to content

Instantly share code, notes, and snippets.

class MessengerController < Messenger::MessengerController
require 'rest-client'
def webhook
if fb_params.first_entry.callback.message?
unless params["entry"].first["messaging"][0]["message"]["is_echo"] # so the response from wit.ai won't be sent to wit.ai
create_user(fb_params.first_entry.sender_id)
message(fb_params.first_entry.callback.text, fb_params.first_entry.sender_id)
end
end
##
# The IncludedResourceParams class is responsible for parsing a string containing
# a comma separated list of associated resources to include with a request. See
# http://jsonapi.org/format/#fetching-includes for additional details although
# this is not required knowledge for the task at hand.
#
# Our API requires specific inclusion of related resourses - that is we do NOT
# want to support wildcard inclusion (e.g. `foo.*`)
#
# The IncludedResourceParams class has three public methods making up its API.