# Send discovery key when creating user in react native

**URL:** <https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591>\
**Category:** JavaScript\
**Tags:** chatsdk\
**Created:** [July 7, 2020, 11:19am UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591 "2020-07-07T11:19:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rushi\_Thakker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rushi_thakker/32/339_2.png) [@Rushi\_Thakker](https://community.sendbird.com/u/Rushi_Thakker)\
**Post date:** [July 7, 2020, 11:19am UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/1 "2020-07-07T11:19:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 7, 2020, 2:32pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/2 "2020-07-07T14:32:45Z")

</div>

@Rushi_Thakker,

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:

> **[User | Platform API Chat SDK Documentation | Sendbird](https://docs.sendbird.com/platform/user#3_update_a_user)**
>
> Users can chat with each other by participating open channels and joining group channels. They are identified by their own unique ID, and may have a customized nickname and profile image. Using the API, you can manage the various attributes of each...

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.

---

<div class="post-metadata">

**Author:** ![Rushi\_Thakker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rushi_thakker/32/339_2.png) [@Rushi\_Thakker](https://community.sendbird.com/u/Rushi_Thakker)\
**Post date:** [July 7, 2020, 2:52pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/3 "2020-07-07T14:52:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 7, 2020, 5:01pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/4 "2020-07-07T17:01:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rushi\_Thakker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rushi_thakker/32/339_2.png) [@Rushi\_Thakker](https://community.sendbird.com/u/Rushi_Thakker)\
**Post date:** [July 7, 2020, 5:21pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/5 "2020-07-07T17:21:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![imju](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/imju/32/49_2.png) [@imju](https://community.sendbird.com/u/imju)\
**Post date:** [July 8, 2020, 7:08pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/6 "2020-07-08T19:08:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rushi\_Thakker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rushi_thakker/32/339_2.png) [@Rushi\_Thakker](https://community.sendbird.com/u/Rushi_Thakker)\
**Post date:** [July 9, 2020, 6:49am UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/7 "2020-07-09T06:49:17Z")

</div>

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**.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 9, 2020, 2:43pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/8 "2020-07-09T14:43:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Rushi\_Thakker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rushi_thakker/32/339_2.png) [@Rushi\_Thakker](https://community.sendbird.com/u/Rushi_Thakker)\
**Post date:** [July 9, 2020, 3:06pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/9 "2020-07-09T15:06:26Z")

</div>

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:

> **[Group Channel Advanced | JavaScript Chat SDK Documentation | Sendbird](https://docs.sendbird.com/javascript/group_channel_advanced)**
>
> This page explains the advanced features for group channels. Some of them are the premium features available only to a paying user.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 9, 2020, 3:19pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/10 "2020-07-09T15:19:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [July 13, 2020, 8:11pm UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/11 "2020-07-13T20:11:48Z")

</div>

@Rushi_Thakker,

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.

---

<div class="post-metadata">

**Author:** ![Rushi\_Thakker](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/rushi_thakker/32/339_2.png) [@Rushi\_Thakker](https://community.sendbird.com/u/Rushi_Thakker)\
**Post date:** [July 14, 2020, 5:08am UTC](https://community.sendbird.com/t/send-discovery-key-when-creating-user-in-react-native/591/12 "2020-07-14T05:08:24Z")

</div>

@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.
