Skip to content

HubSpot: Create Event

HubSpot mediaBridge.attentionSpan: arguments, response, policy and SDK examples.

← Media bridge operations · Get started

Operation hubspot.media_bridge_attention_span

Provider route: POST /media-bridge/2026-09/events/attention-span. Alter supplies the connection’s credentials and routing.

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"]["attentionSpan"]>[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.attentionSpan(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from 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.attention_span(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyModelRequired within parentExpand Create Event — request body — body

Referenced models: Create Event — request body — body

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Create Event — response body

Referenced models: Create Event — response body

Create Event — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
_hsencstringOptionalAn encoded string used for HubSpot-specific encoding purposes.
contactIdintegerOptionalThe unique identifier for the contact associated with the event.
Format: int64
contactUtkstringOptionalThe unique tracking key for the contact, used for tracking purposes.
derivedValuesModelOptionalExpand Create Event — request body — body derived Values
externalIdstringOptionalAn external identifier for the event, typically used to correlate with external systems.
externalPlayContextstringOptionalAdditional context about the play event, typically used for external integrations.
One of: EMAIL, EXTERNAL_PAGE
mediaBridgeIdintegerOptionalThe unique identifier for the media bridge instance.
Format: int64
mediaNamestringOptionalThe name of the media involved in the event.
mediaTypestringRequired within parentThe type of media involved in the event. Valid values include 'VIDEO', 'AUDIO', 'DOCUMENT', 'OTHER', and 'IMAGE'.
One of: AUDIO, DOCUMENT, IMAGE, OTHER, VIDEO
mediaUrlstringOptionalThe URL of the media involved in the event.
occurredTimestampintegerRequired within parentThe timestamp when the event occurred, represented as a Unix timestamp in milliseconds.
Format: int64
pageIdintegerOptionalThe unique identifier for the page where the event occurred.
Format: int64
pageNamestringOptionalThe name of the page where the event occurred.
pageUrlstringOptionalThe URL of the page where the event occurred.
rawDataMapobjectRequired within parentA map of raw data key-value pairs providing additional context about the event.
Additional keys: see wildcard field
rawDataMap.*integerAdditional keysFormat: int32
rawDataStringstringOptionalA raw data string containing additional information about the event.
sessionIdstringRequired within parentThe unique identifier for the session during which the event occurred.

Referenced models: Create Event — request body — body derived Values

Create Event — response body
FieldTypePresenceDescription and constraints
$objectRoot
contactIdJSONRequired within parent
contactId (anyOf 1)integerAlternativeA string representing the unique identifier for the contact associated with the event.
Format: int64
contactId (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
externalPlayContextstringOptionalA string providing additional context about the play event from an external source.
Known values: EMAIL, EXTERNAL_PAGE
mediaBridgeIdJSONRequired within parent
mediaBridgeId (anyOf 1)integerAlternativeA string representing the unique identifier for the media bridge instance.
Format: int64
mediaBridgeId (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
mediaBridgeObjectCoordinatesstringRequired within parentA string detailing the coordinates of the media bridge object.
mediaBridgeObjectTypeIdstringRequired within parentA string representing the type identifier for the media bridge object.
mediaNamestringRequired within parentA string representing the name of the media content.
mediaTypestringRequired within parentA string indicating the type of media involved in the event, such as 'VIDEO', 'AUDIO', etc.
Known values: AUDIO, DOCUMENT, IMAGE, OTHER, VIDEO
mediaUrlstringOptionalA string containing the URL of the media content.
occurredTimestampJSONRequired within parent
occurredTimestamp (anyOf 1)integerAlternativeA string representing the timestamp of when the event occurred, in ISO 8601 format.
Format: int64
occurredTimestamp (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
pageIdJSONOptional
pageId (anyOf 1)integerAlternativeA string representing the unique identifier for the page.
Format: int64
pageId (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
pageNamestringOptionalA string representing the name of the page where the media was accessed.
pageObjectCoordinatesstringOptionalA string detailing the coordinates of the page object.
pageUrlstringOptionalA string containing the URL of the page where the media was accessed.
percentRangestringRequired within parentA string indicating the range of percentages that were played during the session.
portalIdJSONRequired within parent
portalId (anyOf 1)integerAlternativeAn integer representing the unique identifier for the HubSpot portal.
Format: int32
portalId (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
providerIdJSONRequired within parent
providerId (anyOf 1)integerAlternativeA string representing the unique identifier for the media provider.
Format: int32
providerId (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
rawDatastringOptionalA string containing raw data associated with the event.
sessionIdstringRequired within parentA string representing the unique identifier for the session during which the media was played.
totalPercentPlayedJSONRequired within parent
totalPercentPlayed (anyOf 1)numberAlternativeA number indicating the total percentage of the media that was played.
totalPercentPlayed (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
totalSecondsPlayedJSONOptional
totalSecondsPlayed (anyOf 1)integerAlternativeA number representing the total seconds of media that were played.
Format: int32
totalSecondsPlayed (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
Create Event — request body — body derived Values
FieldTypePresenceDescription and constraints
$objectRoot
totalPercentPlayednumberRequired within parentThe percentage of the media content that was played. This is a numerical value indicating how much of the total content was viewed, expressed as a percentage.
totalSecondsPlayedintegerRequired within parentThe total duration in seconds that the media content was played. This is a numerical value representing the cumulative playtime.
Format: int32

SDK function policy ID: hubspot.media_bridge_attention_span. Catalog operation: media_bridge_attention_span. 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"]

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.