Skip to content

Node.JS Twitter Bot tweeting Tori Amos lyrics daily using a serverless function

Notifications You must be signed in to change notification settings

meowwwls/words-of-tori-amos-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Words of Tori Amos – A Tori Amos Lyrics Twitter Bot

Screenshot of song lyrics being tweeted from the Words of Tori Amos Twitter account

A fun way of learning more about Node, bots that don't cause harm, serverless functions, and the Twitter API. A daily dose (or two) of lyrics from my favorite musician, Tori Amos.

Adding New Lyrics

To make the process of adding new lyrics easier on myself, I created a bare-bones Express app that I run locally when needed, using a form to write to a .json file containing all of the lyrics.

To run:

node app/app.js

Navigate to http://localhost:3000/

The input is formatted before it is saved to the file. For example, with the lyric string, extra whitespace is replaced with new lines (\n). The string is also trimmed if it is longer than the characters left after #ToriAmos and #TheSongTitle. The album and song titles are title-cased. This makes it much less fussy when I am adding new lyrics, knowing it will be properly formatted before the .json file is updated.

Before the file is updated, the lyrics are sorted by album title, just to make sure the data stays organized, and a check is done to prevent duplicate lyrics from being added.

Deploying to AWS Lambda Using Serverless and Running Routinely

Run:

sls deploy

Using a CloudWatch Event trigger in the AWS Lambda Function config, the bot should Tweet a random lyric every 15 hours (or however long I choose).

About

Node.JS Twitter Bot tweeting Tori Amos lyrics daily using a serverless function

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published