我按照本指南从rails应用程序发送私人Facebook消息:http://dalibornasevic.com/posts/35-how-to-send-private-messages-with-facebook-api
但是,在尝试验证客户端时遇到错误。我的代码如下。它一直工作到client.auth_sasl行,此时我得到一个未指定的错误。任何帮助将不胜感激!
sender_uid= "bn.washer.10"
sender_chat_id = "-#{sender_uid}@chat.facebook.com"
receiver_uid= "rich.zer.11"
receiver_chat_id = "-#{receiver_uid}@chat.facebook.com"
message_body = "message body"
message_subject = "message subject"
jabber_message = Jabber::Message.new(receiver_chat_id, message_body)
jabber_message.subject = message_subject
client = Jabber::Client.new(Jabber::JID.new(sender_chat_id))
client.connect
tok='CAACdUWyUMNIBAFLT7ZB4j6CiqmoZB3kySPrbg9jOdaSFSSdxk06'
id= ENV.fetch('FACEBOOK_APP_ID')
secret= ENV.fetch('FACEBOOK_APP_SECRET')
#this is where the error occurs!
client.auth_sasl(Jabber::SASL::XFacebookPlatform.new(client, id, tok, secret), nil)
client.send(jabber_message)
client.close