Blog· HubSpot CRM 8 min read

HubSpot Calling SDK: A Practical Setup Guide for Developers

This guide provides a technical walkthrough for integrating a third-party calling application with HubSpot using the Calling Extensions SDK. Learn the correct process for app setup, SDK initialization, event handling, and call data logging.

HubSpot Calling SDK: A Practical Setup Guide for Developers — HubStack HubSpot article cover
In this article
  • What is the HubSpot Calling Extensions SDK?
  • Prerequisites: What You Need Before You Start
  • Creating and Configuring Your HubSpot App
  • Initializing the SDK in Your Calling Application
  • Mapping Call Data to HubSpot CRM Properties
  • Troubleshooting Common SDK Implementation Errors

The HubSpot Calling Extensions SDK provides a standardized method for integrating third-party calling applications directly into the HubSpot user interface. It allows sales and service representatives to make and receive calls from within the CRM, automatically logging call activities against contact records. Unlike a simple data sync via API, this SDK creates a native-feeling user experience, embedding your calling provider’s functionality into an iframe within the contact timeline and call interface.

Using the SDK is the required approach for building a calling integration that appears in the HubSpot App Marketplace. It ensures a consistent user experience and handles the critical communication between your application and the HubSpot frontend. This method centralizes call control, logging, and outcome tracking, which is essential for accurate reporting and sales performance monitoring. Without it, users are forced to switch between their phone system and HubSpot, leading to lost data and inefficient workflows.

This guide details the technical steps required to implement the Calling Extensions SDK. We will cover creating the necessary HubSpot developer app, initializing the SDK, handling call state messages, logging call data to the CRM, and troubleshooting common issues. Following this process ensures your integration is robust, user-friendly, and correctly interacts with the HubSpot platform. For complex implementations or if you require assistance, our HubSpot CRM setup & automation services can provide expert guidance.

What is the HubSpot Calling Extensions SDK?

The HubSpot Calling Extensions SDK is a JavaScript library that facilitates communication between your external calling application and the HubSpot CRM frontend. When a user initiates a call from a contact record in HubSpot, HubSpot loads your application in an iframe and uses the SDK to pass messages back and forth. These messages include commands to initialize the call, updates on call status, and data to be logged upon call completion. The primary function of the SDK is to standardize this interaction, making it possible for numerous calling providers to integrate seamlessly.

This SDK is fundamentally different from using HubSpot's public APIs to simply log a completed call. While the API can create a call activity record after the fact, the SDK enables a real-time, interactive experience. It allows HubSpot to control your application's widget size, pass contact information to your dialer, and receive events as they happen, such as when a call is answered or ends. This creates a deeply integrated workflow that feels like a native HubSpot feature.

By implementing the SDK, you enable features like click-to-call on contact records, automatic display of your calling widget, and post-call disposition selection directly within HubSpot. This reduces manual data entry for sales and service teams, improves data accuracy, and provides managers with real-time insight into calling activities. A successful implementation relies on correctly handling the postMessage events that form the core of the SDK's communication protocol. HubStack has extensive experience building these types of integrations for clients with unique telephony needs.

Prerequisites: What You Need Before You Start

Before writing any code, you must have several key assets in place. First, a HubSpot developer account is mandatory. This is separate from a standard HubSpot user account and provides access to the tools needed to create and manage applications. You can create one for free from the HubSpot developers portal. This account will be the owner of the application you create to house your integration's settings.

Second, you need a functioning calling application that can be embedded in an iframe. This application must be accessible via a secure HTTPS URL, as HubSpot will not load content over HTTP. Your application is responsible for handling the actual telephony—making, receiving, and managing the call audio. The HubSpot SDK does not handle the call itself; it only orchestrates the communication between your app and the CRM. Your application must also be capable of executing JavaScript and interacting with the browser's postMessage API.

