Services

A service configures the chat behavior for a web page. You can reuse the same service on multiple web pages or web sites. There are no limits on the number of services that you can create.

A service can be embedded into a web page via a service snippet. The form of the snippet is shown below. When using this snippet for your web page, replace SERVICE_ID with the id from one of your services. Note: Watch for and eliminate any word wrap when cutting and pasting the snippet below into your web page.

<!-- Place this div in your web page where you want your chat widget to appear. -->
<div class="needs-js">
  JavaScript disabled or chat unavailable.
</div>
<!-- Place this script as near to the end of your BODY as possible. -->
<script type="text/javascript">
  (function() {
    var x = document.createElement("script");
    x.type = "text/javascript";
    x.async = true;
    x.src = (document.location.protocol === "https:" ? "https://" : "http://") + "libraryh3lp.com/js/libraryh3lp.js?SERVICE_ID";
    var y = document.getElementsByTagName("script")[0];
    y.parentNode.insertBefore(x, y);
  })();
</script>

The simplest services are associated with a single queue (or user) and a single widget. But services can contain complicated routing behavior whereby you can connect guests with specialized operators when available and more generalized operators otherwise. We call this service rollover and is controlled by the service levels associated with a service.

The widget behavior for a service is controlled by its service type.

The online and offline appearance of a service is fully customizable and supports HTML.

Authentication

LibraryH3lp supports cookie-based authentication. To learn more, you can read the details on authentication.

HTTP and HTTPS

Requests are served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.

Service Instance Resource

A Service instance resource represents a single service managed by the user account provided during authentication.

Resource URI

/2011-12-03/services/{ServiceId}

Resource Properties

A Service resource is represented by the following properties:

Property Description
id Unique integer identifier for a service.
name A descriptive string for the service. Default is new service.
type An integer indicating the service type. Default is 1 (embedded).
nojs A string containing what is displayed when a guest's browser does not have JavaScript enabled. Default is JavaScript disabled or chat unavailable.
offline A string containing what is displayed when a service is offline. Default is Chat is offline.

HTTP GET

Returns a JSON response containing a representation of a service, including the properties above.

Example

GET /2011-12-03/services/1933

[
  {
    "id": 1933,
    "type": 1,
    "nojs": "JavaScript disabled or chat unavailable.",
    "offline": "Chat is offline.",
  }
]

HTTP POST

Not supported.

HTTP PUT

Allows you to modify the properties of an existing service.

Optional PUT data

You may include, as JSON PUT data, any of the properties of service excluding id.

Response

Always returns a JSON response containing the representation of the service resource.

Example - change service type to follow-me

PUT /2011-12-03/services/1933
{
  "type": 3,
}

[
  {
    "id": 1933,
    "type": 3,
    "nojs": "JavaScript disabled or chat unavailable.",
    "offline": "Chat is offline.",
  }
]

HTTP DELETE

Removes a service.

Response

Returns a JSON response with the following properties:

Property Description
success Boolean indicating if the request was successful.
message Optional. If success is null, message is a string describing the reason for the failed request.

Example

DELETE /2011-12-03/services/1933

{
  "success": true
}

Services List Resource

The Services list resource represents the set of Services managed by the user whose credentials were used to make the API request.

Resource URI

/2011-12-03/services

HTTP GET

Returns all the services managed by the user whose credentials were used to make the API request.

Response

Returns a JSON response containing a list of Service resources.

Example

GET /2011-12-03/services

[
  {
    "id": 1933,
    "type": 3,
    "nojs": "JavaScript disabled or chat unavailable.",
    "offline": "Chat is offline.",
  }
]

HTTP POST

Allows you to add a new service.

Required and optional POST data

You must include, as JSON POST data, the name and type properties of a service. You may include the nojs and offline properties.

Response

If successful, returns a JSON response containing the resource representation of the newly created service. If unsuccessful, returns a JSON response with the following properties:

Property Description
success Boolean indicating if the request was successful.
message Optional. If success is null, message is a string describing the reason for the failed request.

Example

POST /2011-12-03/services
{
  "name": "a new service using pop-up",
  "type": 2,
}

{
  "id": 2345,
  "name": "a new service using pop-up",
  "type": 2,
  "nojs": "JavaScript disabled or chat unavailable.",
  "offline": "Chat is offline.",
}

HTTP PUT

Not supported.

HTTP DELETE

Not supported.