adzguy / sms_notify_app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SMS Notifications Web Application with Twilio and Python | Flask

Local Development

  1. You will need to configure Twilio account to send SMS and receive HTTP POST to the application.

    You will need Account SID, AUTH Token, and Messaging SID to send SMS.

    Please see twilio documentation here.

  2. Clone this repository and cd into it.

  3. Create a new virtual environment.

    • If using venv:

      python3 -m venv <env name>
      source <env name>/bin/activate
      
  4. Install the requirements using pip.

    pip install -r requirements.txt
    
  5. Project is using python-dotenv package to register environment variables automatically imported when you run flask command so you can avoid to set FLASK_APP environment variable to the entry point every time.

  6. Run the migrations.

    flask db upgrade
    
  7. Start the development server.

    flask run
    
  8. To test your webhook use ngrok

    To start using ngrok in our project you'll have execute to the following line in the command prompt.

    ngrok http 5000 -host-header="localhost:5000"
    

    Keep in mind that our endpoint is:

    http://<your-ngrok-subdomain>.ngrok.io/message
    

Run the tests

You can run the tests locally through coverage:

  1. Run the tests.

    $ coverage run test.py
    

You can then view the results with coverage report or build an HTML report with coverage html.

About


Languages

Language:Python 70.0%Language:HTML 27.4%Language:CSS 2.3%Language:Shell 0.3%