How to add typing indicator in React webchat - reactjs

I'm creating a bot application using bot framework web-chat and react js. I have almost completed the project. Now i just want to add typing indicator to my application. As i'm calling directline webchat to the application, How can i do that?

Web Chat is a Direct Line client, which means it handles the user side of the conversation. If you want the bot to send a typing indicator for the user to see then you need to handle that on the bot side. You can learn how to send a typing indicator here. You haven't said what SDK you're using, but you may also be interested in the typing middleware.
Web Chat does have a sendTypingIndicator option but it's apparently for indicating to the bot that the user is typing in case the bot is programmed to use that information.

Related

How do I send notification to button with React native firebase cloud message?

I have a post page, and this page will have a button when the correct answer to the question asked in the post is given, just like in stackoverflow, and when this button is pressed, I want the people who follow this post to be notified. I want to send notifications using a react native cloud message.
Calls to the Firebase Cloud Messaging API to send a message require that you specify the FCM server* key in your code. As its name implies, this key should only be used in server-side code, or in an otherwise trusted environment. The reason for this is that anyone who has the FCM server key can send whatever message they want to all of your users. For this reason it is not possible to send a message directly from one device to another device/user through FCM, the messages must always be sent from a trusted environment.
The common approach is to create a custom server-side endpoint/API (using Cloud Functions, or a server that you control) that makes the FCM call on the user's behalf, and then call that endpoint from within your React Native app. For an example of this, see use-case notifying users when something interesting happens in the Firebase documentation.

How send notification into ms teams user from custom tab

I'm designing a custom team tab using React that calls third party API, I need after executing the API successfully, user gets notified . What is the best way to achieve this? I used Bot in my project, but not sure how can I call it from my custom tab class. I'm aware of the existence of proactive messaging, is it the only way to do it? If it is, a pointer on how to implement it to a custom tab would be appreciated.
If you're wanting to message the user 1-1 (like in the personal app), then proactive messaging is definitely what you need (inside a Team, there are other options), and considering you have the bot already in place that's perfect. The only thing you might be missing are the details required to send the actual proactive message (the best time to get them is when the bot is first installed by the user). In particular, you need ConversationId and ServiceUrl.
With regards the concept of Proactive Messaging, basically once the bot is installed, and you have the required values, you can -send- the message from any backend code at all. That can include, for example, custom tab's backend api. You need to identify the user, which you can do using the Teams Context (it's not the safest way but it's the easiest), and then look up the values in your own backend store (e.g. database or whatever) to get the ConversationId and ServiceUrl, then just message the user in your backend.

Twilio Video in ReactJS - how do I access the room object after the initial setup?

My app is built in reactjs. There are a lot of "how tos" for the twilio video javascript sdk, but very little for people who are building in reactjs.
My problem is this: I have successfully implemented the construction and subscription of my users to a room. This is the process:
User 1 lands on user 2's profile, and decides to call. He presses the "call" button.
The server creates a call in the database, contacts Twilio with his info, and returns a twilio token to him.
He then connects to the room, publishes his local audio and video track to it, and waits the invitee
User 2's browser is informed of the call through a push notification from firebase messaging. He is sent a Twilio token from the server in that message, as well as information about the call and the room. His browser pulls up the "incoming call" page.
Assuming he answers, he begins publishing his own local audio and video tracks, and connects to the room.
The video and audio tracks of the other participant are attached to a couple react refs pointing to specific divs on the dom.
The video call is now progressing.
All this works well. However, my question is how do I access the actual room object at this point? Specifically, I want to mute the audio and video tracks based on input from the user. There are enable and disable methods in the Twilio library, but how to get to the tracks? The room creation and set up templates I have found online, which work, do not produce an object which can be modified, after the initial set up. All I get from let room = Video.connect... is a promise. If I use the Video.connect method AGAIN, it seems overkill - why contact Twilio again with my token when I already have a room in progress - and doesn't seem to work when I try.
Any help would be appreciated!

creating a link that will open facebook messenger and send a message

i'm creating a registration code for users to a facebook messenger bot i am writing.
instead of asking them to open a chat with my bot, and type in the registration code, i would like to provide them a link that will open their facebook messenger on a chat window with my bot, and send the registration code automatically.
i saw a link that opens the chat window (https://m.facebook.com/messages/compose?ids=USER_ID) but can't get it to send a message too.
if you know how to do that, or have an alternative suggestion, i would appreciate the help.
Check out the new referral webhook-reference. It gives you a way to link users directly to your bot with support for passing arbitrary parameters via the link.
So a possible approach would be:
Make sure your bot is subscribed to the messaging_referral event.
Craft your bot's m.me link to include the registration code in the ref param e.g http://m.me/mybot?ref=REGISTRATION_CODE. if you're interested in security you might consider encrypting the code
Send the link(s) to the user. When the user click's the link, they're directed to your bot on messenger and once they initiate a session with your bot, you'll receive a messaging_referral event at your webhook with a payload similar to
{
"sender":{
"id":"USER_ID"
},
"recipient":{
"id":"PAGE_ID"
},
"timestamp":1458692752478,
"referral": {
"ref": "REGISTRATION_CODE",
"source": "SHORTLINK",
"type": "OPEN_THREAD",
}
}
You can then evaluate the ref value and send your desired feedback to the user.
Every messenger app use it's own link. For facebook https://m.me/XXXXXXXX where XXXXXXXX - page name.
I always use https://msng.link/fb-messenger.html for generation FB link. Better to remember one website and genereate all messengers what you need.

Send data from silverlight application to a particular user in mvc application

I have an mvc application where you have to be registered to log in. So you have your profile page and etc... As a part of the application I have a chat for all users (silverlight page). You enter the chat from your profile page. You have a list of online users there (who logged in on the site and not necessary entered the chat page) but exchange messages you can just with users who did enter the chat page. Otherwise they won't see them. Here is my problem.
So, I want to realize next functionality: if user who didn't enter the chat page was chosen by another to start conversation in chat (silverlight), he should get a pop up message on HIS profile page (mvc) with invitation to the chat. I understand how to send data from silverlight to mvc through WebClient and json format. I don't understand how to reach particular user's profile page. I can think just about some database table with this kind of invitations and some timer on the profile page to check on them.
Please express your ideas, thoughts or opinions in this matter. I would appreciate any help. Thanks in advance.
Maybe you should check out SignalR.
Like you mentioned you need some way to signal another client about the message by checking periodically. SignalR does this for you and in modern browsers uses Websockets to make it even better.
It is very easy to setup and you can build a chat application in a few lines of code. Without the need to save messages in a database (when you don't want to).
Check out this blog post for a sample chat application:
http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

Resources