Running into a problem here and any help would be greatly appreciated. Thank you in advance!
I am currently trying to subscribe to eventsub channel.chat.message for a webhook. When doing so with my app access token I get the “subscription missing proper authorization” error message back.
$url = "https://api.twitch.tv/helix/eventsub/subscriptions";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = array(
"type" => "channel.chat.message",
"version" => "1",
"condition" => array (
"broadcaster_user_id" => "redacted",
"user_id" => "redacted"
),
"transport" => array (
"method" => "webhook",
"callback" => "redacted",
"secret" => $eventsub_secret
)
);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$headers = array(
"Content-Type: application/json",
"Authorization: Bearer ".$oauth_app_access_token,
"Client-Id: ".$clientid,
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
echo '<pre>Results:
'; print_r($resp); echo '</pre>';
echo '<pre>Curl Info:
'; print_r($info); echo '</pre>';
I am trying to do this for my channel with a bot that I have created in my developer console under applications. The bot is setup to moderate my channel so based on the documentation I just need the app access token and the user access token. I believe the user access token has the correct scope which is “scope”:[“user:bot”,“user:read:chat”,“user:write:chat”] as returned by my request with the “code” to https://id.twitch.tv/oauth2/token.
I am confused by the documentation which says:
“The first User Access Token you’ll need is one for the bot that will be reading chat”
How can I do this “for the bot”? When I go through the “Authorization code grant flow” the authorization comes from my account, so I am confused. What am I missing here?