Working with the Widget Javascript API

**Please note this API only works with the old legacy Groove widget.**

After the Groove Widget is successfully loaded on a host page it exposes the following functions:

GrooveWidget.open(options) Opens the widget. options is an optional key/value object argument. Currently supported options:

  • category — if this option is present, the widget will be opened on new ticket tab with ticket category, specified as the option's string, value preselected

GrooveWidget.close() Closes the widget.

GrooveWidget.toggle() Toggles the current widget state between opened and closed states.

GrooveWidget.options(options) Accepts widget options as a key/value object. Currently supported options:

  • email - sets the email field
  • name - sets the name field
  • about - sets the about field

For any initialization code which needs to reference the API functions you should use the grooveOnLoad parameter which tells the browser to wait until the widget finished loading and then invoke a JavaScript function of your choosing. You just need to add the grooveOnLoad parameter to your widget snippet:

Examples

Set the widget email field to test@example.com:

GrooveWidget.options({email: "test@example.com"}); 

You can also use the Widget API to supply additional information about who is submitting a ticket or chatting. This information will then be visible when you're either chatting with the end user or responding to his ticket on the right sidebar below his name and email:

GrooveWidget.options({about: 'Additional information about this user goes here...'});