Questions about PubSub's Wisper

This is what I get for doing this pre-coffee I misread your post and thought this was pure front end

Should be

window.Twitch.ext.listen(‘whisper-’ + window.Twitch.ext.viewer.opaqueId, function (topic, contentType, message) {
console.log('Received message: ’ + message);
});

And this nodeJS example will do the trick:

`use strict`;

const fs = require('fs');
const path = require('path');

/*
let config = JSON.parse(fs.readFileSync(path.join(
    __dirname,
    '..',
    '..',
    'config.json'
)));
*/

let config = {
    "client_id": "",
    "client_secret": "",
    "extension_secret": "",
    "owner_id": "",
    "version": ""
}


let broadcaster_id = '';
let target_user_id = '';

const jwt = require('jsonwebtoken');
const got = require('got');

const secret = Buffer.from(config.extension_secret, 'base64');

let sigPayload = {
    'exp':          Math.floor(new Date().getTime() / 1000) + 60,
    'user_id':      config.owner_id,
    'role':         'external',
    'channel_id':   broadcaster_id,
    'pubsub_perms': {
        'send': [
            'whisper-' + target_user_id
        ]
    }
}
let sig = jwt.sign(sigPayload, secret);


got({
    url: 'https://api.twitch.tv/helix/extensions/pubsub',
    method: 'POST',
    headers: {
        'Client-ID': config.client_id,
        'Authorization': 'Bearer ' + sig,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        target: ['whisper-' + target_user_id],
        broadcaster_id,
        is_global_broadcast: false,
        message: JSON.stringify({
            stuff: 'thing'
        })
    }),
    responseType: 'json'
})
.then(resp => {
    console.log(resp.statusCode, resp.body);
})
.catch(err => {
    if (err.response) {
        console.error('API ERROR', err.response.statusCode, err.response.body);
        return;
    }
    console.error('BAD ERROR', err);
});

{ “content_type”, “application/json” },

Is no longer needed in the body params thats an OLD PubSub API thing

What http code and body message are you getting back?