Finally, you need a clear understanding of your calling provider's capabilities. You must know how to programmatically initiate a call, mute, hang up, and access call metadata like duration, recording URLs, and call outcomes from within your application's code. This information will be crucial for logging accurate data back into HubSpot. If your integration requires ongoing support, consider a HubSpot support & maintenance plan to ensure its long-term stability.

Creating and Configuring Your HubSpot App

The first step in the implementation process is creating an app in your HubSpot developer account. Navigate to 'Apps' in your developer portal and click 'Create app'. Give your app a descriptive name and configure its basic information. The most critical part of this process is the 'Calling' tab in the app settings. Here, you will enable the calling features and provide the necessary URLs for your application.

Within the Calling settings, you must specify the 'Calling app URL'. This is the HTTPS endpoint for the main page of your calling application—the page HubSpot will load into the iframe. You will also need to define the width and height of your widget. These dimensions determine the size of the iframe when it is rendered by HubSpot. It is important to test these dimensions to ensure your app's UI is usable within the given space.

Next, you need to define the CRM card for your app. Even though the primary interface is the calling widget, a CRM card is required for the integration to be complete. Go to the 'CRM Cards' section of your app settings and configure a new card. You can fetch data from an external source or simply display static content. Finally, install your developer app into a HubSpot test portal (a sandbox or a standard portal you can use for testing) to get the necessary permissions and begin development.

Initializing the SDK in Your Calling Application

Once your app is configured in HubSpot, you must integrate the Calling Extensions SDK into your application's frontend code. The SDK is a JavaScript file provided by HubSpot. You include it in your application using a script tag. Once the script is loaded, it exposes a global `HubSpotCallingExtensions` object that your code will use to communicate with the HubSpot parent window.

Your application's first task upon loading in the iframe is to send an `INITIALIZED` message to HubSpot. This message signals that your app has loaded successfully and is ready to receive commands. The message must include a `isLoggedIn` boolean property, indicating whether the user is authenticated with your calling service. If `isLoggedIn` is false, HubSpot can display a login view for your app.

After initialization, your app must listen for `message` events on the `window` object. HubSpot will send JSON-formatted messages to your iframe to trigger actions. The most important initial message to handle is the `DIAL_NUMBER` command. This message is sent when a user clicks a 'call' button in HubSpot and includes the phone number to be dialed and details about the associated CRM object. Your application should parse this message and use the provided number to initiate an outbound call through your telephony provider.

Mapping Call Data to HubSpot CRM Properties

A core function of the integration is to log call activity back to the HubSpot CRM automatically. When a call is completed, your application must send a `CALL_ENDED` message to HubSpot. This message contains a payload of data about the call that HubSpot uses to create a call engagement on the contact's timeline. This eliminates the need for manual logging by the user.

The `CALL_ENDED` payload must include the `engagementId` that was provided by HubSpot in the initial `DIAL_NUMBER` message. This ID links the logged call back to the correct engagement placeholder. You must then map the data from your calling system to the appropriate HubSpot properties. This includes the call duration, a link to the call recording, the call outcome or disposition, and any notes taken by the agent during the call.

Correctly mapping these fields is critical for reporting and automation in HubSpot. For example, the `disposition` field should be mapped to the HubSpot call disposition property, which is a unique GUID for each outcome. You can fetch the available disposition GUIDs from the Engagements API. Failing to map these properties correctly will result in incomplete data and render reports useless. Review the table below for a summary of key fields and their corresponding HubSpot properties.

Mapping Call Data to HubSpot Engagement Properties in `CALL_ENDED` Payload
Your Application DataHubSpot Property in PayloadDescriptionData Type
Call notes or summarybodyThe notes taken by the rep during the call.String
Unique call outcome IDdispositionThe GUID of the HubSpot call disposition (e.g., 'Connected').String
Call duration in millisecondsdurationMillisecondsThe total length of the call.Number
External system's call IDexternalIdThe unique identifier for the call in your system.String
Public URL for recordingrecordingUrlA link to the audio recording of the call.String
Call status (e.g., COMPLETED)statusThe final status of the call. Must match a valid HubSpot status.String

