Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 2.21 KB

README.md

File metadata and controls

36 lines (23 loc) · 2.21 KB

Birthday Tweet Generator

Link to the app hosted on heroku

Important: You need to generate Google API key and Google CX before using this application (by creating a new custom search engine), and paste them in logic.js (indicated).

My organization's social media manager has this 'content calendar' thing - where sometimes the company's SM accounts drop tweets/posts based on particular days (mostly birthdays of celebrities and historical figures).

It definitely takes a little time each day - so I quickly wrote a simple app using node.js and Express that generates a social media post on the birthday of a celeb, with a link (article or otherwise) based on the person's profession and your industry (default: blockchain).

Working

The app scrapes Wikipedia's date pages based on the day selected, picks up a birthday randomly, patches the content up a bit, looks up the keyword (celebrity's profession+the industry you chose) on Google, selects a random article, and returns a tweet.

For instance, if you select 24th May and 'blockchain', one of the possible tweets could be:

It is the Argentinian footballer Lionel Messi's birthday today! We have a cool link for you #OnThisDay: "Hal Robson-Kanu interview: West Brom striker by day, blockchain ...https://www.independent.co.uk/sport/football/football-league/hal-robsonkanu-west-bromwich-albion-championship-interview-blockchain-bitcoin-cambridge-analytica-a8476756.html #footballer #blockchain #blockchaintechnology

This program is made using wtf-wikipedia and Google Custom Search API. I picked up its UI from Colorlib.

Usage

  • Generate Google API key and Google CX
  • Clone the repo
  • Edit logic.js by adding the API key and CX
  • Use the following commands to run this locally:
> npm install
> node app.js

Your app will be live at http://localhost:4000

Shoutout to Nidish and Shanu for patching the callback issue.