GithubHelp home page GithubHelp logo

mdomsch / twilio-pagerduty Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 3 KB

Twilio Voice to Pagerduty alert using Python Flask, Zappa, AWS Lambda & AWS API Gateway

License: MIT License

Python 100.00%

twilio-pagerduty's Introduction

This is a simple application that uses Twilio to receive a phone call, prompts the user to select the service for which this error report is about, record a message from the user, and then raise an alert in PagerDuty with this information. This is a python 3.6 application, using Flask as the web framework. This application uses Zappa to deploy into AWS Lambda & API Gateway.

Inspired by https://www.pagerduty.com/blog/triggering-an-alert-from-a-phone-call-code-sample/

This assumes you have a ~/.aws/credentials file with a [dev] section.

After initial git clone, you must initialize a Python 3.6 virtual environment, then use Zappa to do the deployment.

$ git checkout <path>
$ virtualenv-3.6 twilio-pagerduty
$ cd twilio-pagerduty
$ . bin/activate
$ pip install -r requirements.txt
[edit zappa_settings.json]
$ zappa deploy dev

Copy the resulting deployment URL into Twilio phone number web hook configuration.

Twilio calls our application at each step of the process. Our application calls out to the PagerDuty REST API to create a new incident.

There are low-value secrets as plaintext in the zappa_settings.json file.

  1. FLASK_SECRET_KEY is a "random" string used to protect the HTTP cookie stored between REST calls. This needs to be the same between all AWS Lambda function instances in a single deployment, but can be changed, and the app redeployed, at any time. Twilio stores the cookies, and automatically expires the cookies after 4 hours.

  2. APP#_PAGERDUTY_SERVICE_KEY application integration keys. These are created in the PagerDuty configuration for each application. These can be deleted in PagerDuty and re-created at any time.

twilio-pagerduty's People

Contributors

mdomsch avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.