Troubleshooting Common SDK Implementation Errors

Developers often encounter a few common issues when first implementing the Calling SDK. The most frequent problem is a failure to communicate between the iframe and the parent HubSpot window. This is often caused by not sending the `INITIALIZED` message correctly or failing to set up a `message` event listener. Use your browser's developer tools to inspect console logs and monitor the postMessage events being sent and received.

Another common pitfall involves authentication and `isLoggedIn` status. If your app sends `isLoggedIn: false`, you must provide a way for the user to log in within the iframe. If this flow is broken, the user will be stuck and unable to use the calling feature. Ensure your login process works correctly within the confines of the iframe and that upon successful login, you re-initialize the extension with `isLoggedIn: true`. Our team at HubStack frequently debugs these exact issues for clients.

Finally, data logging issues are prevalent. If calls are not appearing on the contact timeline, verify that your `CALL_ENDED` message contains the correct `engagementId` that HubSpot sent with the `DIAL_NUMBER` command. Also, check that the `disposition` GUIDs are correct and that the `status` string matches one of HubSpot's accepted values (e.g., 'COMPLETED', 'NO_ANSWER'). Incorrect or missing data in this payload is the primary reason for logging failures. For persistent issues, a full code review is often necessary, something covered in our HubSpot technical SEO and integration audits.

FAQ

Questions people actually ask AI about this.

What is the HubSpot Calling Extensions SDK?

It is a JavaScript library that allows you to embed your third-party calling application within the HubSpot UI. It manages communication between your app and the CRM, enabling features like click-to-call and automatic call logging.

Do I need a developer account to use the Calling SDK?

Yes, a HubSpot developer account is required. You must create an application within this account to configure the calling integration's settings and URLs.

Can I use the HubSpot API to log calls instead of the SDK?

You can use the API to log a call after it has happened, but this does not provide a real-time, interactive user experience. The SDK is required to embed your dialer in HubSpot and enable click-to-call functionality.

Does my calling app need to be on HTTPS?

Yes, HubSpot will only load applications into an iframe from a secure HTTPS URL. An HTTP URL will be blocked by the browser for security reasons.

What happens if I send `isLoggedIn: false` during initialization?

HubSpot will present a view for your user to log into your service. Your application must handle the login process within the iframe and then re-initialize the extension with `isLoggedIn: true`.

How do I find the HubSpot disposition GUIDs for call outcomes?

You can retrieve the list of available call and meeting disposition GUIDs by making a GET request to the `/crm/v3/properties/engagements/disposition` endpoint of the HubSpot API.

Why isn't my call logging to the contact timeline?

This is often because the `CALL_ENDED` message is missing the correct `engagementId` or contains an invalid `disposition` GUID or `status` value. Use browser developer tools to inspect the payload you are sending.

Can I change the size of my calling widget?

Yes, you can set the initial width and height in your developer app settings. Your application can also send a `RESIZE_WIDGET` message to HubSpot to dynamically change the iframe dimensions.

Does the SDK handle the call audio?

No, the SDK does not handle any audio. Its sole purpose is to pass messages between your calling application and HubSpot. Your application is fully responsible for all telephony functions.

Can HubStack build a custom calling integration for us?

Yes, we specialize in custom HubSpot integrations. We can help you scope, build, and deploy a robust calling integration using the Calling Extensions SDK. Please contact us to discuss your requirements.

Proof

What this looks like when it's done right.

Need Help Building a Custom Calling Integration?

Related

Technical SEO services

Redirect mapping, metadata baselines, canonical configuration, schema and indexing controls — handled as an ongoing programme rather than a launch-week scramble.

HubSpot technical SEO
Keep reading

How to Set Up HubSpot CRM for a 30-Person Team (Without Overbuilding It)

Most failed CRM rollouts are overbuilt, not underbuilt. Here is the order we configure HubSpot for a 30-person company — and everything we deliberately leave out of version one.

Read article