Post a private message to the user frined using Ruby and fb_graph gem?

I want to send a private message to a user's friend using fb_graph. In the docs I can see how to send a post in the users wall but not how to send a message on behalf of that user.


Unfortunately it cannot be done; Facebook removed the functionality due to abuse (spam etc).

Please refer to: how send message facebook friend through graph api using Accessstoken

You can use Facebook Chat API to send private messages, here is an example in Ruby using xmpp4r_facebook gem:

sender_chat_id = "-#{sender_uid}"
receiver_chat_id = "-#{receiver_uid}"
message_body = "message body"
message_subject = "message subject"

jabber_message =, message_body)
jabber_message.subject = message_subject

client =
   ENV.fetch('FACEBOOK_APP_ID'), facebook_auth.token,
   ENV.fetch('FACEBOOK_APP_SECRET')), nil)

It seems that is not possible but posting to the user's wall might be an alternative:

Need Your Help

Yii2 application git ignore web/index and local configuration

php git yii2

I generate a Yii2 Application then initialized git and commit my change but web/index.php files are in gitignore and not pushed to the repo

Update two tables joined by a pk/fk

sql-server-2008 inner-join

I have two tables with the same ID column PK/FK. I need to update them with data from a third table.