🎨 How I created a Twitter bot which paints like Van Gogh

List of tools I used:

  • n8n: free and source-available workflow automation tool (I ran my own n8n service on local Docker)
  • DALL·E 2: AI system that can create realistic images and art from a description in natural language
  • Telegram bot: small applications that run entirely within the Telegram app
  • Wikipedia: you know what this is...

First, I needed to generate a random sentence that dalle API will consume to produce images for me.

As I want, the bot will draw like Vincent Van Gogh so I started with this sentence structure: "Impressionist painting of ... by Vincent van Gogh"

After a few tries it works well:

So I installed and run locally a n8n service with Docker for Mac, please refer to this documentation if you want to do the same.

Let's create a new automation workflow on n8n (you can find the JSON here: https://github.com/gantoin/my-n8n/blob/master/van_gogh.json)

  1. Schedule the trigger of automation → 1 per day, 11:00
  2. Get the random words to paint → Wikipedia random page https://en.wikipedia.org/wiki/Special:Random
  3. Scrap the title of the random page picked
  4. Call the DALL-E API to generate the images: I created a project for that, I dockerized it so I can run it locally with my n8n service → https://github.com/gantoin/dalle2-in-python-as-webservice
  5. Send the pictures to this Telegram bot (I contributed to it), when you will link your Twitter account to this bot, it will tweet everything you text him → https://github.com/QuentinWidlocher/telegram-to-twitter-bot

It's done! @bot_van_gogh will post automatically.