Coder Social home page Coder Social logo

pybites / bday-app Goto Github PK

View Code? Open in Web Editor NEW
36.0 3.0 8.0 262 KB

Never Forget A Friend’s Birthday with Python, Flask and Twilio

Home Page: https://www.twilio.com/blog/2017/09/never-forget-friends-birthday-python-flask-twilio.html

Python 67.97% CSS 5.88% HTML 26.15%

bday-app's Introduction

Birthday App (bday-app)

Never Forget A Friend's Birthday with Python, Flask and Twilio

GitHub issues GitHub forks GitHub stars Twitter

This app lets you:

  • import your Facebook birthday calendar,
  • send SMS notification messages of upcoming birthdays,
  • send text messages and simple ecards via SMS.

app-printscreen

Setup instructions

  1. Clone this repo:

     $ git clone https://github.com/pybites/bday-app
    
  2. Make a virtual env and install dependencies:

     $ cd bday-app
     $ python3 -m venv venv
     $ source venv/bin/activate
     $ pip install -r requirements.txt
    
  3. Create a Twilio account, get a phone number and API key (sid) and token.

  4. Copy the settings template in place:

     $ cp env-example.conf env.conf
    
  5. Update it with the correct settings:

    • flask - secret = set this to a random, hard to guess string (see Flask docs)
    • twilio_api - sid + token = obtained in step 3
    • phones - twilio = obtained in step 3
    • phones - admin = your (verified) mobile phone number, where you want to receive notification messages
    • login - user + password = define your login credentials for the Flask app
    • server - url = unchanged if running locally, update to base URL if deployed elsewhere (so far I only tested it on my localhost)

NOTE: make sure you use E.164 number formatting for phone numbers (e.g. +34666555444, +442071838750). See Twilio's support article: Formatting International Phone Numbers.

  1. Import your FB calendar into local SQLite database with birthdays

    • Export your birthday calendar from Facebook and save it as cal.ics in the app's toplevel directory.

      export FB cal

    • Run model.py to import the birthdays into the DB. Use it with -t if you want to strip out real names.

        $ python model.py
      

How to run it

This app has two parts:

  1. The notifier which checks once a day for birthdays. If there are one or more birthdays that day it sends out an SMS to your configured admin phone. You need to run this as a background job so use nohup:

     $ nohup ./notify.py &
    
  2. The front-end is a Flask app which you can invoke with:

     $ python app.py
    

Note that for both scripts you need to have your virtualenv enabled.

bday-app's People

Contributors

bbelderbos avatar clamytoe avatar dependabot[bot] avatar pybites avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.