There's a new version of the HubSpot API
We're also working on a new documentation website, you're invited to check it out and give us your feedback.
Events are rendered to the timeline based on the headerTemplate and detailTemplate set for the event type. The headerTemplate is used to show the event in the timeline, and the detailTemplate is used when someone views the details of the event. Templates are built using handlebars and markdown. The properties for the event are inserted using handlebars, and the result is then processed as markdown, generating the HTML that will be shown in the timeline. Raw HTML is not allowed, and will be stripped by the handlebars and markdown processors. If you are creating or updating the template through the API, you can use \n
to render a line break.
Aside from HTML, everything else in Markdown is valid, including generating links like [This will be a link to hubspot](hubspot.com)
, that would be rendered to <a href="hubspot.com">This will be a link to hubspot</a>
.
When rendering an event, all its properties will be available through handlebars, so you could do something like: # String property value is: {{StringProperty}}
, which would render to
String property value is: WhateverStringPropertyIs
{{extraData[1]}}
. If it's an object, you can access its attributes like an object: {{extraData.somethingExtra}}
.{{#formatDate timestamp }}{{/formatDate}}
. This helper also supports different date formatting like:
{{#formatDate timestamp}}{{/formatDate}} -> Nov 18, 2014 3:47:11 PM
{{#formatDate timestamp format="short"}}{{/formatDate}} -> 11/18/14 3:47 PM
{{#formatDate timestamp format="long" time="false"}}{{/formatDate}} -> November 18, 2014
{{#formatDate timestamp format="full" time="false"}}{{/formatDate}} -> Tuesday, November 18, 2014
To see the HTML that will be generated by a template, you could use the same endpoint as the one to get an event:
GET /integrations/v1/{application-id}/timeline/event/{event-type-id}/{event-id}
Just add the header Accept: text/html. This would render the event using the headerTemplate. If you want to see the HTML generated by the detailTemplate, you can add the boolean parameter detail=true.