Skip to main content
Actions are functions provided by the UI extensions SDK that your extension can call to interact with HubSpot. Calling an action triggers behavior in HubSpot, such as displaying an alert banner, reloading the page, or opening a modal. You can access actions using either a props-based approach or a hook-based approach:
  • Props-based approach: destructure actions from the callback passed to hubspot.extend(), then pass it to your component as a prop.
  • Hook-based approach: call the useExtensionActions hook directly within your component.
The actions available depend on where your extension is loaded. Universal actions work in all extension points. CRM property actions are only available in CRM record extension points.
Note that some UI components include a set of actions separate from the SDK actions below, such as the CRM action components.
Both approaches to access actions provide identical functionality, so the choice is a matter of preference. As a general guideline:
  • Hook-based approach: cleaner component APIs, no prop drilling.
  • Props-based approach: explicit dependency injection.
Either way, the data is the same, as shown in the code example below.

Universal actions

Universal actionsSupported in all extension points: settings, home, crm.record.tab, crm.record.sidebar, crm.preview, helpdesk.sidebar

Display alert banners

Use the addAlert method to send alert banners as a feedback for any actions to indicate success or failure. addAlert is a part of the actions object that can be passed to extension via hubspot.extend. If you instead want to render an alert within a card, check out the Alert component. ui-extension-alert-example For example, the code below results in an app card that displays a success alert after fetching data from an external source. Note that the addAlert action is passed into hubspot.extend() and the Extension component, then is triggered when the hubspot.fetch() function successfully executes.

Reload page

Use the reloadPage action to reload the current page. This action can be accessed through the actions argument (actions.reloadPage).

Copy text to clipboard

Use the copyTextToClipboard action to copy text to your clipboard. This action can be accessed through the actions argument (actions.copyTextToClipboard) and returns a promise that resolves once the system clipboard has been updated. Its functionality is provided by the Clipboard: writeText() method and follows the same requirements. This action only works after the user has interacted with the page after loading (transient activation).
This action should be run by explicit user interaction, otherwise the action will fail by running before the page has rendered. For example, the following implementation would fail:

Open overlays

To add another layer of UI to your extension, you can include overlays using the Modal and Panel components.
  • Modal: a pop-up dialog box best suited for short messages and action confirmations. A 'danger' variant is included for destructive actions, such as deleting a contact.
  • Panel: a slide-out sidebar best suited for longer, compartmentalized tasks that users might need to perform, such as multi-step forms. Includes a 'modal' variant to obscure page content outside of the panel to focus the user on the panel task.
To add either type of overlay to an extension:
panel-example-gif
By default, overlays include a close button in the top right, as shown in the example below. ui-extension-component-panel-close
  • Only one Modal can be open at a time per extension. Opening a Modal when another one is already open will cause the first one to close.
  • A Modal can be opened from a Panel, but a Panel can’t be opened from a Modal.

Open an iframe in a modal

Use the openIframeModal action to open an iframe in a modal window. This action accepts two arguments: a payload object that describes the modal, and an optional callback function that runs when the modal is closed. The payload object for openIframeModal includes the following fields: For example, the following code would result in an extension that opens an iframe on button click. The iframe is configured to contain the Wikipedia homepage with a height and width of 1000px and no padding. Upon closing the modal, a message will be logged to the console.
When the user completes an action inside the iframe, the modal should close returning the user to the main page. To close the modal, the integration can use window.postMessage to signal that the user is done. The following messages are accepted:
  • {"action": "DONE"}: the user has successfully completed the action.
  • {"action": "CANCEL"}: the user has canceled the action.
Note: The domain where the action originates must match the domain of the uri you passed into the openIframeModal action. If the domains do not match, the message will be ignored.

CRM property actions

CRM property actionsOnly available in crm.record.tab, crm.record.sidebar, crm.preview, helpdesk.sidebar
While there isn’t a dedicated UI component for uploading files, learn about options for uploading files in UI extensions.

Fetch CRM property data

There are multiple ways to fetch CRM property data via the SDK:
  • The useCrmProperties hook, which fetches properties from the current CRM record.
  • The fetchCrmObjectProperties action, which fetches property data client-side at extension load time. This method is described below.
  • propertiesToSend, which can be included in your hubspot.fetch() functions to fetch property data on the back-end at function invocation time.
  • Use GraphQL to query CRM data through the /collector/graphql endpoint. Learn more about querying CRM data using GraphQL.
To make GraphQL requests, your app must include the following scopes:
  • collector.graphql_schema.read
  • collector.graphql_query.execute
fetchCrmObjectProperties
While this method is still supported, you may want to switch to using the useCrmProperties hook instead
Using the fetchCrmObjectProperties method, you can get property values from the currently displaying CRM record without having to use HubSpot’s APIs. This method is a part of the actions object that can be passed to the extension via hubspot.extend. You’ll first need to add the object to objectTypes inside the card’s .json config file. The objects you specify in objectTypes will also set which CRM objects will display the extension.
You can specify individual properties or fetch all properties with an asterisk:
The response for fetchCrmObjectProperties is formatted as:
fetchCrmObjectProperties returns raw property values. To apply HubSpot’s display formatting to these values (for example, resolving enumeration values to their display labels), pass the results to the formatCrmProperties utility.

Refresh properties on the CRM record

Use refreshObjectProperties to refresh the property data on the CRM record, and any CRM data components on the record without needing to refresh the page. This includes cards added to the record through HubSpot’s UI. This method will work for the CRM objects that you include in the extension’s .json file in the objectTypes array.

Listen for property updates

Use onCrmPropertiesUpdate to subscribe to changes made to properties on the CRM record and run hubspot.fetch() functions based on those changes. This only includes changes made from within the HubSpot UI, not property updates from outside the UI, such as via APIs. This action is intended to be used like a React hook. The full API for this method is as follows:
As an example, the following function subscribes to updates made to the contact’s first and last name properties, then logs those properties to the console.
You can subscribe to all properties by using an asterisk.
To handle potential errors, pass the error argument to the callback.

Upload files

While there is no UI component for uploading files, there are a few ways you can upload files:
Last modified on June 3, 2026