With the Freshdesk help widget, you can embed solution articles and a contact form within your website or product. When customers need help, they can open the widget to search through solution articles or submit a ticket. You can customize the widget's appearance so that it looks and feels like your brand. You can watch this video to learn how to set up the help widget or read more about setting up the help widget here.


You can further customize the widget's behavior on your website by making use of the widget's JavaScript APIs. This article explores the APIs which you can use to customize the widget and shows how you can leverage them to provide a better experience for your customers.


Open API:

With the open API, you can trigger the widget to open when your customers click on a link on your website.

 


// Open the widget

FreshworksWidget('open');


If you have a widget with both solutions and contact form in it, you can use the open contact form API to directly open the contact form when your customers click on a link or button on your website.


Open article API

Using this API, you can open a specific article in the widget when a customer clicks on a link or a button on your website. Learn more about the open article API here.



Identify API

When your customers are already logged in to your website, and they try to reach out for help, you can make sure that their name and email address are filled in the contact form automatically using the identify API.



// Prefill the contact form with details about a customer

FreshworksWidget('identify', 'ticketForm', {
name: variableName,
email: VariableEmail,
})

You'll have to substitute the 'variable_name' and 'variable_email' with the variables that you use to store your customers' names and emails, respectively.


Prefill API

With the prefill API, you can prefill any ticket field when your customers open up the contact form in the widget. 



// Prefill the subject

FreshworksWidget('prefill', 'ticketForm', {
subject: 'Snow White T-Shirt enquiry'
});

To see a full list of attributes that can be passed to the prefill API, check out the API documentation.


Hide ticket fields API

You can use the hide ticket fields API to hide certain fields which may be irrelevant to your customers in certain situations. 


// Hide the type field

FreshworksWidget('hide', 'ticketForm', ['type'])

You can also hide any custom field in the contact form. If you're hiding a required field, it needs to prefilled. 


To see a full list of attributes that can be passed to the hide API, check out the API documentation. 


Disable ticket fields API

You can use the disable ticket fields API to disable certain fields in the contact form. You can use this along with the prefill API to fill a ticket field and disable it so that your customers wouldn't be able to edit it.



// Disable the type field

FreshworksWidget('disable', 'ticketForm', ['type'])

You can also disable any custom field in the contact form. If you're disabling a required field, it needs to prefilled. 


To see a full list of attributes that can be passed to the disable API, check out the API documentation


Hide API

If you'd like to hide the widget on certain web pages on your site, you can use the hide API.


// Hide widget API

FreshworksWidget('hide');


If you already have a link or a button on your website, which should invoke the help widget, and you want the widget to be hidden until your customers click on the link or button, we suggest you use the API below.

// Hide widget API which hides the launcher

FreshworksWidget('hide', 'launcher');

This API will hide the launcher. You can then use the open API to open the widget when your customers click on the link or button on your website.



 

Multilingual support

You can learn more about using the help widget to provide support in different languages here.


You can also learn more about linking multiple ticket forms on your help widget here