Can't send message to FB - facebook

FB authentication is proper and i can receive messages. Only issue is when sending messages to a FB friend. No error messages or warnings are being shown, but the message is simply not delivered to the FB friend.
This is the string that i am sending
<message xmlns="http://www.facebook.com/xmpp/messages" to="-FB_ID#chat.facebook.com">
<body>my_message</body></message>
Any one having same issue?.

The "from" parameter is missing in your requset. Message format should be like this:
<message from="-sender_ID#chat.facebook.com" to="-receiver_ID#chat.facebook.com">
<body>your_message</body>
</message>

Is this something to do with the 5000 friend limit ? I mean, you are not allowed to have more than 5000 friends on FB, therefore, I'm guessing there is a security issue that stops you posting once you hit that limit ?

Issue fixed.
Author replied me:
OK, I haven't done anything with Facebook chat but why are you setting the xmlns?
That exactly was my problem. I was sending the xmpp messages as shown below:
<message xmlns="http://www.facebook.com/xmpp/messages" to="-FB_ID#chat.facebook.com">
<body>dd</body></message>
When I removed the xmlns attribute, everything is fixed :)

Related

Blocking user using privacy list in ejabberd returns "not-well-formed"

I want to block other user in ejabberd on basis of jid. I am trying to send iq stanza through send_stanza_c2s command. Like :-
send_stanza_c2s admin localhost Smack "<iq from='admin#localhost/Smack' type='set' id='msg1'><query xmlns="jabber:iq:privacy"><list name="blocked"><item type="jid" value="jack10#localhost" action="deny" order="3"/><message/></item></list></query></iq>"
But it is giving me error.
Error: {4,<<"not well-formed (invalid token)">>}
Please help me with this.
Also guide me on if blocking user is achievable only through privacy lists (XEP-0016).
The IQ request stanza you send to the server is not well formed, I.e. invalid. If you used Smack's API for privacy lists then you should report this as bug.

Missing metadata in friend request for offline users

We are trying to customize the friend request in XMPP (Ejabberd) so that we can send additional metadata in friend request as shown below(shows the request as logged in ejabberd.log file). The issue is when the friend is offline, XMPP does not send the additional metadata (jidValue, profileImageURL etc.) when the friend request is eventually delivered to end user when they come online. But if the friend is online, when the request is sent, all the additional metadata is indeed delivered. Does anybody know why for offline users, the additional metadata is not sent and how it can possibly be resolved?
Here is the log file content:
2015-12-06 18:07:35.127 [debug]
<0.1763.0>#ejabberd_receiver:process_data:349 Received XML on stream =
<<"https://jabber.chatter.io/profiles/chatapp_profile56646b3323232.232323232.png\"
age=\"0\" gender=\"\" message=\"\">">>
packet
{xmlel,<<"presence">>,[{<<"type">>,<<"subscribe">>},{<<"to">>,<<"17032345678jinglebells#chat.chatter.io">>},{<<"jidValue">>,<<"1408123467abcd#chat.chatter.io/MCRJ">>},{<<"profileImageURL">>,<<"https://jabber.chatter.io/profiles/chatapp_profile56646b3323232.232323232.png">>},{<<"age">>,<<"0">>},{<<"gender">>,<<>>},{<<"message">>,<<>>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"vcard-temp:x:update">>}],[{xmlel,<<"photo">>,[],[]}]}]}
When the friend is not online the friend request is not stored as is: Presence are not store for offline delivery. Instead, ejabberd looks for pending request and generate a new one when the user connects.
I created a ticket to support the feature on ejabberd Github: https://github.com/processone/ejabberd/issues/870
Note that your packet is wrong, as you seem to put your extension on attribute for convenience. They should be on custom subtag, with custom xmlns. What you do is not valid anyway. Customization should look similar the the x xmlns vcard content.
The attribute you add are not expected by XMPP in the jabber:client namespace.
I had the following XML send from my iOS client code to the other user who was offline
<presence type="subscribe" to="918054824047thj#chat.domain.io">
<profile xmlns="custom:data">
<profileImageURL>https://jabber.domain.io/profiles/slocamo_profile5667ec5aea78e2.08175827.png</profileImageURL>
<age>0</age>
<gender/>
<message/>
<jidValue>918054824047jitu#chat.domain.io/jitu</jidValue>
</profile>
<x xmlns="vcard-temp:x:update"><photo/></x>
</presence>
but when the user come's online he only receives the following XML
<presence xmlns="jabber:client" from="918054824047thj#chat.domain.io" to="918054824047jitu#chat.domain.io" type="subscribe">
<status/>
</presence>
let me know how to fix this

Notify facebook chat server that a thread has been seen

