My First TwitterBot

Twitter

I have just “finished?” my first twitterbot!

If you send it a direct message with part of the name of someone who works at Eclectic it will send you their contact details as a return direct message.

The API is very straight forward, only my lack of bash skills slowed me down.

The basic structure is this:

  • Get all the direct messages into a text file
  • Store the message IDs in an array
  • Store the sender IDs in an array
  • Store the message text in an array
  • Loop through an array
  • Reply with the requested details
  • Delete the direct message
  • End Loop

I have set this up in a cron to run every minute.

I am manually following people to ensure that this does not go to the “outside” world.

Please feel free to suggest improvements to the code, it’s been a LONG time since I have had to create any “proper” code!

About 

    Find more about me on:
  • twitter
  • googleplus
  • facebook
  • flickr
  • linkedin
  • skype
  • youtube

7 thoughts on “My First TwitterBot”

  1. It’s been many a year since I would classift myself as a programmer! I just had a problem to solve and experimented until I had something that worked!

Leave a Reply

Your email address will not be published. Required fields are marked *