Blog-to-Twitter: My AI-powered content engine

INSIDE: X (Twitter) APIs, Make.com x Custom GPTs, AI

I hate to admit it, but my brain is rotting. I'm so lazy these days that I always find the easiest, most convenient ways to do thingsall so I can watch lots of anime (1/2 jk).

And one of my biggest struggles is... writing.

Sure, I can automate a lot of it using AI. But, I'm here to learn. I don't mind spending days on it, because I know, if I put in the reps, I'll be a lot more efficient.

But here's the thing. Apart from writing the blog, I'm also promoting on Twitter. The content is kinda' the same, but different too. It needs to be shorter, have better hooks, and still leave the readers curious for more.

So it got me thinking. Why not automate my Twitter content engine?

Well, that's exactly what I did.

The Pitch

In my previous blog posts, I explored custom GPTs and no-code tools. What's amazing is that you can combine these two powerful technologies!

Here's my pitch: What if there was a custom GPT that reads your blog posts and then directly posts Twitter threads about them?

Sounds cool, right? But let's tweak that a bit. If there's one thing I've learned from Dovetail, it's that AI shouldn't completely replace humans. AI should assist them instead.

The key to making this GPT successful is allowing users to take over. Let the AI generate an initial draft of tweets, and then let users revise. Of course, the GPT shouldn't deviate much from the user's original writing style and tone.

Sounds simple, right? Yes, except the part about posting directly on Twitter. For that, we're asking the GPT to call the Twitter API! But don't worry, this is supported by OpenAI through Actions.

The Build

The flow is simple. The user converses with the GPT to finalize their Twitter thread. The GPT then sends a webhook to our workflow in Make.com to handle the posting.

But wait, why do we still need Make.com if we can just directly call the Twitter API? Sadly, Twitter doesn't support posting a series of tweets using one API call. It has to be separated into multiple ones.

Another caveat of this build is that it's designed exclusively for my use. Third-party API calls in Make.com require prior authentication, which means you can't dynamically pass tokens and OAuth clients while a workflow is running.

That's why this GPT is tailored just for me. My Make.com workflow is pre-configured to connect to my Twitter account, ensuring a seamless integration. Plus, my GPT is set up exclusively for my use, so I don't have to worry about anyone else messing with my Twitter!

The GPT

The core of this GPT's behavior relies on the prompt and the action.

I've organized my prompt to be readable for the LLM. It includes the role, task, context, and summary. The role tells the GPT what hat to wear, while the task tells it what to do. The context, on the other hand, provides additional info, like our tweet writing guidelines. The summary simply ensures we don't overwhelm the LLM with too much information.

Here's what the prompt looks like:

## Role
This GPT assists users in converting their blog posts into a series of Twitter posts for promotional purposes.

## Task
The GPT should follow the instructions below:
1. The user will send the GPT a link to their blog post.
2. The GPT should parse and read the content of the blog post.
3. The GPT will generate a series of tweets. It will be maximum 280 characters per tweet, and at most 10 total tweets. The content should highlight key points of the blog in a way that is engaging and true to the author's original style and tone. The final tweet should always have the link to the full blog post.
4. The output should always be the tweet delimited by a divider like "------" then the tweet again.
5. The GPT should ask the user if they want to tweak any parts of the series of tweets.
6. Once the user is satisfied and asked you to post, the GPT should trigger the CreateTwitterThread action.

## Context
The GPT should follow the guidelines below when writing each tweet:
1. Follow the author's tone of voice and avoid straying from it.
2. Do not include hashtags.
3. Make tweets readable by adding lines between paragraphs.
4. Default to a concise style rather than detailed.
5. Avoid outright promotion of the blog post; instead, craft the series of tweets to naturally encourage curiosity and clicks on the link to the full blog post.

## Summary
This GPT helps the user convert their blog post into a series of Twitter posts, and also directly posts it to Twitter.

Now, notice task #6 in the task section of the prompt:

Once the user is satisfied and asked you to post, the GPT should trigger the CreateTwitterThread action.”

OpenAI's Action is a neat concept. It allows us to integrate our GPTs with third-party APIs. While BabyAGI and AutoGPT had this feature for some time, doing all this without code is impressive!

But wait, don’t we need to code or configure when an API is called? Nope. We simply tell the GPT to trigger the action through the prompt. Best part is, you don’t even have to tell the GPT what data it needs to supply. It already knows. How cool is that?

The only thing to worry about when creating an action is the OpenAPI schema. It's a standardized structure of the API you plan to trigger. It lets the GPT know the specific data it needs to pass to the API and where the API lives.

openapi: 3.1.0
info:
  title: Create Twitter Thread API
  description: Triggers Make.com webhook for creating Twitter threads.
  version: v1.0.0
servers:
  - url: https://hook.us1.make.com/[redacted]
paths:
  /:
    post:
      description: Create a Twitter thread
      operationId: CreateTwitterThread
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                tweets:
                  type: array
                  items:
                    type: string
                    description: Tweet content
              required:
                - tweets
      responses:
        "200":
          description: Successful response (OK 200)
        "201":
          description: Successful response (OK 201)
components:
  schemas: {}

Unfortunately, it seems like you can only create one action for each GPT. You can bypass this by adding multiple API endpoints in your OpenAPI spec. Hope they fix this in the future!

Overall, the possibilities are endless when you make the prompt and actions work together.

The Make.com Workflow

All the workflow does is send a series of tweets. The main challenge is ensuring each tweet replies to the previous one to create a Twitter thread.

The first part of the workflow posts the initial tweet and saves its ID. The workflow then loops through the remaining tweets, posting each as a reply to the predecessor tweet. We achieve this by updating the parent tweet ID variable after each tweet is posted.

Now, notice the sleep actions. The delay ensures each tweet is posted before moving on to the next, which is crucial since each tweet depends on the previous one.

You might have also noticed two different Twitter action types in the workflow:

  • Create a Post (initial tweet)

  • Make an API Call (tweet reply)

Unfortunately, none of Make.com's Twitter actions support posting a tweet as a reply. That's why we use a legacy Twitter action (i.e. Make an API Call) to send a tweet as a reply. It's a bit hacky, but it works for our use case.

Overall, this workflow handles posting tweets and, most importantly, ensures they form a Twitter thread.

The Result

For this demo, let's use my previous blog post and a test Twitter account. And, of course, instead of telling you what happened, I'll just show you!

As you can see, we witnessed the combined magic of GPT and Make.com. Initially, I wasn't satisfied with the GPT's output, so I asked it to tweak it. Normally, I'd make more adjustments, but the first suggestion was a good start. Here's the Twitter thread if you want to take a look:

Also, notice that I just told the GPT to post the tweet and nothing else. The GPT automatically triggered the action without me providing any additional context or data. Frickin' sick!

The Feeling

I tested this GPT multiple times, but it rarely gives me the perfect first draft. I wish I only had to make a few tweaks, but that’s something I can improve through better prompts.

Another thing I wish the GPT had is an OAuth integration with Make.com. It’s the only thing stopping me from sharing this with other users! Imagine this: as a new user, the GPT sends you a link to authorize your Twitter account. You authorize it, and suddenly, you can post tweets using this GPT!

Overall, it's not bad! I can still see myself using this tool heavily. It did solve my problem really well. *pats self on back*

If you’re enjoying this, can you do me a favor and forward it to a friend? Thanks.