How to Set Up Twitter Developer Api for BluebirdPS

Overview

Intro

I've been doing some testing of scripts to help the community find Twitter members on Mastodon for Chrissy LeMaire. You can find those scripts here.

Chrissy has done all the hard work and I've been testing it :) The scripts make use of BluebirdPS which is a Twitter automation client for Powershell. In order to get it working, I had to register for the Twitter developer network. This took me less than 10 minutes set up, seems like there's no-one left to vet applications!

This post describes the steps needed to configure your profile and the powershell module. I've already registered my personal twitter profile, so examples below are from my user group twitter profile.

Set up Twitter Developer account

In order to use BluebirdPS we need to set up a Twitter Developer account and generate a set of keys that will allow it to use the Twitter API. The module requires the following keys / secrets;

  • API Key
  • API Key Secret
  • Access Token
  • Access Token Secret

So first and foremost, you need to set up a Twitter Developer account then generate the required keys. You can register for the developer portal here. You need to confirm some basic info and agree to not share content with certain governments. Selecting Exploring the API saw me auto-approved, seems approval has taken longer for other folks so maybe stick with this option.

The first screen of the application process has multiple questions, you twitter account, which country you are in, what your use case is and requires you to agree to not share data with certain governments

When you hit let's do this you will be asked to agree to T&Cs. Once you've agreed, you will be asked to verify your email address.

Confirmation screen says Time to verify your email and asks you to find the email in order to get in

Once you have verified your email address, you will see a welcome screen, where you will be asked to name your app, it needs to be unique.

image says Welcome to the Twitter Developer Platform and asks you to enter a name for your project

You will then be supplied a set of keys, these are required to configure BluebirdPS to use the Twitter API, so make a note of them for later. These keys are for your use only and should be kept secure.

image shows a page presenting your API Key, your API Key Secret and your Bearer Token

Once you've made a note of them, click on Dashboard. Twitter will ask you to confirm you've made a note of they keys. Hit yes and you will then go through to the dashboard where you can generate your access token. Next to the project you created you will see a settings cog and a key. Click on the key to generate your access token & access token secret.

the image shows your twitter dashboard, there is an entry for your project, to the right of the name are two icons, settings and keys

you will find all of your keys presented here, make a note of the access token & access token secret.

the image shows a screen showing all of your keys & secrets, the access token & access token secret have now been generated and added to the original three

Your work is done here, now to install the powershell module...

Install module

All remaining steps are followed the instructions described here on the BluebirdPS readme.

Install the module by running the following command;

1Install-Module -Name BluebirdPS -Scope CurrentUser

Once it's installed, you will we'll need to set up authentication with Twitter by running the following command;

1Set-TwitterAuthentication

You will be asked to enter each of the keys / secrets, paste in each value and presse enter;

the screen shows the output from Set-TwitterAuthentication where all keys / secrets have been input

Once you've done that you should be ready. You can prove it worked by running the following command;

1Get-Tweet -Id 1593559643942522880

If everything has worked, you will see info related to Chrissy's tweet about moving to Mastodon;

the image shows an output from the powershell module displaying metadata from tweet ID 1593559643942522880

That's it!

Nice and simple, more example commands can be found here.

Thanks

If you made it all the way down here, thanks for reading my post and enjoy your day.

#mtfbwy