Hello,
Despite having an up to date OAuth token and User Access Token, when I try to subscribe to EventSubs I keep getting:
{
error: 'Bad Request',
status: 400,
message: 'missing or unparseable subscription condition'
}
Code in question:
sublist = ['channel.follow','channel.raid'];
let subs = sublist.map(function (x) {
let sub = {
version: "1",
type: x,
condition: {
broadcaster_user_id: id,
to_broadcaster_user_id:id
},
transport: {
method: "webhook",
callback: "https://events.hookdeck.com/e/src_mnIcaKuCZVjRaKLupNqFCjOq",
secret: process.env.SUB_SECRET
}
};
fetch ("https://api.twitch.tv/helix/eventsub/subscriptions", {
method:'POST',
headers: {
'Client-ID': process.env.CLIENT_ID,
'Authorization': process.env.TOKEN,
'Content-Type': 'application/json'
},
body:JSON.stringify(sub)
} )
.then(res => res.json())
.then(data => console.log(data));
});
You cannot send both broadcaster_user_id
and to_broadcaster_user_id
in a given subscription request.
This is likely what is confusing EventSub.
You need to send a distinct type
and a distinct set of conditions
You are expecting helix to ignore useless data.
So for both follow and raid you are sending two ID’s when only one is expected
So you probably want something like
sublist = {
'channel.follow': { to_broadcaster_user_id: id }
'channel.raid': { broadcaster_user_id: id }
};
Where you define both the type
/topic and the conditions
And for
that instead of map
ing
Hello, and thank you for the response. I have been trying to get this to work, and even with simply:
let sub = {
version: "1",
type: "channel.follow",
condition: {
broadcaster_user_id:id
},
transport: {
method: "webhook",
callback: "https://events.hookdeck.com/e/src_mnIcaKuCZVjRaKLupNqFCjOq",
secret: process.env.SUB_SECRET
}
};
fetch ("https://api.twitch.tv/helix/eventsub/subscriptions", {
method:'POST',
headers: {
'Client-ID': process.env.CLIENT_ID,
'Authorization': process.env.TOKEN,
'Content-Type': 'application/json'
},
body:JSON.stringify(sub)
} )
.then(res => res.json())
.then(data => console.log(data));
With id having a valid value. I get the same error.
The ID you present in the condition is a string and not an interger?
So
condition: {
broadcaster_user_id: "26610234"
},
and not
condition: {
broadcaster_user_id: 26610234
},
``
It works now. thank you so much.
system
Closed
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.