How to update stream title using Twitch API

I’m working on a Twitch bot and trying to add a feature that lets users update the stream title. My current code isn’t working and I keep getting a 410 GONE error.

Here’s what I have so far:

public updateStreamTitle = (title: string, done: any): void => {
    const self = this;
    const http = require('request');
    http.get("https://api.twitch.tv/kraken/channels/" + this.config.channel_name + "?client_id="+this.config.appId, { json: true }, function (error, response) {
        if (!error && response.statusCode === 200) {
            const existing_title = response.body.status;
            console.log(existing_title);
            const http2 = require('request');
            const params = {
                url: "https://api.twitch.tv/kraken/channels/"+self.config.channel_name+"?channel[status]="+existing_title+title,
                headers: {
                    "Authorization": "OAuth "+self.config.appId,
                    "Accept": "application/vnd.twitchtv.v2+json"
                }
            };
            http2.put(params, (err: Error, resp: any, data: any): void => {
                console.log("Stream title updated?");
            });
        }
    });
};

The current title shows up correctly in the console, but after that nothing happens. I think the API endpoint I’m using is deprecated. What’s the correct way to modify stream titles now?

That 410 GONE error means you’re hitting the old Kraken API - it’s dead. Had the same problem migrating my bot last year. You need to switch to Helix API with proper OAuth. Get a user access token with channel:manage:broadcast scope, then PATCH to https://api.twitch.tv/helix/channels with broadcaster_id. Use Bearer <access_token> in your auth header, not that old OAuth format. Request body should be JSON: {“title”: “your new title”}. Don’t forget the Client-ID header. Helix is way pickier about auth than Kraken was - verify your token has the right scopes and isn’t expired.

totally agree, kraken’s gone for good! switch to helix for sure. also, ur oauth token must have channel:manage:broadcast permission. and yeah, ur url setup looks off – drop those params, go for a proper JSON body. twitch dev docs got all the info u need since helix is a big change.

It seems you are encountering issues with the deprecated Kraken API, which is indeed no longer supported. To resolve the 410 error, you need to utilize the Helix API instead. Ensure you obtain a user access token with the ‘channel:manage:broadcast’ scope. Make a PATCH request to the Helix endpoint at https://api.twitch.tv/helix/channels, including the necessary headers: ‘Authorization: Bearer YOUR_ACCESS_TOKEN’ and ‘Client-ID: YOUR_CLIENT_ID’. The request body must be in JSON format, containing the title you wish to set. Additionally, remember that you should use broadcaster_id instead of the channel name in the request.