/enhanced-coc-hotline

Enhanced Code of Conduct Hotline

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Enhanced CoC Hotline

This is an enhanced version of the PyCascades Code of Conduct Hotline.

This hotline uses Nexmo Voice API + Zapier integration.

Purpose

When a caller calls the hotline, it will dial each of the PyCascades Code of Conduct committee members, and the caller will be connected to the first person who answered.

Calls to the hotline can be (optionally) automatically recorded. By default, calls are not recorded. To autorecord, set both the AUTO_RECORD and ZAPIER_CATCH_HOOK_RECORDING_URL environment variables.

For additional details of how to set up the hotline, please read my Nexmo Developer Spotlight tutorial, posted November 15, 2018.

Requirements

Python 3.6.5+ because of f-strings. In reality, Python 3.7 is used (as specified in runtime.txt).

Library Dependencies

  • aiohttp
  • nexmo
  • click

Deployment

Deploy

In Heroku, set the environment variables:

  • NEXMO_API_KEY: The Nexmo API Key

  • NEXMO_API_SECRET: The Nexmo API Key Secret

  • NEXMO_APP_ID: The Nexmo App ID

  • NEXMO_PRIVATE_KEY_VOICE_APP: The path to the Nexmo App's private key (private.key file).

    It looks like the following: ----- BEGIN PRIVATE KEY ---- blablahblah ---- END PRIVATE KEY ----

  • PHONE_NUMBERS: A list of staff name and phone number dictionaries.

    Example:

    [{"name": "Mariatta", "phone": "16040000000"}, {"name": "Miss Islington", "phone": "1778111111"}]
    
  • AUTO_RECORD: set to True if you want to autorecord incoming calls. This is optional, and will default to False if not set.

  • ZAPIER_CATCH_HOOK_RECORDING_URL: The Webhooks By Zapier url. This is only needed if AUTO_RECORD is True.

  • HOTLINE_DESC: the description of this Hotline. For example: PyCascades Code of Conduct Hotline or PyCascades Head Office.

Downloading the recording

Requires click 7.0+

Set the environment variables:

  • NEXMO_APP_ID: The Nexmo App ID
  • NEXMO_PRIVATE_KEY_VOICE_APP: The content of the private key (from private.key file). It looks like the following: `----- BEGIN PRIVATE KEY ---- blablahblah ---- END PRIVATE KEY ----`

In the enhanced-coc-hotline directory, run:

$ python3 -m download_recording url1 url2 url3 ...

License

GNU General Public License v3.0.