A collection of methods related to the Templates API
Methods
-
Create a template for a portal (see https://developers.hubspot.com/docs/methods/templates/post_templates)
Name Type Description opts
object Properties:
Name Type Description opts.category_id
number opts.folder
string opts.template_type
number opts.path
string opts.source
string opts.is_available_for_new_content
string Example
const hs = new HubSpotClient(props); hs.templates.createTemplate(opts).then(response => console.log(response));
-
Delete a template by id (see https://developers.hubspot.com/docs/methods/templates/delete_templates_template_id)
Name Type Description id
number Example
const hs = new HubSpotClient(props); hs.templates.deleteTemplate(id).then(response => console.log(response));
-
Get a template by id (see https://developers.hubspot.com/docs/methods/templates/get_templates_template_id)
Name Type Description id
number Example
const hs = new HubSpotClient(props); hs.templates.getTemplate(id).then(response => console.log(response));
-
Get the list of templates
Name Type Description opts
object Properties:
Name Type Description opts.limit
string opts.offset
string opts.deleted_at
string opts.id
int opts.is_available_for_new_content
boolean opts.label
string opts.path
string Example
const hs = new HubSpotClient(props); const opts = { limit: 10 }; // Get the first 10 templates hs.templates.getTemplates(opts).then(response => console.log(response));
-
Get the autosave buffer for a template (see https://developers.hubspot.com/docs/methods/templates/put_templates_template_id_buffer)
Name Type Description id
number body
object Properties:
Name Type Description id
number Example
const hs = new HubSpotClient(props); hs.templates.getUpdatedAutosaveBuffer(id).then(response => console.log(response));
-
Get the previous version of the Template(see https://developers.hubspot.com/docs/methods/templates/get_templates_template_id_versions_version_id)
Name Type Description templateId
number versionId
number Returns:
Type Description object Example
const hs = new HubSpotClient(props); hs.templates.getVersion(templateId, versionId).then(response => console.log(response));
-
List previous versions of the Template (see https://developers.hubspot.com/docs/methods/templates/get_templates_template_id_versions)
Name Type Description id
number Returns:
Type Description array Example
const hs = new HubSpotClient(props); hs.templates.getVersions(id).then(response => console.log(response));
-
Determine if the auto-save buffer differs from the live Template (see https://developers.hubspot.com/docs/methods/templates/get_templates_template_id_has_buffered_changes)
Name Type Description id
number Returns:
Type Description boolean Example
const hs = new HubSpotClient(props); hs.templates.hasBufferedChanges(id).then(response => console.log(response));
-
Copies the contents of the auto-save buffer into the live Template (see https://developers.hubspot.com/docs/methods/templates/post_templates_template_id_push_buffer_live)
Name Type Description id
number Example
const hs = new HubSpotClient(props); hs.templates.pushBufferedChangesLive(id).then(response => console.log(response));
-
Restore a previous version of the Template (see https://developers.hubspot.com/docs/methods/templates/post_templates_template_id_versions_restore)
Name Type Description templateId
number versionId
number Returns:
Type Description object Example
const hs = new HubSpotClient(props); hs.templates.restoreVersion(templateId, versionId).then(response => console.log(response));
-
Update the autosave buffer for a template (see https://developers.hubspot.com/docs/methods/templates/put_templates_template_id_buffer)
Name Type Description id
number body
object Example
const hs = new HubSpotClient(props); hs.templates.updateAutosaveBuffer(id, body).then(response => console.log(response));
-
Update a template for a portal
Name Type Description opts
object Properties:
Name Type Description opts.template_id
string opts.source
string Example
const hs = new HubSpotClient(props); hs.templates.updateTemplate(opts).then(response => console.log(response));