Getting first thread id for Facebook XMPP using Asmack - facebook

I am using asmack on Android to talk to Facebook XMPP.
When an incoming message arrives, I get the (XMPP) thread ID from that message/chat. Sending further messages (using that ID) works just fine.
The problem starts when the first message is sent from my application's side. Then I don't have the current thread ID (since they change on the Facebook server). And sending the message does not work. My system sends OK, but it is never registered on Facebook.
So, how do I get the initial (XMPP) thread ID from an inbox chat?
I tried using the graph API to send a message (inbox/comment). But it does not work (you have to be whitelisted... whatever it is).
Please help, how can I initiate an XMPP thread, and not just respond?

Study the one of open source project which used Asmack then you will be get clear idea how its working. Beem-Project is one one of open course project which used Asmack

It turns out that Facebook will accept any thread ID you give it. There was a problem in the way I handled new message threads created locally, rather then external created threads (from Facebook). Now everything works, even firing up a thread from my application, using asmack.

Related

Random duplicated messages in messenger bot

all.
On the last week we are facing a problem in messages order, in Facebook Messenger.
When user is interacting with our bot, on most of the cases Messenger send random messages that it has sent before in the conversation. This old messages are not triggered by our bot, they simply appear, which makes us to think it is a Messenger thing. After a while, when user leave the conversation for some seconds and get back to it later, the bot is ok again. Sometimes user has to say "hi" to bot, so it gets back to the right point of conversation.
It also happens with messages that were sent by user, not only by our bot.
We have never get this problem using it on web platform. It seems to occur only in Android devices (Android massenger app), until this point.
When we check the conversation from the fan page side, it is all ok, and it is hard to determine where the problem occured just by looking from the fan page perspective. It seems there is no problem. But if you are the one who is interacting with the bot is very bad, it is like a "crazy" conversation for the end user.
It is a different case from the listed on other topics. We have an information thread that sends lots of messages, and in this case for example, it has never failed in order. It just happens when there is an user-bot interaction.
Is anybody here facing this kind of problem with messages order?
Thank you in advance.
we have seen the same behavior in android
On further investigation, we found that the messages which we assumed are delivered to the users were actually not delivered.
What we did was started listening to delivery notification and read receipts documentation link. We saved every message at our end and then mapped with seq number and it turns out that there is connectivity issues in android for fb messenger (reference).
When fb messenger is running in background and there is poor network connection then messages are not being received. This is what I have observed when I have poor network connection.

iMessage API, accessing texts not sent through your app

I'm looking for a way to detect if links have been shared in an iMessage conversation. I'm not sure if this can be done with MSMessage, as it looks like it only receives events from messages created by your iMessage app.
Does this mean there is no way to access the conversation outside of the scope of messages created by your iMessage app? Any help is very much appreciated!
Your suspicion is correct. You can only access your own extension's messages.
Quote from the documentation for MSMessagesAppViewController.didReceive(_:conversation:):
You only receive notifications about messages sent using
your extension. You cannot interact with messages from other
extensions.
At the moment you can only access messages that come from your app AND :
that were selected by the user. Meaning that any previous message
sent via your app won't be accessible unless the user tap it.
that were received during the app runs
Note that we are only at the third beta test (at the moment I'm writing) of that new feature. As an "enhancement" were open for this feature, apple developers may allow an app to access messages (of course messages sent via this app, Apple is really worry about all that confidentiality stuff ;) ) in the future

Facebook Graph API subscription to /pages/conversations does not update on outgoing messages

I'm working with Facebook pages and building an app that allows you to send/receive private messages for your page from an external app.
Everything works fine, I can import old messages, send new one. My issue comes from the real time update subscription.
As explained here and here, I have subscribed to the conversations field on the page object. I also set up my server to receive Facebook verification and the updates.
I do receive updates when someone sends a new message to my test page ( even if it's a bit slow ~30 sec delay ) but I never receive any updates when the page replies to a message.
Is there something else I need to subscribe to in order to receive these updates ? Do I need to look for another way to do it ? Or is it just not supported by Facebook real time API updates ?
Any help appreciated, let me know if you need more info and have a nice day.

GAE channel API chat

Currently im trouble shooting some code that I wrote to create a chat room. I will include the code if necessary but for now I just wanted to hear some possibilities for the problem im having. So basically I have client1 that is listening to a channel and then when clien2 sends a message to the server the message is then sent from the server to all available users. What is happening is that client 2 will send the message and it will be displayed on his browser but client 1 will not receive the message until he refreshes the page or types in a message of his own. So I would think that user presence is being detected fine since the message eventually gets sent to all available users but im not sure? Thoughts?
The Google App Engine blog has a nice case study that talks about how to do this.
They store a list of channel ID's in memcache and send update messages to each of them. They mention that race conditions make memcache not ideal, but it worked well enough for their demo.

Registration Process in XMPP Chat for iPhone

I am implementing a XMPP client for my iPhone App, I ahve completed all the things in (Chatting with other users , showing presence of other users , etc.)
But the one thing for which I am stuck is that , I am unable to get the new user registered from my App. I am using following snippet,
if ([appDelegate.xmppStream supportsInBandRegistration])
[appDelegate.xmppStream registerWithPassword:txt_Password.text error:nil];
But for this, supportsInBandRegistration method always returns NO and the registerWithPassword: method is never called.
Please provide some help regarding the same.
What server are you using? Some servers support in-band registration even thought they don't send the correct stream:feature according to XEP-0077. Most of them should give the feature in the disco results however.
In other words, try commenting out your if ([appDelegate.xmppStream supportsInBandRegistration]) and see if it works. If so, you'll need to complain either to your library developer or to your server developer or both.