---
title: "Setting up JS Callbacks with AI Action Buttons"
description: "Summary"
canonical_url: "https://help.brainfi.sh/articles/setting-up-js-callbacks-with-ai-action-buttons-ezPICt7UYw"
md_url: "https://help.brainfi.sh/articles/setting-up-js-callbacks-with-ai-action-buttons-ezPICt7UYw.md"
---
# Setting up JS Callbacks with AI Action Buttons

## Summary

This article explains how to add a special 'Callback' action button to your agent. This button allows you to execute custom JavaScript code to handle user interactions in a flexible way.

## When to Use This

This guide is for when you need to perform a custom action that isn't covered by the standard Email, Phone, or URL button types. Use a callback button to integrate with your own site's JavaScript functions, trigger specific application events, or create unique user interactions.

## Step-by-Step Instructions


1. Navigate to the agent settings and open the **Popup Settings** section.
2. Click the **+ Add action button**.
3. Select **Callback** from the dropdown list of button types.
4. Enter descriptive text for your button in the **Button text** field that appears (e.g., 'Request a Callback').
5. A code editor will appear, pre-filled with a JavaScript function. You will add your custom code inside this function.


 ![](https://help.brainfi.sh/api/attachments.redirect?id=a9aff31a-c773-4f85-a9d3-6d7504484c65 " =1512x850")


## Common Questions (FAQs)

**Q: What is a 'Callback' button?** A: A callback button is an interactive element that, when clicked, runs a piece of custom JavaScript code that you provide.

**Q: Can I change the name of the button?** A: Yes, you can set any name for the button by typing it into the 'Button text' field.

**Q: What happens after I select 'Callback'?** A: The system will automatically generate a template for a JavaScript function where you can write your custom logic.

## Troubleshooting Tips

* **Issue:** The code editor does not appear after selecting 'Callback'.
  * **Solution:** Refresh the page and try adding the callback button again. Ensure there are no browser console errors that might be interfering with the page's scripts.
* **Issue:** I can't see the 'Callback' option in the dropdown.
  * **Solution:** This feature might be restricted based on your subscription plan or user permissions. Contact your administrator to ensure you have access to this functionality.
