Brand Logo Navigation

Browser Function

Introduction

Browser Function allows your bot to interact directly with the website it is embedded on. Instead of only replying with text, your bot can trigger actions inside the browser itself, such as redirecting the user, opening a section of the page, or calling a custom script that is already defined on your site.

This enables your bot to go beyond conversation. It can respond to a customer's request by acting on the website in real time.

Common Use Cases

Browser Function can be used in various scenarios, such as:

  • Redirecting users to a specific detail or product page
  • Opening a particular section or modal on the current page
  • Triggering a custom script already implemented on your website (e.g., opening a shop, scrolling to a section, applying a filter)

Requirements

This feature will only work if the widget you use is an embed code attached to your website or platform. You also need at least basic technical or scripting skills, since Browser Function relies on a script/function that already exists on your website and is called through a Function Key.

Where to Access Browser Function

You can access Browser Function from the bot configuration area.

Go to:
Bots → Select your bot → Tools → Browser Function

From this tab, you can create, manage, and configure the browser actions that your bot will trigger during conversations.


Browser Function Form Explanation

Below are the explanation of each field to configure a Browser Function and how to use them effectively.

Name

This field defines the name of your Browser Function.

Use a clear and descriptive name so it is easy to identify its purpose later, especially if you have multiple Browser Functions configured.

Example:
Redirect to detail page

Function Key

This is the function that will be called in the browser. This value must be unique.

The Function Key must match the function/script already defined on your website, since this is what the bot will call when the condition is triggered.

Example:
redirect-to-detail

When should the chatbot trigger the browser function?

This is one of the most important fields.

Define clear conditions (e.g., keywords, urgent issues, or sensitive topics) for the chatbot to trigger this browser function. The bot will use this instruction to decide when to execute the function automatically during a conversation.

Be specific and include examples of user intent.

Good example:
Trigger when the user wants to browse, see all products, or explore a category, e.g. "show me what you have", "what bouquets do you sell", "I want to look at plants", "browse your store", "how to shop online".

Tips:

  • Describe intent, not exact phrases only
  • Include variations of how users might ask
  • Avoid being too vague (e.g., "when user asks something")

Content

This is the content that will be sent to the browser when the function is called. It can be a JSON, XML, or just a plain string.

The content is passed as the payload of the function call, so structure it according to what the function on your website expects.

Example:
{"url": "https://example.com"}

Custom Response When Condition is Triggered

This field defines the response the chatbot sends to the user when the browser function is triggered.

Use this to let the customer know what just happened, so the interaction feels natural instead of a silent action in the background.

Example:
Here you go! I've opened our shop so you can browse everything we have in bloom right now.☺️

Fallback Message

This is the message displayed when the browser function is unsupported. This applies when the web widget is not accessed via embedded code, so there is no browser/website for the function to act on.

Use this field to still give the user a useful response, for example by sharing a direct link instead of performing the action.

Example:
Browse our full collection here: https://example.com/shop/


Embed Code Integration

Browser Function is most beneficial when your bot is used through the Web Widget embed code, since the function is actually executed by your own website's script, not by Askyura.

To make this work, add a listener for the browserFunction event on window.WebSDK in your website's script. When the trigger condition is met, Askyura will emit this event along with the Content you configured as the payload, and your script decides what action to take.

window.WebSDK.on("browserFunction", (payload) => {
  const content = JSON.parse(payload.content);
  window.open(content.url, "_blank");
});

In the example above:

  • payload.content is the Content value you set in the Browser Function form, sent as a string
  • JSON.parse(payload.content) converts it into an object so you can read its properties (e.g., content.url)
  • window.open(content.url, "_blank") is the actual action performed on the browser, in this case opening the URL in a new tab

You are not limited to opening a URL. Since this is regular JavaScript running on your website, you can use the payload to perform any action your site supports, such as scrolling to a section, opening a modal, or applying a filter.

Important: Make sure this script is added to the same page where your Web Widget embed code is installed, otherwise window.WebSDK will not be available and the event will never be caught.


Final Step

After completing all required fields and configurations, click Save & Activate to enable the Browser Function.

Once activated, your chatbot will be able to trigger the browser function based on the conditions you defined, and respond accordingly whether or not the function is supported.


Best Practices

To ensure optimal performance and reliability:

  • Make sure the Function Key matches an existing function/script on your website
  • Test your Browser Function on the actual embedded widget to confirm it works as expected
  • Use clear trigger conditions to avoid unintended browser actions
  • Always configure a Fallback Message so users still get a helpful response outside the embedded widget
Brand Banner