How to send private messages with Facebook API using C#
Asked Answered
A

2

8

I use Facebook Connect for login on my website and need to create functionality of sending personal messages to user's Facebook friends.

A solution from this question is not suitable for me because I need to send messages to several friends at the same time (user just selects friends from the list who she/he wants to send a message).

I've found pretty good post about this question for Ruby - How to send private messages with Facebook API. But I can't find a C# package similar to xmpp4r_facebook Ruby gem.

agsXMPP SDK and jabber-net don't support X-FACEBOOK-PLATFORM SASL mechanism (http://forum.ag-software.de/thread/1372-Facebook-Chat and Connect to facebook chat using Jabber.net (C#/Mono) with SASL).

I hope to find some existing solution instead of updating one of these libraries. Or to find some library like xmpp4r_facebook but for .NET platform.

Thanks.

Amuse answered 26/9, 2012 at 5:37 Comment(0)
D
3

The latest sources of agsXMPP supports the X-FACEBOOK-PLATFORM Sasl mechanism.

1) checkout the latest sources
2) add the following code to the OnSaslStart event

private void XmppCon_OnSaslStart(object sender, SaslEventArgs args)
{
   args.Mechanism = Mechanism.GetMechanismName(agsXMPP.protocol.sasl.MechanismType.X_FACEBOOK_PLATFORM);
   args.ExtentedData = new FacebookExtendedData {AccessToken = "YOUR TOKEN", ApiKey = "YOUR API KEY"};    
}
Drusi answered 27/9, 2012 at 8:57 Comment(0)
C
0

Facebook does not allow the SDK to send private messages to prevent misuse by spammers

Corcoran answered 8/3, 2013 at 16:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.