Joining a twilio channel with a user who already exists - react-native

I have a React Native app which uses the Twilio Chat API to connect to a channel. I am using this repo: https://github.com/twilio/TwilioChatJsReactNative
I am using this.generalChannel.join() to join my general channel. This works for any new user.
I have the token generator running in the background as per the documentation in the readme of the repo.
However, when I try to login with an existing user's name, I get an error with the statusText of 'Member already exists'.
How can I log in to my Twilio Chat channel with an existing user?

In the channel object there is a state object. In there is status, which will equal joined if the user is already a member of the channel. Just do something like if(channel.state.status !== "joined") channel.join().

There is a distinction between member and user. A User is a user of the entire chat app. A Member is an instance of that a user being in a channel. You're trying to join a channel that the user is already a member of. Basically you don't need to call join() there.
A user can be a member of multiple channels, but can only be a single member in a given channel.

Related

how to get load member list who has chatted with user A in PubNub

Am trying to integrate the PubNub chat with react native, so I just using PubNub API for it.
I know that PubNub is mainly working with channels. so group chats there is no issue.
But using PubNub with one-to-one means how the channel will be created with both sides and the users should we connect at the same channel does direct channel will create the channel automatically or manually we have to create. 
how should I display profile pic and name for both users in the member's list for both sides because User A will see User B pic and User B will see user A pic in chatted History 
I assume that you want to learn about 1-1 chat architecture.
I recommend that you read Inbound Channel Pattern post.

Display user name on remote videos on Group chatting, Raise hand feature on Group chatting

We have integrated agora rtc for group video chatting using vue js. Would like to display corresponding user name on remote videos . I am unable pass user name custome property through stream as like userid. How to solve this issue. is there any way to pass custom object to send through stream to remote users.
Raise hand feature also need to do. How to do .
Could you help me
I'd recommend using the Agora RTM SDK for your use case. It lets you send messages to other users.
Using RTM whenever you join an RTC channel you can send a channel message to RTM with your name. That way other users can receive and display your name.
For raise hand, you can send a message with a request (eg: {"raise": "true"}), the remote user can then accept/reject the request and send the corresponding message back. If accepted you, you read the message and unmute the local user using RTC method.
You can find a quickstart app for RTM here.

Identify unique user in Dialogflow V1

So I am testing out Dialogflow and one of the first questions I have is: how does my bot know who it is talking to? I need to identify a user and keep that information for as long as I can. The basic scenario being:
User starts his/her first conversation.
Chatbot send a fulfillment request to the server trying to match a user within its own database.
The user is found, the information (as a JWT or some other token) is sent back to Dialogflow and stored there for further communication. In reality, this part would involve asking for user email, sending a verification code to that email and then verifying the user with the code.
User then starts chatting with a bot and all fulfillment requests get the unique token stored for this very user, so that my REST API knows which user is being served with the response.
Couldn't find anything about it in the docs (maybe I am looking in the wrong places).
There will be several integrations, like Messenger, Viber, Telegram. I dunno, maybe those APIs add some unique information on the user?...
Thanks for the help!
Sorry, I know it's been a while, but maybe this will help someone else.
The right solution here is a user id, not a session id. A user id is provided by the chat platform (Facebook, Slack etc) and is consistent across sessions for the same user.
To get the user id, go to the Fulfillment tab, enable the editor and use a function like so:
let r = request.body.originalDetectIntentRequest
//this makes sure that you're on an integration
if (r["source"]){
return r.payload.data.sender.id;
}
To tie together ids from different platforms, you probably have to have some kind of log-in process every time you encounter a new id on a platform.
Pop,
Sessions are built in already into DialogFlow requests to your fulfilment service, if you check the payload you will find a sessionId, it remains the same for the same client until it expires.
However if you want to identify the user from any of the clients that you can connect to DialogFlow like Messenger then from the same request payload to you you will notice that there is an object named originalRequest that is only available when requests are coming from those clients.
You can personalize those users response eg using their FB firstname in a message to them.

How to get authenticated by Telegram bot in Group chats?

Please kindly someone explain me how can the Telegram bot could understand who is sending the command in group chats and respond it with the the unique answer which is just for that user.
Surely in this case security issues should be considered and a user must not send command as another user.
I guess I can use username to send along with command.
Any suggestions...
The Message Object contains two objects apart from other objects:
Chat, message['chat'] which represents the Chat from which the message is coming. In your case the group.
User, message['from'] which represents the user that sent the message/command.
So it's easy to differentiate which user sent the message. And in case of Private chats, both the Chat object and the User Object are same.

How to pass user authentication through jitsi-meet external API

I am building chat capability in my web application. I am using jitsi as our chat server. There can be 2-4 user in a video chat session. These session will be locked. Web application will initiate the chat and will control who can join the chat room.
I am trying to embed jitsi meet inside an web page using jitsi-meet
external API listed here
https://github.com/jitsi/jitsi-meet/blob/master/doc/api.md .
Our jitsi-meet is not open to public and protected with XMPP
authentication. How can I pass the authentication information through
jitsi-meet API?
I also want to lock the conference room with password. Does jitsi-meet API
have this option?
I am new to this domain. So if you know a better solution please suggest.
Yes there is:
api.executeCommand('password', 'The Password');
Best way I am using with a php/mysql app is generating a room with a random name (usually complex) from the 1st user (the caller), protecting that room with a password and sending the rest of the users a message through the app so that they can connect to the same room with the first.
This way the first user is the end point and the rest connect to the room the first user made.
You should check the other users are online at the time the room is created. The only parameter is the room name which must at all times be unique. Maybe count participants after you enter. When the last user leaves the room, the room gets destroyed. So the users hold the room.
You can also send a mail instead of an internal message.
You need to add JWT token-based authentication in jitsi then you need to generate JWT token & pass it through Jitsi's external API, in this way:
const options = {
...
jwt: '<jwt_token>',
...
};
const api = new JitsiMeetExternalAPI(domain, options);
for more detail, you should checkout Jitsi's iframe docs