Account Locked

X Account Locked!

Well, it happened. My X account got locked, which I suppose is kind of a badge of honor. My mistake? Posting a not-so-nice reply to our White House Press Secretary, who is celebrating a traitor’s visit to the White House.

"I AM NOMAD"

Whoopsie_Daisey

Whoopsie Daisey!!

So when X says you’re limited to 100 Post pulls per month… they really mean “100 posts”! Duh. For some reason I thought this meant individual API calls. And when I made the mistake of setting the variable max_results=100… I immediately reached and breach my post cap. :/

"Posts pulled of 100"

Hopefully this doesn’t trigger some charge… especially because even the BASIC package costs some $200/month!!!

"Bill The Butcher"

Twitter Bot Deployed

It’s Alive!!!!

I’ve got my X bot deployed to AWS! I cleaned up the code and got all the tokens stored safely. I put together a simple pipeline (that GitHub callls Actions) that does the pip build, and runs the Terraform to build and deploy the AWS resources. I also built a CloudWatch Event rule that is essentailly a cronjob.

"I AM NOMAD"

Now What?

The Twitter bot was fun and simple. But, it basically just makes very simple posts. I think next I’m going to try to create another bot that actually reads posts and makes some kind of reaction. This will be something of a fresh challenge, as I’ve not really dug into reading the X feed with the API, except to make some Postman calls. And I can’t just hammer away at the API, because Free Teir only allows 1 call every 15 minutes, and 100 calls per month.

"Twitter API Limit"

So, I’m basically going to be limited to doing reads about 3 times a day. Not a lot, but I figure I can do one in the morning, one around noon, and another in the evening. Maybe that will be plenty.

More to come!

CI Test

Testing GitHub CI Deployment

I have set up the CI pipeline for this project. I’m used to using GitLab’s .gitlab-ci.yml so we will see how this compares.

Lata!! ☮

OpenAI X Bot

Experimenting with OpenAI

Brushing off the cobwebs of some of my personal projects. I’ve started messing with a bot script that I had started a couple of years ago. The script was very crude and my first attempt at using the X (Twitter) API. It would simply pick a news story from two or three hard coded media sources, and give a greeting with the time and link to the story.

But … by plugging OpenAI into the equation, I’ve been able to make my bot seem pretty legit. Now, I grab the news source (still from a static list of RSS feeds) and ask OpenAI to write a short message about it. I asked it to give it a cowboy personality, and to have a certain political slant. I gotta say, it was easy and it worked like a charm!

What’s Next?

I want to keep playing with this bot. Right now it is picking the news article randomly from a random news site. I asked ChatGPT to give me a list of feeds in a JSON format, and voila. I stored this as an enum.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"BBC News": "http://feeds.bbci.co.uk/news/rss.xml",
"CNN": "http://rss.cnn.com/rss/edition.rss",
"Reuters": "http://feeds.reuters.com/reuters/topNews",
"The New York Times": "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml",
"The Guardian": "https://www.theguardian.com/world/rss",
"NPR": "https://feeds.npr.org/1001/rss.xml",
"Al Jazeera English": "https://www.aljazeera.com/xml/rss/all.xml",
"Associated Press (AP)": "https://apnews.com/rss",
"Washington Post": "http://feeds.washingtonpost.com/rss/world",
"Bloomberg": "https://www.bloomberg.com/feed/podcast/etf-report.xml",
"Financial Times": "https://www.ft.com/?format=rss",
"ABC News": "https://abcnews.go.com/abcnews/topstories",
"CBS News": "https://www.cbsnews.com/latest/rss/main",
"NBC News": "http://feeds.nbcnews.com/nbcnews/public/news",
"Politico": "https://www.politico.com/rss/politicopicks.xml",
"Fox News": "http://feeds.foxnews.com/foxnews/latest",
"USA Today": "http://rssfeeds.usatoday.com/usatoday-NewsTopStories",
"TIME": "https://time.com/feed/",
"The Verge": "https://www.theverge.com/rss/index.xml",
"TechCrunch": "http://feeds.feedburner.com/TechCrunch/"
}

This works well, but I’m honestly still doing a lot of work that I could pass on to OpenAI. Why not simply ask it to find the “latest outrage” to have my bot post? One thing I’ve learned is that sex sells, but hate, violence, and outrage sells a lot more. People want a story to get riled up about, but right now my bot might post that but it also might post an article about a new tupperware set it found.

I also need to get this thing deployed in AWS. Right now it’s just running locally, which is not very good for demonstrating my CI/CD skills. This probably needs to be a priority.

Setting up Hexo on AWS

I’ve got my hexo blog running on a very simple AWS setup that consists of:

  • S3 - a bucket to store my static files (that I hexo generate)
  • CloudFront - basically acts as a simple web server and lets me point to my S3 as an origin
  • DNS - I already had a DNS name registered with GoDaddy (and sitting there unused).
  • Cert - to get a valid cert, AWS needed me to set up a CNAME on GoDaddy to validate I controlled the domain.

This, of course, all needs to be automated. At work, I would use Terraform with Terraform Enterprise or Scalr, and set up a GitLab pipeline to build and deploy this. But since I’m using GitHub, and don’t have Scalr or TFE set up, I may need to experiment on a good way to do this.

You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.