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 optsobject Properties:
Name Type Description opts.category_idnumber opts.folderstring opts.template_typenumber opts.pathstring opts.sourcestring opts.is_available_for_new_contentstring 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 idnumber 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 idnumber Example
const hs = new HubSpotClient(props); hs.templates.getTemplate(id).then(response => console.log(response)); -
Get the list of templates
Name Type Description optsobject Properties:
Name Type Description opts.limitstring opts.offsetstring opts.deleted_atstring opts.idint opts.is_available_for_new_contentboolean opts.labelstring opts.pathstring 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 idnumber bodyobject Properties:
Name Type Description idnumber 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 templateIdnumber versionIdnumber 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 idnumber 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 idnumber 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 idnumber 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 templateIdnumber versionIdnumber 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 idnumber bodyobject 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 optsobject Properties:
Name Type Description opts.template_idstring opts.sourcestring Example
const hs = new HubSpotClient(props); hs.templates.updateTemplate(opts).then(response => console.log(response));