first commit

This commit is contained in:
Zachary Guénot
2023-05-08 04:47:30 +02:00
commit be73cd765d
5 changed files with 144 additions and 0 deletions

24
utils/subscribeToEvent.js Normal file
View File

@@ -0,0 +1,24 @@
const axios = require('axios')
module.exports = async (access_token, session_id, client_id) => {
await axios.post('https://api.twitch.tv/helix/eventsub/subscriptions', {
type: 'channel.channel_points_custom_reward_redemption.add',
version: '1',
condition: {
broadcaster_user_id: '1337',
reward_id: 'abcf127c-7326-4483-a52b-b0da0be61c01'
},
transport: {
method: 'websocket',
session_id
}
}, {
headers: {
'Authorization': `Bearer ${access_token}`,
'Client-Id': client_id,
'Content-Type': 'application/json'
}
}).then(response => {
console.log(response.data)
}).catch(error => { console.log(error) })
}