codeforamerica / cityvoice

A place-based call-in system for gathering and sharing community feedback
MIT License
47 stars 35 forks source link

Add call count for the voice interface #120

Open rduecyg opened 10 years ago

rduecyg commented 10 years ago

"_ of your neighbors have listened to calls about this property. __ have left messages about this property."

daguar commented 10 years ago

To clarify, would we want the count to be of:

(a) listens over the phone (b) listens over the web (c) both

rduecyg commented 10 years ago

Preferably C both. Does Twilio allow you to track the number of times a message URL has been hit or do you have to do this from scratch?

I think next steps are to record a message from Tamara that says something like "The listen count for the following message is: _____".

daguar commented 10 years ago

I'm ~90% sure that Twilio doesn't save any data on number of times a recording is accessed ( see: https://www.twilio.com/docs/api/rest/recording )

The approach I see as being feasible is saving a count in the database per message that is incremented by 1 when:

(a) Someone listens over the phone (this is actually pretty easy, though it gets to the UX of which messages we play first; if it's the first one chronologically, then it may be listened to over and over again by the same caller who wants to keep tabs on a property)

(b) Someone clicks on a voice message's play button on the web. It's a little bit of work, because we'd have to add a Javascript event listener to the audio player that basically sends a separate outbound call to the app to increment the play count by 1. (We can't rely on the message loading counting as a listen, since I think a lot of browsers are pre-load the files.)