Code as Marketing: an OpenAI experiment

Code as Marketing: an OpenAI experiment

Here's how some code led to 60+ GitHub stars, 30+ retweets and 150 likes in 24 hours.

I love Awesome lists like Awesome Python, Awesome iOS and Awesome Swift.

And I'm not alone. Awesome iOS has more than 40k GitHub stars.

With my friend Nick, I help run iOS Dev Tools which is a database of thousands of tools for iOS developers.

So I had the idea to use our data to create an awesome-iOS-dev-tools repo.

But there were two main challenges:

  1. Formatting thousands of tools into a list is a huge job and I am lazy.
  2. The data we have is not in the right format.

But luckily we have two good friends: Python and OpenAI.

1. Programmatically writing a readme

Readmes are markdown files. Luckily in Python, there's a nice markdown library called mdutils.

I can open a markdown file like this for example.

mdFile = open_markdown()

Then once I have all my tools sorted by categories, I can loop through tool categories to create headers and then loop through each category and create the tools.

def loop_through_categories(mdFile,data):
    for category in data:
        formatted_category = json.loads(category['json_agg'])
        category_title = formatted_category[0]['category_title']

In the end, my readme looked like this:

  1. Intro
  2. Table of contents
  3. Categories and individual tools within each of these categories.

2. Reformatting using OpenAI

The second problem was more challenging. Our descriptions are long-form like the below for RevenueCat.

But Awesome lists have more concise descriptions like the ones below:

Awesome Swift

This is where OpenAI's GPT-3 summarization model comes in handy.

We can give OpenAI our long description. Then tell it to summarise it into 140 characters or less.

def generate_prompt(description):
    return """{}

    Summarise the above in 140 characters or less

Then it's as simple as sending it off to OpenAI.

Aside: I used the second most powerful model. But if you want to use the more powerful (more expensive) model, just change "text-curie-001" to "text-davinci-002"

def send_prompt_to_open_ai(prompt):
    response = openai.Completion.create(
    summary = response['choices'][0]['text']
    return summary

Here's the summary we get back for RevenueCat:

RevenueCat makes it easy to implement and manage in-app subscriptions, analyze customer data, and grow recurring revenue on iOS, Android, and the web.

Pretty good!

We have a free trial with OpenAI so we could generate all 1000+ summaries for free.

This makes our life way easier as it's much faster to scan these summaries and check they make sense than to write them all from scratch.

Sharing our Awesome iOS Dev Tools list

Now we can generate our awesome-ios-dev-tools markdown file and share it on GitHub and Twitter. Here's the full list.

The results in the first 24 hours:

  • 150+ Twitter likes
  • 30+ retweets
  • 60+ GitHub stars
  • A lot of really nice comments and love from the iOS community
  • One new sponsorship enquiry


  • There is potential to use GPT-3 in the development process to modify data formats.
  • It's fun to think about how you can use your assets in new ways to create different experiences
  • This is the most fun I've ever had doing marketing

Here is the code I used if you're curious.

Subscribe to Scaling DevTools

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.