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

hotjar-slack-notifier

v1.0.0

Published

This script was created to run periodically on my machine, with the purpose of forwarding the latest Hotjar responses to a Slack channel.

Downloads

1

Readme

Hotjar to Slack Notifier

This script was created to run periodically on my machine, with the purpose of forwarding the latest Hotjar responses to a Slack channel.

Setup Instructions

  1. npm install hotjar-slack-notifier or yarn add hotjar-slack-notifier
  2. Create a JSON storage endpoint that will store data in the shape of { lastIndex: 0 } Free tools include https://jsonstorage.net http://myjson.com https://jsonbin.io or even Firebase. Keep the API version of the URL handy.
  3. Create a Slack webhook and keep the URL handy
  4. Find the two Hotjar values you need: your site ID and the ID of the poll you wish to monitor
  5. Invoke the code as per the below value

Example call

const HJSlack = require('hotjar-slack-notifier');

HJSlack({
    hotjarSiteId: 123456,
    hotjarPollId: 789012,
    currentIndexUrl: 'https://...',
    slackWebhookUrl: 'https://hooks.slack.com/...',
    username: '[email protected]',
    password: 'hunter2',
});

Parameters

The two Hotjar values can best be discovered by dissassembling the URL of the page containing the responses to the poll you're interested in.

| Parameter | Description | Type | | --- | --- | --- | | hotjarSiteId | This is the ID associated with your Hotjar instance | String/Integer | hotjarPollId | This is the ID associated the particular poll you are interested in monitoring the responses to | String/Integer | currentIndexUrl | The URL of an endpoint that accepts GET/PUT API calls to both fetch and update the index (Integer) of the last Hotjar poll response | String (URL) | slackWebhookUrl | The URL of the Slack webhook to invoke | String (URL) | username | DANGER: Your Hotjar account username (appears to be an email address). | String | password | DANGER: Your Hotjar password | String

FAQs/Known Issues

Why does this script need my username and password?

At the time of authoring, Hotjar does not offer a public API nor a Slack plugin. While writing one would facilitate the other, Hotjar have stated that a Slack plugin is not going to be included in their roadmap. While Hotjar does have an API, it is for their internal use only and there is no public access to it.

Why does this run in a headless browser (Puppeteer)?

For the above reason, there is no other way to authenticate with their (private) API than to login as yourself and intercept the API requests used to build the poll responses page

Why are you using free, unauthenticated online JSON storage?

Because all they are storing is a single integer, the index of the last response that was "seen" by the script and posted to Slack.

I'm getting a timeout error

Sometimes puppeteer can be a bit flakey, even with high speed fibre internet. It may struggle to load and find the login form on the page.

The script won't get past fetching the index

Ensure that you are:

  • Using the API version of your desired JSON storage service (eg: api.service.com/id/ vs service.com/id)
  • The first time it loads will be indistinguishable from an error, so ensure that you have data in the shape of { lastIndex: 0 } for the first load

It skipped the first response

Maybe the line above should have been -1 not 0 🤷‍♀

The script won't update the index to the new position

Ensure that the JSON storage service you are using supports PUTs.

License/Warranty

This software is provided as is. You are entering your username and password into a third party script. You do so at your own risk.