I am trying to introduce a messenger (chat) feature in my application.
I ma unable to figure out how to make the feature sync on multiple devices.
Let's say I am using the chat on my phone, and then I login to my desktop and start chatting there. How would I get the messages on both devices and how will both be in sync with each other. Additionally, for the sender to get a read confirmation, the message should be read from either one of the device, but the notification of unread should be shown on sender's device on which the message in unread unless he opens and reads it.
For First Part of the question you want to do Like FB Messenger where you loggin you will find your whole messages found not related to a device. To Achieve that you can have at the device app Last Login time which will be posted to the server, and all messages from that time will be retrieved to the user. But imagine the user has read all his messages from the mobile but he didnt open the computer since one Month. IF you didnt mark the message as read, he will find enourmous amount of messages coming as unread but he actually read on his mobile which will cause you huge usability issue.
For your Case I feel you need to do exaclty what FB Messenger does. Retrieve your latest messages from your conv with their actual status. And while scrolling up load by demand.
So Your Message will have only 1 Status(Read or UnRead) And date where you can match with Device Last Sync time.
Related
I have created a bot in one scenario it will call an API and it will take same time to get the output from that API, if in between user type anything it will start working on the text which user sent recently. I want till API output is not received, if user sent any messages it will get ignored.
If your bot is integrated into some app then you can actually disable the send button until you receive an answer for the previous question.
I am setting one session when user is requesting to talk with Live Agent, Then i am checking if that session is in progress and any new message is coming from user then i am just ignoring them.
I'm using IFTTT to send a Google Assistant message to my Windows application via Drop Box. If I say "[keyword] [message]" (for example: "Computer: Play Game of Thrones Season 2 Episode 4") IFTTT will write the text translation of [message] to a file on drop box that my application monitors and from there I can read the [message] and act on it.
What I would like to be able to do is send a reply back to the device that sent the message... For example if I tell my phone to have my computer start a movie on my computer and for whatever reason my app can't find the movie I want to be able to communicate that back to the device that originally sent the message, whether that be my cell phone or tablet or Google Home smart speaker.
I know there is probably no official way to do this but i'm looking for creative solutions (like the one I use to get the message in the first place)... anything at all that works even if it involves multiple third-party services.
There's no good way to send back an acknowledgement through the IFTTT integration. You'd need to build your own Action which would use something like push notifications to communicate between your local device and a cloud-based webhook.
Whenever my app posts ephemeral message to Slack channel (in response to a query by a user), I am unable to get the timestamp of my Slack app response. As I want to delete it once the user has made a selection using one of the buttons. Although I have subscribed to 'message.channels' event, I don't get a notification to my app whenever my app posts in the channel (in response to the user input), therefore, I am unable to get the timestamp of the message which I'll use to delete it. All I want is the timestamp of the message posted by my app so that I can delete it but I am unable to receive the timestamp. Please help!
For e.g. in Giphy app for Slack. Let's say the user invokes the app by calling '/giphy [dog]' where 'dog' is just an example of a search term. The app responds by sending a gif and user can either send it, shuffle to the next one or cancel it. I want a similar capability of cancelling the app response but I need the timestamp of the message in order to do so therefore I am asking for help.
Thanks.
Your approach can not work, because Slack is handling ephemeral messages differently from "normal" messages. They are only visible by one user and can not be modified by API methods (e.g. deletion).
But of course its possible to replace ephemeral messages. Here is how:
Your app can just reply to the interactive message request from Slack with a new message. That new message will by default override the original message including ephemeral messages.
You can reply in two ways:
Directly reply to the request from Slack with a message within 3 seconds
Send a message to the response_url from the Slack request within 30 minutes.
See here for the official documentation on how to respond to interactive messages.
This approach works both with interactive messages and slash commands.
See also this answer for a similar situation.
I know there are a lot of questions related to this subject, but after searching I found out that they all say that if the app is closed then the only way is to fetch the notification again from the server once the app is opened or if the app is opened from the notification then you can handle it in didFinishWithLaunch but using WhatsApp, this is not the case...
I tried sending a message to phone B (which had whatsapp closed), Phone B received the notification. Then I turned off the internet on Phone B and opened the app and still received the chat message.
Can anyone guide me on how to do this?
Probably you should use one of background modes - "remote-notification".
After enabling it, you can send push with payload like
{
"alert": "",
"badge": "0",
"content-available": 1,
"sound": ""
}
if you specify content-available key equal 1, iOS will wake your app and call application:didReceiveRemoteNotification:fetchCompletionHandler: in app delegate and you have some time to proceed push and prepare app (like download this new message to device). Here is Apple docs link with info about push payloads.
However please be aware that this push delivering is not guaranteed. Apple tells
(Newsstand apps are guaranteed to be able to receive at least one push with this key per 24-hour window.)
In our experience you likely receive it most of the time, but not always. For example app delegate callback will not be called if user swiped to close your app.
Also you need to finish execution in 30 seconds or less and call the block in handler parameter (you can check discussion section of method documentation for more details)
Why is sinch sending old deleted messages in onMessageSent of MessageClientListener? These messages were deleted in my Parse backend. I've deleted data of the app on phone, so sinch should n't have this locally. From where is Sinch bringing in all these messages and what should I do to avoid this?
hi sinch evangelist here.
I am going to try and explain this. Parse and Sinch has nothing to do with each other (we have a tutorial where we show how you can save messages to your own backend like parse) So the fact that you delete from parse has nothing to do with Sinch.
Regarding delivery of messages, we keep all messages for delivery to all devices a user might have for 30 days.
So if you i.e install your app on a new device and login we will ship those messages to that device. And we consider this to be a feature :D
I can agree with you that it might be confusing sometimes, since if you uninstall and app you will get all messages again.
I can see a couple of workarounds for this delete of app and deletions of messages.
You could either mark messages as deleted in parse and not display to the user, or look at timestamps.