All Collections
Advanced Customization
How to request an agent programmatically
How to request an agent programmatically
If you don't want to enable the agent request button, you can use our Javascript SDK to create a custom solution.
Joe avatar
Written by Joe
Updated over a week ago

What is an agent request

When an agent request an agent, available agents (agents with https://app.upscope.io/ open) will receive a ring and will be able to assist the user in need.

Using the button

We include a pre-built button to request an agent, and this can be enabled and customized from the general settings.

You can alternatively use javascript to create your own request button and customize its look and feel.

Javascript button

To use our Javascript SDK, make sure the page has the code you find on upscope.io/install installed.

Knowing when an agent is online

To know when an agent is available (and only show the button at that time), you can listen for agentsAvailable  events.

This could be called right after the script has loaded, or later on as agents become available.

It is therefore advisable to use this code right after Upscope('init');  is called, to ensure it is not missed.

Upscope('on', 'agentsAvailable', function() {
  // Show agent request button
});

Asking for an agent

To ask for an agent, use Upscope('requestAgent'); . You can cancel the request before it is accepted by calling Upscope('cancelRequestAgent') .

Knowing the status of the request

To know the status of the request, listen to the agentRequestUpdate event.

Upscope('on', 'agentRequestUpdate', function(status) {
  if (status === 'accepted') {
    // Tell user an agent will screen share soon
  } else if(status === 'unavailable') {
    // Log the request / send an email
  }
});
Did this answer your question?