Configuration

Create .env file in root directory to define environment variables:

.env
MONGODB_HOST=XXXXXXXX
MONGODB_USER=XXXXXXXX
MONGODB_PASSWORD=XXXXXXXX

TWITTER_CLIENT_ID=XXXXXXXX
TWITTER_CLIENT_SECRET=XXXXXXXX

OPENAI_ORG=XXXXXXXX
OPENAI_KEY=XXXXXXXX

CHANCE=0.5

MongoDB

tweetst0rm uses MongoDB for storing OAuth tokens for accessing Twitter API. As free solution you can use MongoDB Atlas. In order to configure MongoDB connection you need to define following environment variables:

  • MONGODB_HOST - MongoDB host
  • MONGODB_USER - MongoDB user
  • MONGODB_PASSWORD - MongoDB password

Twitter

tweetst0rm uses Twitter API for posting tweets. In order to configure Twitter API you need to create Twitter app and define following environment variables:

  • TWITTER_CLIENT_ID - Twitter app client ID
  • TWITTER_CLIENT_SECRET - Twitter app client secret

OpenAI

tweetst0rm uses GPT-3 model via OpenAI API for generating tweets. In order to configure OpenAI API you need to create OpenAI API key and define following environment variables:

  • OPENAI_ORG - OpenAI organization ID
  • OPENAI_KEY - OpenAI API key

Customization

Script publish-post-random can succeed with probability defined by CHANCE environment variable. By default it is set to 0.5 which means that script will succeed with 50% probability.

Tweets content

In order to customize tweets content you need to edit prompts.ts file in root directory. It contains following arrays:

  • sentenceTypes - array of sentence types
  • topics - array of topics
  • wildcards - list additional actions here
prompts.ts
export const sentenceTypes: string[] = [
  'something',
  'funny fact',
  'concern'

]

export const topics: string[] = [
  'Vuejs',
  'React is bad',
  'Vue is better than React'
]

export const wildcards: string[] = [
  'use a lot of emojis',
  'ask people to follow your account'
]