Twitter Bot + dashboard to visualize interest and activities of twitter accounts.
This project was created during the Twitter Hackathon chirp DEV {challenge} 2022
What is the benefit of all the unlimited communication and free speech if everyone is just talking crap and believe in it? We need mechanisms to drive Twitter and other social networks back to where they started. To bring people together instead of dividing them!
Of course, one of the reasons was just to play around with the Twitter API V2 and participate in the hackathon.
But the real motivation was to develop a possible solution to the biggest challenge of all social networks. Uncontrolled spreading of MANIPULATION and hate speech!
Social networks like Twitter have brought the world together and given all of us unprecedented freedom of speech. Everyone can express their opinion, really EVERYONE. It's a great thing!
But it is also a problem. There are people who are not interested in freedom of speech, but in deliberate manipulation. Or they simply want to spread hate and agitation. There are also people who unwittingly spread half-truths because they don't know any better. Either way, today's social networks are designed for the ultimate freedom of speech and offer practically no mechanisms to prevent abuse. There is no balance between freedom and anarchy.
Undressor is an attempt to create exactly this balance in the Twitter universe.
The basic idea of Undressor is based on a self-regulating mechanism that provides more transparency. Anyone can request the bot to learn more about the interests and activities of the authors. The analysis will be graphically processed and posted as an answer in the thread for everyone visible. This has 2 effects:
-
you yourself, but also the other users learn interesting insights about the author and can much better classify the content.
-
authors who deliberately manipulate or spread hate speech would have less success finding supporters through this transparency. E.g. because an account is recognized as a bot due to non-stop activity. Or because the hashtag/keyword analysis proves a clearly radical attitude.
Undressor does not judge, it just makes the hidden information visible and understandable for everyone. Users can read this information and make their own judgment!
We asked ourselves what current challenges the Twitter developer community is dealing with. To do this, we researched various ranking lists of the best Twitter bots. Here are some of those sources:
- https://beebom.com/best-twitter-bots/
- https://increditools.com/twitter-bots/
- https://techpp.com/2021/12/10/best-twitter-bots/
- https://gist.github.com/derhuerst/1cb20598b692aa87d9bb
There you can find many bots and solutions that help to get more reach. Among the TOP 10 are also bots like: @year_progress, @emojimashupbot, or also @StupidCounter. We think that the social impact of these bots is not very big.
We haven't found a single solution that addresses truly real-world challenges. Issues like: Hate Speech, Propaganda, Manipulation, Radicalization of society or even Digital Detox are not addressed at all. These are real problems that everyone should be aware of by now.
Why are such issues not being addressed? Why does the Twitter community celebrate a bot that tweets a year's progress in ASCII characters every day? This is absolutely meaningless in our eyes.
Our call to the developer community is:
Let's look together at what really MATTERS!
What is the benefit of all the unlimited communication and free speech if everyone is just talking crap and believe in it? We need mechanisms to drive Twitter and other social networks back to where they started. To bring people together instead of dividing them!
This project consists of 2 separate solutions:
- the Twitter BOT
- the online portal
The Twitter BOT provides a seamless user experience. Users can request the bot via @undressor and gets a reply directly without leaving Twitter. This is very convenient. However, the information content that is tweeted back by the bot in the form of images is still very limited.
In order to provide the user with further detailed information, the online portal(https://undressor-ui.herokuapp.com/) was also developed. In addition to the charts, easy-to-read texts are also provided there. The textual content is intended to tell a story, which at the same time is to be supported by graphically prepared charts.
In addition, the portal offers the possibility to directly analyze different Twitter accounts without affecting an ongoing thread in Twitter.
A dashboard with many more interesting insights is also planned for the future.
You can mention the bot in any Twitter reply via @undressor. The bot then analyzes the account of the author of the original post, visualizes the corresponding data and tweets the analysis back as set of 4 images.
The post also includes a link to the online portal. There you can get more information about the account.
If you are a developer and are interested in this open source solution, then you will find here all the information you need to get the project running locally.
-
get project sources from git
git clone https://github.com/thecodemonkey/undressor.git
-
build and run ui
cd ui npm i ng serve
-
open ui in browser http://localhost:4200
-
build api
cd api npm i npm run build
-
configure environment variables
#create .env file in the root of api directory # this file contains secretes, and is included in the .gitignore touch .env
Add these variables to the .env file:
#rest api port PORT=3000 # To use the Twitter API, the first thing you need is a Twitter # developer account. Create Twitter account under # https://developer.twitter.com/ and transfer all necessary # secrets into the corresponding variables: #twitter api app key APP_KEY=xxx #twitter api app secret APP_SECRET=xxx #twitter api access token ACCESS_TOKEN=xxx #twitter api access secret ACCESS_SECRET=xxx #twitter api bearer token BEARER_TOKEN=xxx #twitter username of a bot account TWITTER_NAME=undressor #connection string of postgresdb DATABASE_URL=[DB_CONN_STR] #polling interval for the bot BOT_POLLING_INTERVAL=10 #enables/disables the bot BOT_ON=true #enables/disables the dry run of the bot #dry run do analysis, save images locally and do not make real tweets BOT_DRY_RUN=false #base url to generate url for the reply BASE_URL="http://localhost:4200/" #base url to generate images BASE_IMAGE_URL="http://localhost:4200/" #16 bit encryption vector ENCRYPTION_IV=bC434Umzlk3Tra1I #encryption key ENCRYPTION_KEY=abC5pumlZR39g91RyRm94bOaPi1zLr0I
-
run api
npm run start
-
run bot
npm run bot
To run the application with docker you first need the .env
file as described in the getting started.
The easiest way to start the whole application is by using docker-compose
.
To use it you have to define a docker-compose.yml
with a content like the following:
version: '3'
services:
undressor-frontend:
image: ghcr.io/thecodemonkey/undressor-frontend:latest
ports:
- 8080:8080
undressor-api:
image: ghcr.io/thecodemonkey/undressor-api:latest
env_file: .env
ports:
- ${PORT}:${PORT}
undressor-bot:
image: ghcr.io/thecodemonkey/undressor-bot:latest
env_file: .env
ports:
- 27016:27017
The containers can be started by running docker-compose up
.
If you want to update the images, because we updated them, you can run those commands:
docker-compose up --force-recreate --build -d
docker image prune -f
This repository consists of 2 separate code bases:
- UI/Frontend
- Backend (BOT + REST API)
undressor ║ ╠═ .github/workflows (gh action) ║ ╠═ docs (docs/imgs) ║ ╠═ ui (UI/Angular Project) ║ ╚═ api (REST API/BOT Node/Typescript project)
To load the project in an IDE, please do not use the root directory, but the respective subdirectory ui or api!
Undressor primarily uses the Twitter infrastructure, consisting of the actual Twitter app and the corresponding Twitter API.
The solution itself consists of 4 separate runtime components:
- the Web APP
- the REST API
- the BOT
- and the associated PostgreSQL database
The communication between the Undressor components and the Twitter API is handled by an npm lib "twitter-api-v2".
As a result of the analysis, the bot creates several charts in PNG format and tweets them as a reply. The creation of these images works as follows:
i ❤️ MIT