Note: This feature is in beta and is available on request. Head over to the community discussion here to request access.

Once you’ve embedded the help widget, you can customize it further using our Javascript APIs. For example, you can hide the widget on certain pages by calling the method FreshworksWidget('destroy'). You can even pre-populate certain ticket fields, when your customers open the contact form.

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. 

Identify API: 

If your customers are logged in to your website, and they're trying to reach out to you, you can automatically have their name and email pre-filled in the contact form. You can use the identify API to accomplish this. 

FreshworksWidget('identify', 'ticketForm', {
  name: 'Rachel',
  email: '',

Pre-fill API:

Let's say a customer tries to place an order on your website, but the transaction fails. You've added a link on the page using which your visitors can reach out for help. 

When the customer clicks on the link, you want to open the widget with the 'Type' dropdown prefilled as 'Transaction issue'. This way, you can route the question to the appropriate group faster, without the customer having to manually categorize the ticket for you.

Here's a piece of code using which you pre-fill the 'Type' field. You can check out the API documentation to learn more about how you can pre-populate any field in the contact form.

FreshworksWidget('prefill', 'ticketForm', {
type: ‘Transaction issue’

Hide API:

Sometimes, you might have set up ticket fields to categorize tickets internally, so that they can be routed to the right group. If you don't want your customers to worry about those fields, you can hide them in the contact form. 

For example, let’s say you’ve prefilled the 'Type' field as 'Pricing question', you can then use the hide API to hide it from your customers so that they don’t change it.

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 pre-filled. 

Clear API:

Using the clear API, you can clear the fields that were previously pre-filled. This does not clear the name and email you may have filled using the identify API.