Posting to Bluesky via PowerShell on macOS
The week of PASS Data Community Summit 2024 (November 4-8), Bluesky seemed to reach critical mass with the data community as well as the tech community writ large. Over the week, I saw a few posts (“skeets” I guess?) from Jeff Hicks saying that he was working on a PowerShell module for Bluesky. I said to myself “interesting, I’ll keep an eye on that.”
On the evening of November 11th, Jeff posted that he needed help troubleshooting an apparent issue on macOS.
Is anyone using the PSBlueSky #PowerShell module on a Mac and able to post a message from a PowerShell prompt without error? I’m troubleshooting an issue.
I’ve got a Mac. I’ve got PowerShell. Let’s go! After a bit of tinkering (mostly getting the credentials right), I was able to post successfully. Yay!
But a note in Jeff’s included help PDF got me thinking about the next step.
For automation purposes, you can use the Secrets management module to store your credential. Write your own code to retrieve the credential and pass it to the module commands.
Secrets management is something that I’ve been meaning to get my arms around and, where possible, make use of. Haven’t needed it much at work oddly enough, and I’m not 100% certain that our access management platform has everything enabled that I’d need. At home, I use 1Password. It turns out that there is a 1Password module for PowerShell, so I installed it and tried to get to work.
|
|
Huh. OK, let’s get that installed via Homebrew:
|
|
Same result. Take a closer look at that Import-Module
error - it’s looking for a Windows executable. I checked the GitHub repository and even cloned the repository - yep, it’s only going to work in Windows, and it’s expecting to find the 1Password executable in the path you’re currently working in. I’d like to see about addressing both of those, but not today. For now, I’ll just roll my own code to pull the app password I created for PowerShell (called psbsky
in my vault), then get on with setting up the credential so I can talk to Bluesky.
|
|
Excellent! Now I can go ahead and use Jeff’s module.
|
|
Jeff’s module has a number of other functions you can use to explore and interact with your Bluesky account. Check it out!