Skip to main content

Getting Started

Introduction

This documentation is regarding the Solvvy Web Widget API. The Solvvy Web Widget API is used to control the Solvvy Widget embedded in your site.

Installation

Install via HTML

<script type="text/javascript" src="https://cdn.solvvy.com/deflect/customization/{NAME}/solvvy.js" async></script>

Install via JavaScript

var solvvyScript = document.createElement("script");
solvvyScript.type = "text/javascript";
solvvyScript.src = "https://cdn.solvvy.com/deflect/customization/{NAME}/solvvy.js";
document.body.appendChild(solvvyScript);
tip

After Solvvy loads, the Solvvy object containing all the API methods will be added to the global object (window.Solvvy).

Usage

Solvvy sends a custom DOM event (dispatchEvent) with type solvvy_ready. The event is sent to let your website know that Solvvy has been initialized.

Use document.addEventListener to listen for the solvvy_ready event. Once solvvy_ready event is emitted, the Solvvy object will contain all the Solvvy API methods.

document.addEventListener("solvvy_ready", () => {
console.log("Solvvy Web widget API ready to use!");
// 'Solvvy' object available now
});
info

Usually, usage of solvvy_ready is not required. If you want to do something on page load, use this event to know if Solvvy is ready before calling the web widget API methods.

To know more about dispatchEvent, visit https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent