hub-batch

1.1.6 • Public • Published

Hub-Batch

NPM

A library the utilizes HubSpot APIs for bulk updating COS content (Blog Posts and Site Pages). Hub-Batch allows you to:

  1. Export post/page information from HubSpot to a CSV file
  2. Import post/page information to HubSpot from a CSV file
  3. Update and Publish live COS content
  4. Rollback changes 1 revision just in case

This tool has been used by HubSpot to bulk update content, with over 1000 pages updated at once.

hub-batch UI

Getting Started

Prerequisite

This tool requires node.js. You can install Node here.

Installation

$ npm install -g hub-batch

Static IDs Setup

This tool allows you to quickly filter your get requests by blog groups, campaigns, topics, page name and/or URL slug. Since this information is unique to each HubSpot portal, you will need to populate the file js/static/staticids.js with your own IDs. Place any blog groups, campaigns or topics into that file, and they will automatically appear when using this tool.

Resources for finding each type of GUID:

To find a campaign GUID, click on the campaign in app and the GUID will appear in the page's URL

After you complete these two steps, you are ready to begin.

Usage

$ hub-batch

When you first run hub-batch in terminal, you will be asked to provide some authentication details. HubSpot’s APIs allow you to authenticate using a HapiKey or Access Token. You will automatically asked to be add a new token if the existing token expires.

Next, you’ll be asked to select a folder for Hub-Batch to be placed. This is the folder where CSVs will be exported and where you can add CSV files to be imported.

After this set up is complete, run $ hub-batch again to begin.

Example

From terminal, run:

$ hub-batch

Using the arrow keys, walk through the options provided:

hub-batch UI

After selecting your preferences, the CSV will be created: hub-batch sample IO

Documentation

This documentation covers the 4 main features: GET, UPDATE, PUBLISH, ROLLBACK

GET

Use this option to Get a CSV containing COS blog post/page data.

From terminal, run:

$ hub-batch

Using the arrow keys, select the following:

  • Content type: Blog Posts or Site Pages

For Blog Posts:

  • Operation type: GET
  • Which blog would you like to access?: This allows you to export content from a specific blog in your portal
  • Page State: Drafts, Published, Scheduled or All
  • Optionally refine further by:
    • Campaign
    • Topic
    • Name
    • Slug

For Site Pages:

  • Operation type: GET
  • Export drafts as well as live pages: Y/N
  • Optionally refine further by:
    • Campaign
    • Name
    • Slug

After selecting your options, hub-batch will create a CSV and place it in your exports folder. The resulting CSV will contain that following information by default for each page/post exported:

  • URL
  • Post Body
  • Meta Description
  • Name
  • ID
  • Slug
  • HubSpot Edit Link

And that's just the default. You can customize the tool to output whichever properties you'd like (even custom modules!). Once you have the CSV, open the file in Google Sheets (Excel mangles special characters) and make any changes you see fit to any of the properties. Find/Replace can be really handy. This has been very useful when rebrand or making any other bulk changes to live content.

UPDATE

Use this option Update the contents of COS blog post/page data. You will have the ability to select a CSV to import. An example import file can be found here.

From terminal, run:

$ hub-batch

Using the arrow keys, select the following:

  • Content type: Blog Posts or Site Pages
  • Which file would you like to import?: This will list any CSV file found in the Hub-Batch Imports folder.

After selecting the import file, Hub-Batch will begin updating each of the pages found in the CSV. NOTE this will save the changes in Buffer, but will not push the changes live. To publish these changes, next use the PUBLISH option.

PUBLISH

Use this option to Publish pages that have been updated or have unpublished changes.

From terminal, run:

$ hub-batch

Using the arrow keys, select the following:

  • Content type: Blog Posts or Site Pages
  • Which file would you like to import?: This will list any CSV file found in the Hub-Batch Imports folder.

After selecting the import file, Hub-Batch will begin publishing each of the pages found in the CSV.

ROLLBACK

Use this option to Rollback published changes. This feature will revert any included pages 1 version.

From terminal, run:

$ hub-batch

Using the arrow keys, select the following options:

  • Content type: Blog Posts or Site Pages
  • Which file contains the content you'd like to rollback 1 version?: This will list any CSV file found in the Hub-Batch Imports folder.

Package Sidebar

Install

npm i hub-batch

Weekly Downloads

4

Version

1.1.6

License

MIT

Unpacked Size

50.3 kB

Total Files

23

Last publish

Collaborators

  • c-stone