This is similar to Know when Facebook chats have been seen via API? but more or less the reverse.
I am using the fql "thread" object in combination with an XMPP chat to add some messaging/inbox functionality to a client side app. I notice if the user adds a message to a thread via XMPP, the "unseen" field in the fql "thread" is switched off. My question: Is there a way to send some form of message/element to chat.facebook.com that will switch the "unseen" field to off short of sending an actual message. Thanks!
I have tried;
<message type="chat" to="-fbid#chat.facebook.com">
<active xmlns="http://jabber.org/protocol/chatstates"></active>
</message>
Also tried to trick the service with;
<message type="chat" to="-fbid#chat.facebook.com">
<composing xmlns="http://jabber.org/protocol/chatstates"/>
</message>
Even tried to send a dummy message with empty body;
<message type="chat" to="-100004885119811#chat.facebook.com">
<body></body>
</message>

Facebook Chat (XMPP) XEP 0080 support

I have being checking out using a prototype test program the capabilities of the XMPP Facebook Chat, X-FACEBOOK. It worked great using a geoloc message XEP 0080 with Gmail servers, but when i try to send the same XML structure through the X-FACEBOOK, it trims the message and removes the GeoLoc node.
I wanted to ask if someone knows if its possible to send XEP 0080 messages in X-FACEBOOK and if so what structure should I use so the Facebook Chat XMPP Server won't trim the GeoLoc info.
Sent XMPP geoloc message:
<message to="-100002578491827#chat.facebook.com" from="4yony4#chat.facebook.com/19256ca9_4C5CC12947646" type="chat" xml:lang="en">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="http://jabber.org/protocol/geoloc">
<item id="">
<geoloc xmlns="http://jabber.org/protocol/geoloc">
<lat>40.488137</lat>
<lon>-3.397623</lon>
<timestamp>2012-07-27 09:09:50 GMT</timestamp>
<msgType>0</msgType>
</geoloc>
</item>
</items>
</event>
<body>
</body>
Received message by client:
<message xmlns="jabber:client" from="-1177157556#chat.facebook.com" to="" type="chat">
<active xmlns="http://jabber.org/protocol/chatstates"/>
<body></body>
</message>
Any solution or opinion will be greatly appreciated.
Well, changed the XML to resemble the one you posted, without the pub sub, and still the same problem, the message received in the recipient lacks all the namespaces under the GeoLoc node, which I think is a result of the Server not supporting that format. I can try and use the IQ subscriber option, thing is that I prefer to find a solution on which I can directly send the info to a user.
If there is a possibility, even a small one in which i may be able to send information regarding GeoLoc from User A to User B in Facebook Server it may be of great help, if not well i guess i will have to accept it.
Thx for the help BTW.
When I was testing facebook XMPP connection, it did not support almost any extensions and blocked any custom tags on server. It was able to send basic presences, basic messages, vcards and that was about all it could do.
Pubsub events should be sent to services. Modern XMPP servers also support PEP extension and you can send pubsub to servers itself. In other cases, use message with target user as Robin have advised.
I do not think facebook has any server with pubsub. Also i think it still filters any unsupported namespaces. Feel free to prove me I am wrong, it is more than year since I last tested it.
These are not the same message.
The received message is simply an indicator of the users chat state, as defined in XEP-0085 and has no direct relationship to the message you sent. That doesn't mean that the first didn't potentially trigger the second, whatever library you are using may have sent the chatstate as well when you sent the message. This type of message is commonly used in chat clients to indicate that someone you are chatting with is typing a message.
The problem is probably that the message you are sending is in fact a PEP message. This is meant to be sent by the PEP service in the server, not from a client. I don't know if Facebook supports PEP or not, but I would guess that it is being filtered out due to your incorrect usage of a known namespace. PEP or Pubsub are the recommended ways of publishing geolocation information, but to utilize those you have to send an IQ packet to the service, not a message to the other client.
Try this instead (Not saying it will work, but at least the pubsub stuff is stripped):
<message to="-100002578491827#chat.facebook.com" from="4yony4#chat.facebook.com/19256ca9_4C5CC12947646" type="chat" xml:lang="en">
<geoloc xmlns="http://jabber.org/protocol/geoloc">
<lat>40.488137</lat>
<lon>-3.397623</lon>
<timestamp>2012-07-27 09:09:50 GMT</timestamp>
<msgType>0</msgType>
</geoloc>
<body>
</body>
</message>
I want to second Pihhan. It seems like the Facebook XMPP servers restructure messages to contain only the message body, date, and timestamp. I think they do that to keep it identical to their comment graph objects.
It is annoying, but I suspect it is deliberate. After all, their Graph is the main issue, not XMPP.

How can I send the same Twitter message multiple times?

I am trying to add the iOS 5 Twitter API to my app, and Twitter is giving me crap about sending the same direct message a second time.
Twitter response, HTTP response: 403
Response Data
{"error":"There was an error sending your message: Whoops! You already said that.","request":"\/1\/direct_messages\/new.json"}
Is there anyway to get around this so I can test my app?
Why don't you try sending a random message or the (stringified) time? It would be unique an each occasion, and it wouldn't require you to hack/work around/otherwise violate Twitter's this restirction.
You can tweet the same message multiple times if the text is never exactly the same.
For example, 1001tweets helps you to post multiples times some of your tweets. To do that, it keeps only the tweets containing a link and changes it using an URL shortener.