I am following the instructions presented in http://dalibornasevic.com/posts/35-how-to-send-private-messages-with-facebook-api to send message to my friend and currently testing from command line. Following is the code I am using
require 'xmpp4r_facebook'
id = '<my facebook id>@chat.facebook.com'
to = '<my friend facebook id>@chat.facebook.com'
body = "hello, Im not spam!"
subject = 'message from ruby'
message = Jabber::Message.new to, body
message.subject = subject
client = Jabber::Client.new Jabber::JID.new(id)
client.connect
client.auth_sasl(Jabber::SASL::XFacebookPlatform.new(client, '<App ID>', '<access token got from https://developers.facebook.com/tools/explorer>', 'App Secret'), nil)
I get the error
RuntimeError: not-authorized
from /Users/apple/.rvm/gems/ruby-1.9.3-p194/gems/xmpp4r_facebook-0.1.1/lib/xmpp4r_facebook.rb:103:in `auth'
from /Users/apple/.rvm/gems/ruby-1.9.3-p194/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:171:in `auth_sasl'
from (irb):12
from /Users/apple/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
Sounds like you didn't give authorization for xmpp_login
permission as the message says
not-authorized
If you have the correct permission it should work and you should get a response similar to
<iq xmlns='jabber:client' type='result' id='2027'> ... </>
Inspect your access token with https://developers.facebook.com/tools/debug