Getting started with Weavy
Follow the steps below to get started with Weavy in minutes!
1. Create account
If you haven’t already, go to https://www.weavy.com and sign up for a free account.
2. Create environment
Now go to your account dashboard and create your first environment. The entry-level is free, making it a great starting point. Make a note of the environment url as you’ll need it later.
3. Create API key
On the environment management page, scroll down and create an API key. Take note of the created key as you’ll need it the next step.
4. Issue access token
For a Weavy to be able to fetch and render data you need to supply it with an access_token
for your logged in user.
In a real-world application, issuing access tokens is done with a server-to-server call from your backend to the Weavy environment,
but in this guide we’ll use a curl
command to simplify things.
Replace {WEAVY-URL}
and {API-KEY}
with the values from step 2 and 3 above and then run the following command in your terminal.
curl -X POST {WEAVY-URL}/api/users/demouser/tokens -H "Authorization: Bearer {API-KEY}"
The response should look something like this:
{"access_token":"wyu_qf2llm...","expires_in":3600}
Now copy the access_token
from the response since it’s needed in the final step.
5. Add component
Finally, you’ll want to add a Weavy component to your application.
Copy the snippet below and replace the {WEAVY-URL}
and {ACCESS-TOKEN}
placeholders.
<!doctype html>
<html>
<head>
<script src="{WEAVY-URL}/uikit-web/weavy.js"></script>
<script>
const weavy = new Weavy();
weavy.url = "{WEAVY-URL}";
weavy.tokenFactory = async () => "{ACCESS-TOKEN}";
</script>
</head>
<body>
<wy-chat uid="test-chat"></wy-chat>
</body>
</html>
You should now have a fully functional chat in your application – send your first message and start chatting away.
If you want to try out Weavy real quick and don’t want to mess around in your existing application just yet, you can use a coding playground like JSFiddle - just paste the snippet above in the HTML-part, edit the
{WEAVY-URL}
and{ACCESS-TOKEN}
and run it!
6. Troubleshooting
If things are not working as expected, check the output in the browser console and/or ask for help in the support chat.
Next steps
This guide was intentionally very simple to get you started quickly, and you’ve taken some shortcuts such as hardcoding the access_token
.
As a next step we suggest reading more about installing Weavy and how to authenticate users.
Later on you’ll probably want to customize Weavy to make it fit better into your UI. You might also want to learn more about importants concepts, the Web API and how to use webhooks etc.
Also, if your app is built using a specific framework or platform and you are curious about how to integrate Weavy, you should check out our webpage for demos and in-depth and tutorials.