POST
request to /media-bridge/v1/{appId}/settings/object-definitions
. In the request body, include any of the following media type values within the mediaTypes
array: VIDEO
, AUDIO
, DOCUMENT
, IMAGE
, or OTHER
.
After defining your media objects, create and modify the media object properties by making a PATCH
request to /media-bridge/v1/{appId}/schemas/{objectType}
and a POST
request to /media-bridge/v1/{appId}/properties/{objectType}
.
media_bridge.read
media_bridge.write
https://app.hubspot.com/media-bridge-demo/{HubID}
, replacing {HubID}
with the account ID.GET
request to /media-bridge/v1/{appId}/settings/object-definitions/{mediaType}
to find the objectType
.POST
request to /crm/v3/objects/{objectType}
to create the media object in the user’s account.VIDEO
and AUDIO
media objects, the tables below list out all available properties:
Fields marked with * are required.
Parameter | Type | Description |
---|---|---|
id | Number | An ID used to identify the specific piece of media in HubSpot’s media bridge system. This is autogenerated by HubSpot and cannot be set by developers. |
hs_duration | Number | The duration of the media in milliseconds. |
hs_oembed_url * | String | A URL that must return a valid oEmbed response that follows the oEmbed spec. Requires video or rich type with an iframe in html . |
hs_file_url | String | URL of the raw media file. This may be used in the future to help support social embedding. |
hs_thumbnail_url | String | URL of an image used as the thumbnail for embedding the media into content. The ideal size for this thumbnail is 640x480 pixels. |
hs_poster_url | String | URL of an image representing the media. This image should be the same dimensions as the original media, and may be used in places where an image placeholder is needed (for example, when the media is inserted in an email). |
hs_external_id | String | The ID of the media in the third party’s system. This gives integrators the ability to fetch media from the media bridge based on the same ID that they use in their own system. (This is the API endpoint that leverages this mapping) |
hs_folder_path | String | A provider-supplied path to the object, intended to represent the object’s location in the third party’s folder system (if any). HubSpot will attempt to represent this directory structure when displaying these objects to the user, but may nest each provider’s objects and folders within a top-level folder named after the provider. |
hs_title * | String | The name of the media. This will be shown inside of the HubSpot UI in places such as the media picker. |
hs_details_page_link | String | URL that allows a user to view or interact with the media in the media provider’s system. This is used in the HubSpot UI to give users the ability to identify the media without relying on just the title. |
IMAGE
media objects, the tables below list out all available properties:
Fields marked with * are required.
Parameter | Type | Description |
---|---|---|
id | Number | An ID used to identify the specific piece of media in HubSpot’s media bridge system. This is autogenerated by HubSpot, and cannot be set by developers. |
hs_oembed_url * | String | A URL that must return a valid oEmbed response that follows the oEmbed spec. Requires video or rich type with an iframe in html . |
hs_file_url * | String | The URL of the raw media file. This may be used in the future to help support social embedding. |
hs_thumbnail_url | String | URL to an image that will be used as the thumbnail for embedding the media into content in places such as the media picker. The ideal size for this thumbnail is 640x480 pixels. |
hs_poster_url | String | URL of an image representing the media. This image should be the same dimensions as the original media, and may be used in places where an image placeholder is needed (for example, when the media is inserted in an email). |
hs_external_id | String | The ID of the media in the third party’s system. This gives integrators the ability to fetch media from the media bridge based on the same ID that they use in their own system. (This is the api endpoint that leverages this mapping) |
hs_folder_path | String | A provider-supplied path to the object, intended to represent the object’s location in the third party’s folder system (if any). HubSpot will attempt to represent this directory structure when displaying these objects to the user, but may nest each provider’s objects and folders within a top-level folder named after the provider. |
hs_title * | String | The name of the media. This will be shown inside of the HubSpot UI in places such as the media picker. |
hs_details_page_link | String | A URL that allows a user to view or interact with the media in the media provider’s system. This is used in the HubSpot UI to give users the ability to identify the media without relying on just the title. |
oembed_url
and oembed_response
are available in HubL to easily render players. Additionally, the id
and media_type
of selected media are stored to enable querying for the underlying CRM object via the crm_objects
HubL function. This can be used to fetch any or all of the properties that are part of a media object.
An example use of the crm_objects HubL function with a media object where the IDs are 459 and 922:
{% set objects = crm_objects("a123_Videos", [459,922]) %} {{ objects }}
To fetch a specific image with the same object: {% set object = crm_object("a123_Images", 459) %} {{ object }}
Apps can fetch the object type (“a123_Videos” in the example) by making a GET
request to /media-bridge/{appId}/settings/object-definitions/{mediaType}
.
Developers should use the CMS Source Code API endpoints to push their custom module code into customers’ accounts once customers have connected via oAuth. Once the module code is pushed into the customer’s account, they will automatically be able to start using the developer’s module in their content.
/media-bridge/v1/{appId}/settings/oembed-domains
. The following parameters must be included:
*
(e.g. www.domain.com/*
).
URL
parameter.
portalId
value into the API request when setting up the oEmbed domain. This will ensure that only the specified HubSpot account can use that oEmbed domain.
POST
request to /media-bridge/v2/events/media-played
, /media-bridge/v2/events/media-played-percent
and /media-bridge/v2/events/attention-span respectively
.
For media events to be displayed on the user’s contact timeline in HubSpot, a played event must be sent to the media bridge app for every session. Events from a single session will be shown in one card on the contact activity timeline.
When events are sent using the v2 event endpoints, they are processed asynchronously, unlike those sent via the v1 endpoints. As such, we recommend the following:
contactId
or a contactUtk
. If only a contactUtk
is provided, it will be converted into a contactId
. If both are provided in the request, the contactId
will be used as the source of truth. This parameter allows the media bridge app to create an association between the contact record and the event.
Once a media event has been connected to a contact record, the event can be used in cross-object reports. This allows customers to tie their media events to contact records, as well as associated companies and deals.
mediaID
or externalID
parameters must be included in the request. If both are provided, the mediaID
will be used as the source of truth.
pageId
must be provided.pageName
and pageUrl
must be included.Property | Event Type | Description |
---|---|---|
mediaBridgeObjectId | All Events | The ID of the media that this event is related to. |
externalId | String | The ID of the media in the third party’s system. This gives developers the ability to refer to media in the media bridge based on the same ID that they use in their own system. This can be used instead of the mediaBridgeObjectId in events. If both an externalId and mediaBridgeObjectId are provided, the mediaBridgeObjectId will be used and the externalId will be ignored. |
sessionId | All Events | A unique identifier to represent a viewing session. This can mean different things to different providers, and HubSpot is letting providers decide what a session means to them. This will be used to group events that happened in the same session together. This is expected to be generated by the third party’s system. |
contactId | All Events | The ID of the contact in HubSpot’s system that consumed the media. This can be fetched using HubSpot’s Get contact by usertoken (utk) API. The API also supports supplying a usertoken, and will handle converting this into a contact ID automatically. |
contactUtk | All Events | The usertoken (utk) that identifies which contact consumed the media. |
pageId | All Events | The content ID of the page that an event happened on. |
pageName | All Events | The name or title of the page that an event happened on. |
pageUrl | All Events | The URL of the page that an event happened on. |
occurredTimestamp | All Events | The timestamp at which this event occurred, in milliseconds since the epoch. |
rawDataString / rawDataMap | Attention Span | This is the raw data which provides the most granular data about spans of the media, and how many times each span was consumed by the user. For example, for a 10 second video where each second is a span, if a visitor watches the first 5 seconds of the video, then restarts the video and watches the first 2 seconds again, the resulting rawDataString would be “0=2;1=2;2=1;3=1;4=1;5=0;6=0;7=0;8=0;9=0;” . |
totalPercentPlayed | Attention Span | The percent of the media that the user consumed. Providers may calculate this differently depending on how they consider repeated views of the same portion of media. For this reason, the API will not attempt to validate totalPercentWatched against the attention span information for the event. If it is missing, HubSpot will calculate this from the attention span map as follows: (number of spans with a value of 1 or more)/(Total number of spans). |
totalSecondsPlayed | Attention Span | The seconds that a user spent consuming the media. The media bridge calculates this as totalPercentPlayed *mediaDuration . If a provider would like this to be calculated differently, they can provide the pre-calculated value when they create the event |
playedPercent | Quartile Event | A quartile percent value (0, 25, 50, 75, 100) for how much of the media has been consumed so far. |
iframeUrl | Played Event | A URL that can be used to display data from an external system using an iFrame. When included, the event on the contact timeline will display a link that will open a modal window displaying the iFrame contents when clicked. |
mediaType | String | The media type that the event belongs to (for example, VIDEO or AUDIO) This allows us to properly assign the event to the correct objects when a single provider has support for multiple media types. |