← BackBuilding your own Twitter Thread Generatoru11g.com
3/5/2023

Building your own Twitter Thread Generator

To best explain the process to you, I will briefly show you the payload that you can use to start the process:

{ 
  "input": { 
    "thread": [ 
      "That's a twitter thread made with flethy.", 
      "Setup in less than 5 minutes.", 
      "Create a thread with a single command.", 
      "Don't trust any 3rd party service." 
    ] 
  } 
}

The process essentially does the following:

  1. Create a tweet with the first element from the array. Here: That's a twitter thread made with flethy.
  2. Write a new variable called counter and initialise it with the value 1. This gives us a condition for the loop we are going to run through.
  3. If the array contains more than one element go to the next node reply.
  4. Create a tweet as a reply to the last tweet and increment the counter.
  5. If the counter is less than the number of elements, execute the node reply again, otherwise we are done.
That's a twitter thread made with flethy.
counter
1
reply
reply

Actually quite simple! You can now easily start this flow with the typescript package @flethy/flow:

import { FlowEngine } from "@flethy/flow"; 
const flow = {}; // flow from above 
const input = { 
  input: {
    thread: [] 
  }
}; // input from above 

async function main() { 
  const engine = new FlowEngine({ 
    env: { 
      env: {}, 
      secrets: { 
        CONSUMER_KEY: process.env.CONSUMER_KEY, 
        CONSUMER_SECRET: process.env.CONSUMER_SECRET, 
        ACCESS_TOKEN: process.env.ACCESS_TOKEN, 
        ACCESS_TOKEN_SECRET: process.env.ACCESS_TOKEN_SECRET, 
      }, 
    }, 
    flow, 
    input, 
  }); 
  await engine.start(); 
} 
main()

That’s all you need to create a Twitter thread locally in a Typescript project. Of course, it is more comfortable in the cloud. You don’t have to set up anything, set any environment variables or write any code. The following video shows you how it works: Play And at the end you’ll receive your tweet :) I’ve implemented flethy so you don’t have to worry about doing repetitive tasks anymore. If you like the project, give it a star on Github. Feel free to ask questions and give feedback! I’m looking forward to it! And if you want to try out flethy Cloud: https://flethy.com/signup - it’s free!

Home
Projects
Newsletter
Blog
Me
Philosophy
Gen Art
Work
Setup
CV
Machine
Dynamic Pong: Territory Conquest Meets Classic Physics
Introducing Camunda Directory
Getting Started with AIME Directory Collections in 5 Minutes
How to use a proxy in a nodejs environment
Introducing weeklyfoo
Create your own epaper calendar with Canvas
Codespaces can become a game changer
Cloudflare pages direct upload with stable preview urls
Building your own Twitter Thread Generator
300 APIs integrated in minutes, not days
Be an orchestration hero
Cut a few braids - new NPM package
ETHme - your chic web3 identity
Automatically update data and commit
Aren't the standard actions going too far for you? Write your own one!
Screenshots - a perfect task to automate!
Send messages to Slack from Camunda Cloud
5 Steps how to track your Team's Mood
Automate your manual tasks with Camunda and Trello!
Go beyond the basics
Is there an alternative to spaghetti?
Play with node-canvas and build something useful
How do I implement a command line tool?
Aime Directory
Boring Dev Tools
Camunda Directory
Data Democracy
Dev Pulse
Dynamic Pong
Lifosy
Art u11g
dapphuntr
DiyPunks
flethy
Maker Oracles
SwagTime
EthME
fcheat
Find the next victim
Generative Arts
MakerDAO Delegates
SkunkWorks NFT
Trees of Life NFT
zukuNFT
RestZeebe
Websiteshot
Zeebetron: How to Manage Multiple Zeebe Profiles with Electron
dot calendar
Sharu
Switch Interface (theme)
LINKEDIN
X
GITHUB