Feel free to use any module that can recieve HTTP Posts requests, I use express myself, so use what you are comfortable with, and you don’t have to use NodeJS.
I found a solution that uses the https module, because it is already in node.
For channel points first you need an access token (with the relevant scopes attached) to a channel that has channel points enabled, which is affiliate+
The mentioned solution looks like this…
const https = require('https');
const options = {
host: 'id.twitch.tv',
path: '/oauth2/token?client_id=[myClientID]&client_secret=[myClientSecret]&grant_type=client_credentials&scope=channel:read:redemptions',
method: 'POST',
};
callback = function(response) {
let str = '';
response.on('data', function (chunk) {
str += chunk;
});
response.on('end', function () {
console.log(str);
});
};
https.request(options, callback).end();
…which gives me this…
{"access_token":"[myAccessToken]","expires_in":5301018,"scope":["channel:read:redemptions"],"token_type":"bearer"}
So I have an access token now, but:
1.1 My channel has NOT channel points enabled. Can I still make tests?
1.2 If yes, I should use your twitch misc aboutchannel points then?
2.1 The PubSub says, I need a constant connection to the topic with LISTEN, PING and wss://pubsub-edge.twitch.tv. Do I have to do that with this?
2.2 If yes, how would it look like combined with twitch? Something like this?
const https = require('https');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Connected with topic.');
res.end();
}).listen('wss://pubsub-edge.twitch.tv');
2.3 If no, what would be the right code?