I'm trying to build a messenger bot using the facebook messenger gem provided by Hypersolo: https://github.com/hyperoslo/facebook-messenger
I always get the following error: Facebook::Messenger::Bot::RecipientNotFound (Unsupported post request. Object with ID 'me' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api)
I assumed the error was due to an invalid or inactive access_token, however I requested a new one over and over again and the error remains. I checked my page subscriptions which seem to be fine as well as disabling message_echoes in webhooks.
The code I'm using is simple:
require 'facebook/messenger'
include Facebook::Messenger
Facebook::Messenger::Subscriptions.subscribe(access_token: ENV["ACCESS_TOKEN"])
Bot.on :message do |message|
message.reply(text: 'Hello, human!')
end
Additionally; leaving out the reply and inspecting the message variable gives me a valid message object.
#<Facebook::Messenger::Incoming::Message:0x007fdd2d4a40e0 @messaging={"sender"=>{"id"=>"1349987331712XXX"}, "recipient"=>{"id"=>"1683630555268XXX"}, "timestamp"=>1484149162343, "message"=>{"mid"=>"mid.1484149162343:d5a47f1649", "seq"=>121620, "text"=>"Why wont this work?"}}>