npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hub-batch

v1.1.6

Published

Command line utility for getting/updating/publishing COS Content. Work with Blog Posts and Site Pages

Downloads

6

Readme

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.