Code Monkey home page Code Monkey logo

automated-message's Introduction

automated-message

Check Twitter update for romantic messages (@romanticmsgs) and SMS them to your loved ones

  • Tweepy to pull message from Twitter (python-twitter does not work when hosted on Google App Engine)
  • Twilio to send SMS message
  • Script is hosted on Google App Engine with a cron job

How to Deploy

Sign up with Twitter's API

  1. Follow this quick guide to get Twitter's API key

Sign up with Twilio's API

  1. Follow this quick guide on how to sign up and use Twilio (Ctrl-F "Signing up for a Twilio Account")
  2. The trial Twilio account will preface your SMS with "Sent from trial account". You can pay (a little) to remove this restriction

Create a passwords.py file in the project root folder

  1. In this folder, write down the credentials from your Twitter and Twilio account. (My own passwords.py is included in .gitignore so that it doesn't show up on github.)
  2. Like so
# Twitter API credentials
consumer_key = 'your_own_credentials'
consumer_secret = 'your_own_credentials'
access_token = 'your_own_credentials'
access_token_secret = 'your_own_credentials'

# Twilio API credentials
ACCOUNT_SID = 'your_own_credentials'
AUTH_TOKEN = 'your_own_credentials'

# Twilio phone number
myTwilioNumber = '+18885553333'
myCellPhone = '+12229993333'

Deploy on Google App Engine

  1. Follow the Google App Engine (GAE)'s Python tutorial to download GAE Python SDK
  2. Follow GAE's tutorial on how to upload your application. TL;DR: appcfg.py -A PROJECT_NAME update automated-message
  3. Go to http://console.developers.google.com to monitor your application

Configuration

  1. Change the Twitter source: In messenger.py, change screen_name = 'romanticmsgs'screen_name = 'romanticmsgs' to use any other Twitter user as source
  2. Change the frequency of checking Twitter for updates in cron.yaml. See GAE's docs on cron's syntax
  3. Change the hours NOT to send message: In messenger.py > # Does not send during sleep hours

Troubleshoot

Failed to send request: The Socket API will be enabled for this application once billing has been enabled in the admin console.

We need to enable billing for our GAE's app for Tweepy and Twilio API to work, as follows. In http://console.developers.google.com,

  • go to Settings (the cog symbol, top right) > Billing Accounts to add payment methods to your GAE account
  • go to Settings > Project Billing Settings to enable billing for this particular project

automated-message's People

Watchers

 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.