4
5 Comments

Launched a custom Twitter Bot in 48hours

What I built:

I just launched GraphTD https://twitter.com/graphTD on Twitter. It's a fintech bot which when called, replies to the user with a custom graph with the historical stock prices of the stocks mentioned.

The user creates a tweet like which mentions the bot and what stocks you want to see, as well as a time period that you want to compare.

The bot then queries an API to get the data, creates a graph from the data and then responds back with the image on Twitter.


How I built this:


I have seen some Twitter work inside of nocode. However, I've been trying to upskill my Python for the last 4 months.

First, I coded this in Python just running on my computer. It turned out to be around 250 lines of code.

The code starts by monitoring Twitter for mentions of my account. A limitation of nocode tools like Zapier and Integromat is that they can only monitor Twitter every 5 minutes. With a coded solution I can monitor Twitter every 12 seconds which is what the API limit for Twitter is, however, I've currently set this to 1min.

Once a request has been found on Twitter, I then have to cross check that the bot hasn't already responded to this Tweet, it checks a google sheet which is automatically updated with past results.

If it hasn't been responded to, the code parses through the Tweet and then interacts with a stock market API to get the data that the user requested.

It then creates a graph and connects with another API which converts the graph to an image and hosts it in the cloud (and then downloads it again).

From there, it then posts the response back to Twitter.

The script worked manually on my computer but I ended up launching this on Google Cloud Platform so that I could run the script automatically every 1 minute.

While the bot itself was fine, I decided to upgrade the project to a bit more of completion.

  1. I purchased a domain name for $10 on Namecheap: https://graphtd.com/
  2. Used https://brandmark.io/ for $65 for a logo/font kit
  3. Built a website on https://carrd.co/ which will be $20/year . First time using card and was pleasantly surprised.

Why I built this:


I've been working on a larger project for the last month or so, and haven't been able to ship the product yet. So, over the weekend I decided to hold a mini-sprint for another idea that I've had to get something out there.

I've also been much more active on Twitter recently and found it's a great community. I post mostly about the stock market/investing as that's what I'm building my larger product in.


What's next?


With this actual bot:

  • The first major issue is that its a new Twitter account so the visibility of the replies are a bit finicky i.e. only the user can see the response. I'm speaking to the Twitter Dev team to see if I can get this restriction lifted. My interim solution is that I am also automatically DM'ing the user the graph. So it responds to the tweet and the DM.
  • I'm also thinking of converting this to a text base bot so that you anyone with a US phone number can text a number and get the same results.
  • Graph tidy up. I think it can look better.
  • Code efficiency. I think I can clean up the code to make it run smoother and more optimal, including better database design.

With other bots:

  • I think there are many other applications that I'd like to build which could support other brands and companies in their sales, marketing and customer support issues.

Overall though, this is not my main focus but was a lot of fun and great to create something out of nothing and ship it...and get some people using the bot straight away!

Happy to answer any questions, and any feedback would be great, as I skipped over a lot of the detail here :)

Best,

  1. 2

    This is great. Are you open to making other bots? I have a lot of ideas

    1. 2

      Yes! Already onto my second. But happy to chat. Sending you an email.

  2. 2

    Congrats on launching the bot! I just tried it and it worked great!

    One thing I noticed is the visibility of the account (which you also mentioned). The fact that the reply was not even appearing in my own notifications seems very strange.

    I'm afraid this strategy will discourage newcomers to the platform if Twitter hides all notifications coming from them 🤔 When I created my own Twitter bot last year I haven't had the visibility issues.

    BTW, did you use any libraries for the bot? I can recommend Tweepy which has been powering my bot for over a year without any problem.

    1. 1

      Thanks I saw that. Yes I use Tweepy which is strange.

      I think it's something to do with Google Cloud Platform and random IP's or something. Where did you host your bot if you don't mind me asking?

      1. 1

        Mine is also on GCP (Cloud Functions)!

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 47 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 27 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments How I Launched FrontendEase 13 comments