Get started with the Client SDK

The Weavy Client SDK is a javascript library that you add to your existing app or website. The library can be added in different ways depending on your site configuration.

Client script configurator

To obtain a copy of the client SDK you should point your browser to https://{weavyurl}/client to get to the client configurator in your weavy installation. You will be presented with a form where you can configure the client SDK. As you can see the url to the client SDK can be modified to get different configurations of the SDK.

Some examples:

  • weavy.js - Standard configuration of the client SDK
  • weavy.jquery.js - Client SDK including jQuery
  • weavy.min.js - Minified standard configuration

Once you are happy with the configuration, you can reference the configured url directly or download and include the file in your app if necessary.

Plain HTML example

To include the client SDK in a javascript app or your own build environment, you have to load the SDK globally (if you use the standard configuration, jQuery is also required and must be loaded prior to weavy.js). When you have loaded the SDK, you can create a new Weavy() instance anywhere at any point in your app. To avoid timing issues when loading it may be a good idea to make sure you instantiate Weavy at the window DOMContentLoaded event.

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://{weavyurl}/javascript/weavy.js"></script>
<script>var weavy = new Weavy();</script>
If you need to load weavy.js from another javascript, you can for instance use getScript() in jQuery to load it.

Add Weavy to you page

Let's try to add a Posts app to your page. Add the script below to you page and make sure you have an element with the id weavy-container.

Please note! Since we havn't yet added SSO functionality to this example, please make sure you have signed in to the Weavy app (https://{weavyurl}) before running this example.

<div id="weavy-container" style="height:500px"></div>
...
<script>
    var weavy = new Weavy();
    var space = weavy.space({ key: "demo" });
    space.app({ key: "posts-demo", type: "posts", container: "#weavy-container" });
</script>