# Strugling with integration of Amitychat SDK + NextJS

**URL:** <https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189>\
**Category:** TS SDK\
**Created:** [March 10, 2024, 9:27pm UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189 "2024-03-10T21:27:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hdobi](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@Hdobi](https://forum.social.plus/u/Hdobi)\
**Post date:** [March 10, 2024, 9:27pm UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/1 "2024-03-10T21:27:26Z")

</div>

Hello, this is the first time I am integrating amitychat + nextJS. and I am having issues sending messages to a single user.Maybe I am not good enough to read the documentation. I use the same code from the official Amitychat github repo, but that code is giving an error. If anyone can help me, I will be very thankful.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [March 11, 2024, 5:22am UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/2 "2024-03-11T05:22:30Z")

</div>

Hello @Hdobi , Regarding your issue, we would like to ask for additional information:

1. The version of the TS SDK you are using.
2. The error you encountered (please provide a screenshot, code, and response).
3. Your full code.

---

<div class="post-metadata">

**Author:** ![Hdobi](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@Hdobi](https://forum.social.plus/u/Hdobi)\
**Post date:** [March 11, 2024, 10:20am UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/3 "2024-03-11T10:20:27Z")

</div>

Thank you for replying. I have no issue posting my code here, but I want to ask that I see a lot of code about amitychat, like sending a message in a group or creating a group. There is no code in the github repo to send a message to one person like a normal 1 to 1 chat.  
**code for group chat.**  
“use client”;  
import { AmityUiKitProvider, AmityUiKitChat } from “@amityco/ui-kit”;  
import { useUser } from ‘@auth0/nextjs-auth0/client’;  
function page() {

const apiKey = “”;  
const { user } = useUser();

return (

  

  
\<AmityUiKitProvider  
key={user?.sub}  
apiKey={apiKey}  
apiRegion={‘EU’}  
apiEndpoint=“[https://api.sg.amity.co](https://api.sg.amity.co)”  
userId={user?.sub}  
displayName={user?.name}  
\>  
  

```
  </div>
</div>

```

)  
}

export default page  
Even in my provided group chat code, every new user is automatically added to the group.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [March 11, 2024, 11:18am UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/4 "2024-03-11T11:18:21Z")

</div>

@Hdobi I’ll pass this information to the relevant team and keep you updated.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [March 13, 2024, 11:04am UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/5 "2024-03-13T11:04:08Z")

</div>

Hello @Hdobi,

To create a 1-1 chat, please refer to our documentation available here: [Creating a Conversation Channel](https://docs.amity.co/amity-sdk/chat/channels/create-channel#create-conversation-channel).

Our GitHub repository is just an example and may not cover everything. For specific cases, please see our documentation for detailed instructions.

**Chat docs:** [Chat | Amity Docs](https://docs.amity.co/amity-sdk/chat)

---

<div class="post-metadata">

**Author:** ![Hdobi](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@Hdobi](https://forum.social.plus/u/Hdobi)\
**Post date:** [March 20, 2024, 7:27pm UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/6 "2024-03-20T19:27:13Z")

</div>

Hello, I tried my best to setup everything, but I am having issues. Can you please provide me with the with the proper code flow for that 1-to-1 chat? because I tried hard to figure it out, but that code is still not working.

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [March 21, 2024, 10:12am UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/8 "2024-03-21T10:12:44Z")

</div>

@Hdobi We would like to request more details about where you are encountering issues in the implementation of 1:1 chat. Is it during the creation process or when querying messages?

---

<div class="post-metadata">

**Author:** ![Hdobi](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@Hdobi](https://forum.social.plus/u/Hdobi)\
**Post date:** [March 31, 2024, 4:51pm UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/9 "2024-03-31T16:51:00Z")

</div>

hello, I also have a problem with group message, like when new use login in amitychat than the amitychat group automatically add that person into previous any random group or groups, but it should only add if someone go into group setting and add the new person. it should not do on autho mode when every new user come on amitychat, here is the code of group chat. “use client”;  
import { AmityUiKitProvider, AmityUiKitChat } from “@amityco/ui-kit”;  
import { useUser } from ‘@auth0/nextjs-auth0/client’;  
function page() {

const apiKey = “”;  
const { user } = useUser();

return (

  

  
\<AmityUiKitProvider  
key={user?.sub}  
apiKey={apiKey}  
apiRegion={‘EU’}  
apiEndpoint=“https:api.sg.amity.co”  
userId={user?.sub}  
displayName={user?.name}  
\>  
  

```
   </div>
 </div>

```

)  
}

export default page

---

<div class="post-metadata">

**Author:** ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)\
**Post date:** [April 1, 2024, 9:40am UTC](https://forum.social.plus/t/strugling-with-integration-of-amitychat-sdk-nextjs/1189/10 "2024-04-01T09:40:08Z")

</div>

@Hdobi From the issue you’re facing, could you please provide a screen recording and the full code snippet where you encounter the problem?
