Overview and walkthrough of the Timeline API.
objectType
field. See creating a timeline event template for more details.
Each event template has its own set of tokens and templates. You can use events created for contacts as criteria when creating new contact lists or workflows, such as: ‘Create a list of all contacts with a Video Like where the video name contains XYZ,’ where your event template is named “Video Like” and has an event token named “video name.”
<appId>
with your own App ID, which can be found on both the My Apps and app details pages in your developer account. You’ll also need to replace <developerHapikey>
with your own developer API key, which you can find by navigating to Apps > Get HubSpot API key.
The properties headerTemplate
and detailTemplate
could also be provided here. For more information, see Define header and detail templates below.
This POST
request will return the full, saved event template definition. Be sure to note the id
property in this response. This is the event template ID, which you’ll need to make any updates to this event template or tokens in the future.
You can see all event templates defined for an app via this GET command, which will also return the event template IDs:
GET
will return all tokens defined on an event template:
string
number
enumeration
— One of a set of options. See the webinarType example above.date
— All dates must be in milliseconds in Unix time.webinarName
token in the template by using {{webinarName}}
The extraData
of an event (discussed below in “Understanding extraData”) can only be referenced in the details template.
PUT
:
#formatDate
directive—it’s something we’ve defined to allow for user-friendly date formatting.
Once an event is created for a contact using this (see “Creating an event” below), here’s what will show up in that contact’s timeline:
POST
call.
contacts
event template created above. If the event template above is not set up to have the tokens webinarName
and webinarId
, then you will get an error when trying to create the event. Here’s an example POST
for creating an event:
a.test.contact@email.com
’s timeline (assuming the templates in ‘Defining Templates’ above):
vid
to associate the event. In those cases, you would use objectId
in the request JSON. You must include the vid of an existing contact, as you will not be able to create new contacts using objectId
. This example uses the objectId
instead of email:
utk
. The usertoken is used by the HubSpot tracking code to track visitors, and is stored in the hubspotutk
cookie. Use the utk
parameter to associate an event with a contact by usertoken. Note: It is not possible to associate events with anonymous visitors using the usertoken, so if the event is associated using only the utk
, and the provided usertoken is not already associated with a contact, no new contact would be created and the event would not be visible in HubSpot. However, the event would appear in the timeline if a new contact was associated with the usertoken through another means (usually through a form submission including the hutk, or through the identify method of the Tracking Code API). For this reason, we recommend including the email
in addition to the utk
to make sure that the event gets associated with a new or existing contact.
If you’re working with an event template for contacts, it’s possible to include multiple identification parameters with the event, so any combination of the email
, objectId
, and utk
parameters may be included. If multiple parameters are included, the objectId (vid) will have the highest priority when determining which contact to associate with the event, followed by utk
, with email
being the lowest priority. This means that you can update the email address of an existing object by including a new email address in the email
parameter with the vid
of a known object in objectId
. This example uses the email address and usertoken together:
objectId
to associate the event with the company or deal. For companies, the objectId
must be set to the companyId
of the company you want to associate the event with, and for deals you would set the objectId
to the dealId
of the deal object.
In the example below, assuming the event template was set to the COMPANY
objectType
, this event would be associate with the company object with companyId
528253914:
linkLabel
- The text used to display the link that will display the IFrame.headerLabel
- The label of the modal window that displays the IFrame contents.url
- The URI of the IFrame contents.width
- The width of the modal window.height
- The height of the modal window.url
:
PUT
command for updating a custom event template, note the objectPropertyName
field:
objectPropertyName
to map this custom event token to the contact
Object zz_webinar_name
property. This means that when we create a new event that specifies a webinarName
token, the zz_webinar_name
property of the associated contact
will also be set. You can set these to custom or predefined HubSpot properties.
For example, let’s say we already created a companyName
token referencing a zz_company_name
custom property on the contact. Then creating an event like this causes the zz_company_name
and zz_webinar_name
properties to be set on the contact with the email address a.test.contact@email.com:
extraData
extraData
comes in.
You can add an extraData
attribute to an event’s JSON body. The value of this extraData
can be any valid JSON. For example:
extraData
in a details template:
extraData
attribute can only be referenced in the details template for an event. It can’t be used in either the header template or in list segmentation.