Send discovery key when creating user in react native

I am developing a react native project using javascript sdk but can’t find any params in connect function or any other function by which I can send discovery keys for user. Basically, what I want to do is create user with discovery keys. Then display list of users and user can make friends with any of those user and chat with them.


First off, welcome to the community! Hopefully you find it very useful as you make your journey with SendBird.

Second off, it looks like the JavaScript documentation for adding discovery keys points to the Platform API to update the user:

The documentation does mention that its best practice to add these items on creation, however looking at the SendBird.d.ts, it does’t look like any method for updating or creating the user supports anything more than UserId, Nickname and ProfileURI

It looks like once you are able to add those discovery keys via a custom method you’ll need to create with the platform API, then you can use the uploadFriendDiscoveries() method to discover friends.

Hi Tyler,
Yes, that’s what even I noticed. Currently, I have done that workaround by using axios to create user and then using js sdk calls in the rest of the places of my project.

Also, I noticed one more thing. If we use platform API to query users, we get discovery_key of users along with their data. However, that is not the case with js sdk.

I would assume this is along the same lines as to why you’re not able to update all of the attributes on the JavaScript SDK. It may be worth contacting support to see if they have a roadmap for when the JavaScript SDK will have feature parity with the Platform API.

Yeah, that’s why I posted here, if someone would comprehend the same. Will contact them.

Hi Rushi,
The user creation and update is recommended to be done by platform API in secure setting, which requires creation of access tokens or session tokens. The discovery key is only available through Friends interface through SDK for privacy protection.

1 Like

Hi imju,

Can you please provide sample or any reference for the same? I am not getting discovery_key in getUser neither am I receiving any event in UserEventHandler after calling uploadFriendDiscoveries.

Have you registered uploadFriendDiscoveries() on UserEventHandler? If so, are you receiving any callback when calling uploadFriendDiscoveries?

Additionally, have you updated users with discovery_keys via the platform API?

1 Like

Yes Tyler, I have done both. While creating user, I am using platform api to add discovery_keys. I have also registered uploadFrinedDiscoveries() but I am not receiving callback. I have exactly followed this guide:

Thanks for verifying that. I’ll do some testing on my end and see if I can get it to work. I’ll let you know what I find.

1 Like


Just wanted to let you know I haven’t forgotten about you. Unfortunately I had something come up at work which has had me sidetracked. I hope to be able to get a working example for you this week.

1 Like

@Tyler Thanks but if you have other priorities please take those up as we have now decided to implement 1-1 group channel rather than showing friends list and chat.

1 Like