HubSpot: Record Media Played Percentage
HubSpot mediaBridge.mediaPlayedPercent: arguments, response, policy and SDK examples.
← Media bridge operations · Get started
Operation hubspot.media_bridge_media_played_percent
Provider route: POST /media-bridge/2026-09/events/media-played-percent. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/hubspot with npm, or alter-sdk-hubspot with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { HubSpotIntegration } from "@alter-ai/hubspot";
async function execute(input: Parameters<HubSpotIntegration["mediaBridge"]["mediaPlayedPercent"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new HubSpotIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.mediaBridge.mediaPlayedPercent(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_hubspot import HubSpotIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = HubSpotIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.media_bridge.media_played_percent(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Record Media Played Percentage — request body — body |
Referenced models: Record Media Played Percentage — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Record Media Played Percentage — response body |
Referenced models: Record Media Played Percentage — response body
Schemas
Section titled “Schemas”Record Media Played Percentage — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
_hsenc | string | Optional | HubSpot encoding parameter for tracking purposes. |
contactId | integer | Optional | The unique identifier for the contact associated with the media play event. Format: int64 |
contactUtk | string | Optional | The user token key associated with the contact. |
externalId | string | Optional | An external identifier for the media, provided by the user. |
externalPlayContext | string | Optional | Additional context provided externally about the media play event. One of: EMAIL, EXTERNAL_PAGE |
mediaBridgeId | integer | Optional | The unique identifier for the media bridge instance. Format: int64 |
mediaName | string | Optional | The name of the media that was played. |
mediaType | string | Required within parent | The type of media that was played. Valid values include 'VIDEO', 'AUDIO', 'DOCUMENT', 'OTHER', and 'IMAGE'. One of: AUDIO, DOCUMENT, IMAGE, OTHER, VIDEO |
mediaUrl | string | Optional | The URL where the media is hosted. |
occurredTimestamp | integer | Required within parent | The timestamp when the media play event occurred. Format: int64 |
pageId | integer | Optional | The unique identifier for the page where the media was played. Format: int64 |
pageName | string | Optional | The name of the page where the media was played. |
pageUrl | string | Optional | The URL of the page where the media was played. |
playedPercent | integer | Required within parent | The percentage of the media that has been played. Format: int32 |
sessionId | string | Required within parent | The unique identifier for the session in which the media was played. |
Record Media Played Percentage — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
contactId | JSON | Required within parent | |
contactId (anyOf 1) | integer | Alternative | The unique identifier for the contact associated with the media event. It is a string value. Format: int64 |
contactId (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
externalPlayContext | string | Optional | Contextual information about the external environment where the media is played. It is a string value. Known values: EMAIL, EXTERNAL_PAGE |
mediaBridgeId | JSON | Required within parent | |
mediaBridgeId (anyOf 1) | integer | Alternative | The unique identifier for the media bridge instance. It is a string value. Format: int64 |
mediaBridgeId (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
mediaBridgeObjectCoordinates | string | Required within parent | Coordinates that specify the location of the media bridge object. It is a string value. |
mediaBridgeObjectTypeId | string | Required within parent | The type identifier for the media bridge object. It is a string value. |
mediaName | string | Required within parent | The name of the media content being played. It is a string value. |
mediaType | string | Required within parent | The type of media being played, such as 'VIDEO', 'AUDIO', etc. It is a string value. Known values: AUDIO, DOCUMENT, IMAGE, OTHER, VIDEO |
mediaUrl | string | Optional | The URL of the media content being played. It is a string value. |
occurredTimestamp | JSON | Required within parent | |
occurredTimestamp (anyOf 1) | integer | Alternative | The timestamp when the media play event occurred. It is a string value in ISO 8601 format. Format: int64 |
occurredTimestamp (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
pageId | JSON | Optional | |
pageId (anyOf 1) | integer | Alternative | The unique identifier for the page where the media is being played. It is a string value. Format: int64 |
pageId (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
pageName | string | Optional | The name of the page where the media is being played. It is a string value. |
pageObjectCoordinates | string | Optional | Coordinates that specify the location of the page object. It is a string value. |
pageUrl | string | Optional | The URL of the page where the media is being played. It is a string value. |
playedPercent | JSON | Required within parent | |
playedPercent (anyOf 1) | integer | Alternative | The percentage of the media content that has been played. It is a number value. Format: int32 |
playedPercent (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
portalId | JSON | Required within parent | |
portalId (anyOf 1) | integer | Alternative | The unique identifier for the HubSpot portal. It is an integer value. Format: int32 |
portalId (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
providerId | JSON | Required within parent | |
providerId (anyOf 1) | integer | Alternative | The unique identifier for the media provider. It is a string value. Format: int32 |
providerId (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
sessionId | string | Required within parent | The unique identifier for the session during which the media was played. It is a string value. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: hubspot.media_bridge_media_played_percent. Catalog operation: media_bridge_media_played_percent. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["media_bridge.write"]