 Do you want to automatically post a go live message to Discord when you start your stream? How about changing your Twitter name and profile image? What about turning on Shield mode when you end your stream and turning it back off again when you start next time? This all possible with Streamerbot, and I'm going to show you how. Doing all this has a lot of moving parts, so let's go through it one by one. The most difficult part of all of this is interacting with Twitter API, so let's tackle that first. I love being able to change my name, my profile image, and banner when I go live, and when I end the stream. And since Twitter is the main social media site I use as a content creator, I find it to be a really nice touch. As a fair warning, if you're paying for Twitter Blue and have the little checkmark, I believe I've heard that changing your name will invalidate your little checkmark, so you may not want to do this part. To do this, I'm using some actions that have been published on the Streamerbot extensions page as a collaboration by Nate and TerrierDarts. I'll put the link to their instructions down in the description, but we'll also be going through it now as well, as some of the Twitter stuff has changed somewhat dramatically, and it'll look a little different than it did in their video about it. The biggest roadblock in dealing with the Twitter API is that you first need to be approved for developer access to Twitter, with elevated access. This process used to take several days to get approval, but I think with the scaled back staff, it's fully automated now. I got approved instantly when I made this video, so that's nice. I can't guarantee that it'll be instant for everyone, but that's what happened to me. To get started, you'll want to go to the developer portal on Twitter. The link is in the Streamerbot extension page I put in the description, but I'll also put that direct link in the description as well. On that portal page, you'll want to log in with your Twitter account, and then it'll ask you for some additional information, like an email address, the country you're based in, and the use case for why you need a developer account. You'll then have to agree to some terms and conditions, as well as verify your email address. Next, you get to a page that asks you to set a name for your app. I suggest something like my SB Twitter app, but replace my with your name or something. Doesn't really matter. Once you set a unique name, you can click Get Keys, and you'll be brought to a page with three fields. API key, API secret, and bearer token. You don't really need the bearer token, but we're going to copy it anyway. Make sure you copy these also more safe, and click through the next page, and you'll be on your dashboard. Before we move on, we need to apply for elevated access. To do so, click on Projects and Apps on the left, and click Project 1. You'll see a button that says, Do you need elevated access for your project? Click that. You'll now have to jump through some more hoops and fill out another form. You'll be asked how you want to use the elevated access. For this, you can be as detailed as you want, but the gist is that you should say, I'm a Twitch streamer, and I want to use the API to automatically change my name, profile image, and banner when my stream goes live, and then revert these changes when I'm no longer streaming. I'll be making these requests from custom C-sharp code. Something along those lines should be fine. There are some toggles as well. You can untoggle all of them, but the second, are you planning on analyzing Twitter data? No. Will your app use tweet, retweet, like, follow, or direct message functionality? Yes. For the description on this toggle, you can just type something like, as a streamer, I'd like the option of tweeting out a, my stream is now live message of some sort when I go live. I'm on the fence about whether I'll actually do this, but I'd like access to do so if I decide to. All the rest of the toggles here you can set to no. Do you plan to display tweets or aggregate data about Twitter content outside of Twitter? No. Will your product, service, or analysis make Twitter content or derived information available to a government entity? No. Now click next at the bottom. The next page is just a review step you can skim, and verify. The following page is yet another terms and conditions page that you can blindly agree to, or actually read it if you're into that kind of thing. Now, if you get approved instantly as I did, you'll have elevated access. So let's get back to actually setting things up. Click into your app under the project menu on the left, and click the edit button at the top. Scroll down and change the environment variable to production and click save. Now click settings and click setup at the bottom next to user authentication settings. On this page, under app permissions, choose read and write. Under type of app, choose web app, automated app or bot. Now under the app info, we want to set the Streamerbot HTTP server address as our callback URL. The default for this is right here. If you haven't set up the Streamerbot HTTP server yet, we'll get back to that next. It's very easy. Back to the form you want to put your Twitter profile address as the website URL. Now click save. It'll give you a new page with an OAuth 2 client ID and secret. We don't need this for the integration, but it's a good idea to copy them somewhere safe. Finally, and this is the last bit here inside of Twitter, I swear, we want to grab our access token now that we're set to use read and write permissions. Click the keys and tokens tab at the top. You already captured the API key and secret earlier, but if for whatever reason, you did not copy and paste those somewhere safe for reference, you can regenerate them now and copy them again. You'll also want to click generate next to access token and secret, as we'll need those values as well. Popup will show and give you an access token and an access token secret. Copy these somewhere safe and click yes, I copied them. Now we're done on the Twitter developer portal. Before we run the import, let's make sure the Streamerbot HTTP server is set up. Click the server's clients tab, then the HTTP server tab, and check the auto start checkbox. The default values for the address and port should be fine. These are 127.0.0.1 and 7474 respective. Now click start server. Now we can get to importing and setting up the Streamerbot actions, and this will all come together. The import code you need is in the Streamerbot extensions wiki link that I put in the description. When you scroll down, there will be a section labeled import code and you can triple click and copy it. Inside Streamerbot, click import at the top, paste this string in the box that pops up, and then click import at the bottom. It should pull in five new actions and group them. Open up the Twitter API main code action and open up the execute code subaction. Here we're going to paste in all our keys and secrets. In all cases here, make sure the at sign and the double quotes remain there, and just paste the key or secret between the quotes, making sure you don't leave any extra spaces or anything in there. The API key will go where it says consumer key. The API secret will go where it says consumer key secret. Access token and access token secret go similarly in the next two lines. At the bottom, click compile and then save, and we should be good to go. All that's left is setting up the values that we want to send to Twitter on StreamStart and StreamEnd. First, open up the Twitter update on live action. You'll want to set the value for tweet name to what you want your Twitter name to display when you're live. Generally people will put their word live surrounded by big red dots or something, but feel free to do whatever you want. Think I use fire symbols. Next, you want to set the image path to a path to where the profile picture you want is. This is meant to be a square image. I'm using a PNG that's 2048 by 2048, but that's probably much bigger than it's needed. Similarly, set the banner path to the path of the banner image you want to have when you're live. For this, I'm using an image that is 1200 by 480. You'll also want to make sure that this line is enabled if you want to change your banner. By right clicking and clicking, enable do the same thing with the sub-action at the bottom for execute method banner swap. If you wish to post a Twitter go live post, you can set the text in the tweet text variable how you want, but I personally disable this bit as well as the next sub-action that executes the tweet text method. Now we can go in and do all the same stuff for the Twitter update on end action. Generally it'll be your normal profile picture and banner and name. Remember to enable the sub-actions for the banner image if you wish to use that feature. For testing purposes, let's set up some commands real quick just to see how things work. I'll use exclamation Twitter live as the command and then choose the Twitter update on live action. Set permissions to moderators only just in case. Similarly, I'll use exclamation Twitter normal for the second command and choose the Twitter update on end action. Now we can test. I'll go into chat and type exclamation Twitter live and then refresh my Twitter page and you'll see the name, profile, pick, and banner all change. Then when I type exclamation Twitter normal it all changes back. We can now disable these commands since they were just for testing. So now we have working actions that will change your Twitter names and images. Before we get to how to wire those up to the start and end of your stream, let's put together a couple more actions that we'll also want to do then. Next on this list is posting a go live post to Discord. I already made a video about posting to Discord with Streamerbot which I'll put in the description if you want more thorough instructions. But we'll go through it again briefly here. Fortunately, this is significantly easier than interacting with the Twitter API so it'll be pretty quick. Go to the server settings in Discord, click integrations, then web hooks. Click new web hook, give it a name, an icon if you want, and choose the channel you want to post in. Then click copy web hook URL and paste it somewhere for later. Back in Streamerbot, make a new action called post go live to Discord. Under sub actions, right click, pick Discord and basic web hook. Give it a name, assign the username you want to post as, and paste that URL we copied as the web hook URL. And then the content you want to post. Depending on how you decide to wire this up, we can pass some variables into this content block to describe the game being played and whatever else you want in a go live post. You'll see I have game and current title in there and we'll get to how to fetch those in a minute if you want to use them. If you need multiple lines, you can use control plus enter to make line breaks here. If you want to include the current stream category in the content here, you can get it by first adding a sub action to fetch the target info for the broadcaster. Add this sub action by going to Twitch, user, get user info for target, and then in the pop up, use the default where the source type is broadcaster. Now you should be able to use the game variable and subsequent sub actions. Getting the title is a little trickier, but as long as you're okay with making a third party API call, it's really pretty easy. Hit me up in the comments if you wanted a way to do this directly from the Twitch API, but it's far more complex and requires another import code. Hopefully this will be natively available through Streamerbot at some point. Add a new sub action, choosing core, network, fetch URL, and then add this URL. Set current title as the variable name here and you should now be able to use this in your Discord go live post as well. Now let's set up a quick command, see if this works. We'll go to commands, click add, put exclamation go live as the command and choose the action we just set up as the action. Don't worry about permissions, we'll delete this test command once we're done. Now we have actions that can change our Twitter name and image, post a go live to Discord, and we're almost ready to wire them up to our stream start and end events. But before we do, let's set up one last thing that I think is really helpful, some offline hate rate protection. I made a video in the past about using Streamerbot to protect yourself from hate raids and there are a dozen other videos out there about it as well, but since those were made, Twitch has added this wonderful feature called shield mode, which basically does all of that stuff natively and it's nice and easy for you and your mods. What I like to do is turn on shield mode when I end my stream so that my channel can't get attacked while I'm offline. So let's set up some quick actions to do this. First we go to actions and click add. I call this one lockdown. Under sub actions, all we need is one now. I used to manually turn on sub only mode, follower only mode, slow mode, etc. But now all we need to do is right click, choose twitch, moderation, update shield mode status, and then in the pop-up we choose yes and then it'll automatically turn on shield mode and enable anything that you set up within shield mode on your stream. Now let's make an unlock action and do essentially the same, but this time we'll choose no for the state of shield mode. I promise we'll get to wiring this up to the start and end events, but we need to do one last thing. So let's make two more actions to put all this stuff together. One for stream starting and one for stream ending. And at the same time, we'll introduce what may be a new concept for some of you, calling an action from within another action. Sounds complicated, but it's really not. We'll start with the stream starting action. Create a new action and name it stream start. Then under sub actions, right click, choose actions and then pick run action. Now we can scroll down and find our Twitter updated on live action. Click select and then click okay. Now we'll do the same thing for our post go live to discord action. Right click, choose actions, run action, scroll down, find the discord action, click select and okay. Then we do the same thing once more for the unlock action, the disable shield mode. This gives us one parent action that we can trigger that will run all three of these other actions. Now we'll set up the stream end action the same way, except that we only need two sub actions. Create a new action, name it stream end. Under sub actions, right click, go to run action and pick the Twitter updated on end action. Then do it one more time for the lockdown action that will enable shield mode when you end the stream. Now it's really, really time to wire this all up to trigger when your stream starts and when it ends. Before stream robot 0.1.17, the best way to do this was to use OBS events and set up some logic to detect the stream state change, then fire the appropriate action. You can certainly still do it all this way, and in the stream robot extension page I linked for their Twitter stuff there are instructions on how to do so, but in versions of stream robot at or after 0.1.17, there's a much simpler way. So that's what we'll do now. It's very easy. Just go to platforms tab, click twitch, and then channel, and you'll see two events, stream online and stream offline. Click on stream online and assign the stream start action. Then click stream offline and assign the stream end action. Now when you go live, this event will trigger and your stream start action will fire, turn off shield mode, change your Twitter name, profile picture and banner, and post a go live message to your Discord. And all you have to do is click start streaming. And then when you're done, you click stop streaming, it'll change your Twitter stuff back, and it'll turn shield mode back on. I hope this was helpful. Please click the like button and share this with someone you think needs to know how to do this. Let me know in the comments what else you'd like to happen automatically when you click start streaming, and we'll figure it out together. For now, check out this video about how to manage ads effectively on Twitch. And I'll see you over there.