Get started
Add Weavy to your React app
Prerequisites
This tutorial is based on React v16 or later.
This tutorial is based on React v16 or later.
We're adding our group chat component to your React app.
Want to see how it looks? Well, you're in luck - you can try it out right here with all the bells and whistles.
We need an API key to communicate with the Weavy backend.
Before you can work with Weavy, you'll need to sign up for an account or sign into your existing account.
npm install @weavy/uikit-react
curl WEAVY-URL/api/users -H "Authorization: Bearer WEAVY-API-KEY" --json "{ 'uid': 'UID', 'name': 'USER-NAME' }"
WEAVY-URL
and WEAVY-API-KEY
with your backend URL and API key.You haven't selected an API key. If you do - code snippets and files you download will automatically be updated with API key and backend URL.
For our chat component to know who we're rendering for, we must issue an access token that we'll pass on to the UIKit.
curl -X POST WEAVY-URL/api/users/UID/tokens -H "Authorization: Bearer WEAVY-API-KEY"
WEAVY-URL
and WEAVY-API-KEY
with your backend URL and API key.You haven't selected an API key. If you do - code snippets and files you download will automatically be updated with API key and backend URL.
Issuing an access token using Curl is for demo purposes only. Access tokens should be created from your backend; read more about authentication and access tokens here.
import { useWeavy, WyChat } from "@weavy/uikit-react";
export function WeavyComponent() {
useWeavy({
url: "WEAVY-URL",
tokenFactory: async () => "WEAVY-ACCESS-TOKEN"
});
const uid = "weavy-chat";
return <WyChat uid={uid}/>;
}
WEAVY-URL
and WEAVY-ACCESS-TOKEN
with your backend URL and the issued access token.You haven't selected an API key. If you do - code snippets and files you download will automatically be updated with API key and backend URL.
You should now have a group chat component up and running in your React app. This tutorial's goal was to quickly introduce the concepts of Weavy, especially the understanding of creating users and issuing access tokens.
Now it's time to start building for real - follow our recommended next steps below.
We need an API key to communicate with Weavy for authentication, etc
Learn about the communication between your app and Weavy
Complete reference of all endpoints in our Web API
Chat with our developer success team and get the help you need
Get answers faster with our tailored generative AI. Learn more about how it works
This is a custom LLM for answering your questions. Answers are based on the contents of the documentation and this feature is experimental.
To access live chat with our developer success team you need a Weavy account.