Detect disconnect Microsoft webchat (Backend botframework) - azure

Is there a way for the backend to detect the webchat disconnected (ie, user closed page, navigated away, browser quited)?
There seems to be no out-of-the-box event for it. We rolled our own event (store.dispatch({...})) and attached it to the beforeunload event, but since it sends a webrequest, thats not supported.
I was thinking about using navigator.sendBeacon, but that will end up with a lot of unwanted events since that should be used on onVisibilityChanged (thus, webchat can still be active, but on a hidden tab). It seems to me that more people would want to know if the enduser is still active.
Using Botframework

Related

No XEP-0333 Chat Markers in XMMPP Openfire backend - how to solve it?

We have an Openfire XMPP/Jabber server setup (with a NodeJs backend and React frontend).
Chat is a feature embedded in the app (NOT an overlay or window that is always visible). So the user has to navigate to a specific page to access the chat interface.
It is working via websockets and messaging sending is working fine. We have a React frontend.
The challenge is that XEP-0333 Chat Markers is not supported by Openfire (the spec never become production ready).
Therefore we need to know how can we implement this feature so that :
A users knows when they are online that they have an unread message (and later, how many unread message they have). For example, if they are not in the chat window and messages are arriving, we need to indicate that in the header of the app so they see it)
if a user goes offline, and comes back online but NOT into the chat window, how can we know if they have unread messages and notify them of that?
My understanding is that somehow we have to keep track of unread messages (eg perhaps in indexedb or local storage or even in postgres backend) and after the user reads a message, we delete it from storage. If the storage still has records for that user then clearly those are the unread messages.
Obviously we don't know if they actually READ the message, but we can assume that if the chat window is open and visible (ie. active tab in their browser) that any messages delivered have been read.
So if our application tab is active, but user is not in chat, and a message arrives, we store it. When they open chat and click on the sender, we remove it from storage.
Has anyone solved it this way? (looking for links to React or JS/TS code)
Is there a better way? (links to other solutions would be helpful, esp. code)

ms teams custom app starting a chat session with a bot

I'm building a teams app that contains some tabs and a bot.
Is it possible to, when an action is performed on a tab (i.e. clicking a button), initialize automatically a chat with the bot, or send a specific message?
Tks
Based on the comments above, what you're looking to do is implement "pro-active" messaging, where the bot itself initiates the conversation. It's definitely possible, and you can read more to get started here and here. The most important thing to know is that your user has to have installed the bot already, to get a "conversation context", but if they've installed the app, which includes the bot, to get the tab, then you're fine. You need to get some variables when they do install the app, which you hook into the conversationUpdate event to get access to. Give it a go and let me know if you have specific questions, here on SOverflow.

Carousel in Bot Framework - continuously updating from database - upon scrolling it?

Is it possible that carousel in Bot Framework (where it is allowed - like Messenger, Bot Emulator etc.) updates continuously (according to a database from which it reads data) after it was initially rendered and sent as a message to the user - without rerendering the whole carousel and resending it to the user?
Something like - .onFlipHandRightOnCarousel or .onFlipHandLeftOnCarousel - delete void HeroCards (where in database they are flagged as 'inactive') from already rendered carousel and rerender this new carousel without resending a new session.send(msg) to the user?
Modifying messages that have already been sent means modifying the chat history. This functionality will be highly channel-specific as it depends on how the client handles the history and what the client allows users to do to the history. Many channels do not support this functionality but some do. Generally speaking, if you as a user can go back and delete or edit messages in the chat history then a bot can too. If you as a user cannot then you should not expect a bot to be able to do it. But if you're working with a channel that does allow history edits then I imagine you should be able to edit the carousels if those are also supported.

Facebook Graph API - Postback Event Issue

There is a problem when the user is clicking a postback button and the internet connection is not stable or is reconnecting from the internet. After reconnecting to the internet, it will look like the user has successfully clicked the button (Labeled as Sent) but my webhook is not getting any postback events. So the user does not get any response from my bot unless they click the button again with a stable connection.
I already sent a support ticket to Facebook regarding this. I'm asking help for a workaround this issue, that will continue the conversation or maybe a reminder that the user must click the button again to progress.
I'm using Node.js and Microsoft Bot Framework for this.
While I am unfamiliar with Facebook Messenger for bots, as far as I can tell, a postback button seems to work the same as any other button, with added async functionality. The intermittent internet connection appears to be interrupting that async call. There isn't a work around that I know of, as your bot is still waiting for a response from your user, a response that won't come, if your user thinks they've already sent info to the bot.
I would put a proactive/welcome message in the very beginning of your bot dialog that if the user is connecting with a weak/intermittent internet connection, to resend their response if the bot doesn't respond. If you're using the bot for sales purposes, then a message to not use the bot unless they're using a stable internet connection as they could accidentally send a purchase order twice, would be more appropriate.

How to set Slack bot presence "online" when using Events API

I have a bot for Slack implemented using RTM (https://api.slack.com/rtm) which works well but requires WebSocket connections for each user active all the time. After rewriting it using new Events API (https://api.slack.com/events) the bot works well too but appears "away" all the time. Apparently Slack determines bot's status by checking WebSocket connection which is not good as my goal is to use Events API only. Is it possible to use Events API and make a bot appear "online"?
It's one of the two reasons that we don't move to Events API for our bot. The second is that typing events are not send with Events API.
For what we know (dev4slack community, Slack's direct contacts), Slack works at make able to indicate online presence without the RTM, for bots using Events API. That seems essential, without that, Events API seems to be a half solution.
Now with the RTM gone. Slack announced that the only way to toggle your bot presence is via the app management page.
Official Tweet here.

Resources