first commit
This commit is contained in:
24
utils/subscribeToEvent.js
Normal file
24
utils/subscribeToEvent.js
Normal 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) })
|
||||
}
|
||||
Reference in New Issue
Block a user