Example application integrating CallTrackingMetrics API using Python and Flask
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
static
templates
README.md
app.py

README.md

CTM Python

Installation

git clone https://github.com/calltracking/ctm-python-example.git
cd ctm-python-example
pip install flask
pip install flask-socketio

A CallTrackingMetrics advanced account - signup here: https://www.calltrackingmetrics.com/plans

Running the example application

You should configure your environment using agency or enterprise API keys

export CTM_ENV=development
export CTM_TOKEN=key
export CTM_SECRET=sec
export CTM_HOST=api.calltrackingmetrics.com

python app.py

You should now see something like this in the console

* Restarting with stat
* Debugger is active!
* Debugger pin code: 158-662-312
(95762) wsgi starting up on http://127.0.0.1:5000

If you open a browser and visit http://localhost:5000 you should see a menu with Accounts, Numbers, Calls, and Settings. The CTM_TOKEN and CTM_SECRET used above will determine which account(s) will be visible through the interface.

Documentation

The reference documentation is found here: http://developers.calltrackingmetrics.com. Beta documentation using Postman can be found here: https://documenter.getpostman.com/view/213868/ctm-api/2FxGgg

Accounts

Advanced or Enterprise CTM accounts can create any number of sub-accounts. To create a new account, you only need to provide an account name, timezone, and billing type. Currently, the only billing type allowed is existing which will place the account on agency billing.

Numbers

If the account has tracking numbers, they will be listed along with their configuration. Numbers can be purchased for an account by clicking the Buy Numbers link at the right of the menu or at the right of the Numbers menu.

Before purchasing a number, you need to search for a number to purchase. In the United States (US) and Canada (CA), you can search by area code, address, pattern, or number to look for appropriate local numbers. For international numbers, searching is more restrictive because there is not good geocode data for international numbers.

After finding a number, you can purchase the number and add a name (also called a label or tracking_label.)

Voice Menus

In voice messages, the parameter play_message can be either a say message or a play URL.

The format of a say message is as follows:

say:{{voice}}:{{language}}:{{message}}
parameter options Language, Locale
{{voice}} `man` or `woman` or `alice`
{{language}} if `{{voice}}` is `man` or `woman` en
en-gb
es
fr
de
English (US)
English (UK)
Spanish
French
German
{{language}} if `voice` is `alice` da-DK
de-DE
en-AU
en-CA
en-GB
en-IN
en-US
ca-ES
es-ES
es-MX
fi-FI
fr-CA
fr-FR
it-IT
ja-JP
ko-KR
nb-NO
nl-NL
pl-PL
pt-BR
pt-PT
ru-RU
sv-SE
zh-CN
zh-HK
zh-TW
Danish, Denmark
German, Germany
English, Australia
English, Canada
English, UK
English, India
English, United States
Catalan, Spain
Spanish, Spain
Spanish, Mexico
Finnish, Finland
French, Canada
French, France
Italian, Italy
Japanese, Japan
Korean, Korea
Norwegian, Norway
Dutch, Netherlands
Polish-Poland
Portuguese, Brazil
Portuguese, Portugal
Russian, Russia
Swedish, Sweden
Chinese (Mandarin)
Chinese (Cantonese)
Chinese (Taiwanese Mandarin)

The format of a play message is as follows:

play:{{url}}

where {{url}} is the URL of an audio file in one of the following formats MP3, WAV, AIFF, GSM, μ-law and is smaller than 7MB, i.e.

play:http://www.springfieldfiles.com/sounds/homer/hacker.mp3