I am creating a customer support bot using Ms botframework v4 with nodeJS and directline API 3.0. A customer would talk to the bot and on request, the conversation would be handed over to an agent. If the customer requested to talk to a bot, the customer will wait until the agent becomes available. I want to check if the customer is still active before the agent sends a message to him/her.
wireframe of the bot and the webiste As you can see in the image Jack is in the queue I want to find out a way to check if Jack is still waiting, or he close the window and no longer waiting.
Check out this SO solution I provided. The request is similar to yours in that the OP wants to know how the bot can be notified if a user exits.
The short answer is to use an event listener. Before the window (that houses the web chat instance) is closed, an event is fired. This event is picked up by web chat which sends an activity (message, event, or other) to notify that bot.
From this point, you simply need to forward the notification to the agent that the user has exited the conversation.
Hope of help!
Related
I'm building an application in which we have worked on Payment gateway named flutterwave.
And now the scenario is on every success or failure of a payment, I receive a webhook and then we take further actions such as sending emails, SMS and updating the statuses of the payment in the DB.
For now, we have implemented polling in the client side and for a particular time span if the client receives a status (success or fail) we show it otherwise they can check later it in the payment history page.
Now we want to remove this polling and update users in real time about the success or failure of a payment.
What are the ways by which we can achieve this?
The questions are how we will notify a specific user about the same as we have a multiplatform app and the same user can be logged in different platforms.
What you are looking for is a real-time communication pattern with WebSockets a layer 7 protocol in the OSI model which offers bi-directional communication.
This means that you can establish communication between your servers and your user's browser (client). As a result, you can send notification data to the client and consume and react to the notification, by showing visual cues in your UI for the user to see.
Some examples of implementing WebSockets with Socket.io and Nodejs: https://dev.to/novu/sending-real-time-notifications-with-socketio-in-nodejs-1l5j
There are also paid services that can offer this functionality like Pusher, and I would actually recommend that route at the beginning so you can avoid spending too much time implementing this and focus more on the stuff that matters and is part of your roadmap.
Additionally, you can use Push Notifications as another way to notify your users even when they are not using the app.
I am trying to implement private messaging with socket.io for my mobile applications which have a direct messaging feature like Instagram. Right now, I am using Node.js and React Native. I am kinda new to socket.io. I saw many examples of that. However, one thing is not clear in my mind.
User clicks "send message" button. Then I create a socket connection and the user joins a room with socket id. Then user sends a message to that room.
The problem here is, how other user will get the message? Because at this point, I don't think other user knows the room id. Of course if there is a better solution for that, I am open to every suggestion.
One thing you can do is create a room for each person. When the person logs into your app and connects with socket.io, you'll want to have them automatically join the room with their user id.
Then when someone wants to send them a message, they can just send the message to the room for the receiving user.
However, I think if you are building a messaging app, socket.io is not the right way to go. As far as I know you can't listen on sockets while the app is in the background (and even if you could, it would drain your users' battery life). You should use push notifications instead and use the data field (e.g. zo0r/react-native-push-notification and firebase).
Hi I would like to know if it is possible getting the push notification the server sent while the device os turned off.
How do I configure the app and the Azure Notification Hubs to know the device did not received the notification at the moment it was sent and show them when it gets on (or online) again?
Is it possible to do?
Thank you
Azure Notification hub just tells you a notification has been delivered. There´s no way to get a "received" confirmation if that is what you are looking for. This has actually nothing to do with Azure, it´s just how Apple Push Notification Service (connected with Azure) works.
Apple Push Notification Service (APN) will retain/cache the last (and only the last) notification sent while the device is off. Once the device is online, APN will try to send the notification again. But there is a time limit after which cached notifications will be lost, and that means your notification may never arrive its destiny.
If you really need to get arrival confirmations (ie: like whatsapp confirmations) you should implement it yourself. That would be another question but here are some hints:
You include an uid in the notification payload
You save that uid in your server database, in a table that tracks the "pending notifications".
Device opens the notification and sends an arrival confirmation to the server, passing the uid as parameter => you delete the "pending notification" record on your database table.
How would you resend the pending/lost notifications?
Option 1: Implement some kind of a background job that checks (in time periods. ie: once every 5 minutes) what notifications didn´t arrive and resend them until they are correctly confirmed.
Option 2: when your mobile app starts, send a message to the server telling "hey, I´m online again". Then process and send all the pending notifications specific to that user/device, deleting them from the pending notifications table.
I am learning PubNub and building real time applications with PubNub
PubNub's new debug console allows me to connect several test clients to a channel of my choice - this is cool!
I notice that the debug console has a user named "Console_Admin" that subscribes to the channel. This user stays on the channel even when all test clients have unsubscribed and exited. This user appears to stay even when a new session is started with the Debug console.
I know this since I have another client running on my local machine that is listening to Presence events on the same channel. And the Console_Admin user has not left the channel, despite me having started a "New Session" on the Debug console
Does "Console_Admin" ever unsubscribe from the test channel? Is there a way I can have it unsubscribe?
It appears that eventually the "Console_Admin" user does unsubscribe from the channel
After a while when I logged back on the channel from my local NodeJS client, the occupancy was down to 1 (indicating my local NodeJS client was the only one around)
The new PubNub Debug Console probably has some sort of 'lazy unsubscribe' for the Console_Admin users
I'm very new to node.js and sokcet.io that's why I need to ask you about the plan I have to see if it makes sense or is plain stupid. I need ongoing server/client communication for two reasons: sending real-time notifications to the user when they have one, and two, for chat between users.
Here is my plan for managing notifications:
PHP script finds out user X has a new notification.
Using Elephant.io send a message to server with user X's id as the data.
On the server side, upon receiving the message, if user X is connected emit him a message telling they have a notification.
user X's brower, Upon recieving the message, uses AJAX to poll the database and receive the text for the notification.
For chat, this is my plan (messages should be save on DB):
When user X submits a chat message to user Y, use ajax to send the text to a PHP script and save it on DB. On success, use elephant.io to send a message to user Y telling them that they have a new chat message.
User Y's browser, after receiving the server message, uses AJAX to poll a php script to receive the new text.
Do you think these plans are superior to short polling using AJAX? I appreciate any comments to improve them.
Finally,I'm curious to know how reliable these technologies (node.js, socket.io, elephant.io) are. Do they work well when the server becomes busy? How do they handle exceptions and errors ,etc.