我想使用 facebook 聊天 api,这是我发送消息的代码。
代码未显示任何错误,但消息未在聊天中发送给我的朋友。
app_id = "2728175525705"
app_secret="72591c4efec0612b42a7f9509c3e"
id = '-my_user_name@chat.facebook.com'
to = '-my_friend_user_name@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, 'CAACEdEose0cBAJPkgOTxTraaez71U1yZCaKzukFUyCI5FrLC8xqb0DKHXNEQp9CNkgf2hDGZCXq1FSf52Dc2wc7QcXugmlDFuKA061wZAgO8JEdaHsjK9ceRkOMcH3yDZAKEkInrDL2hgorUshVNTyUZD', app_secret), nil)
client.send message
client.close