Sha256: d8c169275be52e6b294fb9d5680208ec8519be3a5f4cbf11a595057aba2084fd

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

module Messenger
  module Bot
    class Space::StationController < ::MessengerBotController
      def validation
        if params["hub.verify_token"] === Messenger::Bot::Config.validation_token
          return render json: params["hub.challenge"]
        end
        render body: "Error, wrong validation token"
      end

      def receive
        Messenger::Bot::Receiver.share(params)
        messaging_events = params["entry"].first["messaging"]
        messaging_events.each_with_index do |event, key|
          sender = Messenger::Bot::Transmitter.new(event["sender"]["id"])
          if event["message"] && !defined?(message).nil?
            send(:message, event, sender)
          elsif event["postback"] && !defined?(postback).nil?
            send(:postback, event, sender)
          elsif event["delivery"] && !defined?(delivery).nil?
            send(:delivery, event, sender)
          end 
        end 
        render body: "ok"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
messenger-bot-0.1.7 lib/messenger/bot/station.rb