DEV Community

Cover image for Identify Sales Insights from Meeting Audio
Tonya Sims for Deepgram

Posted on • Originally published at dpgr.am

Identify Sales Insights from Meeting Audio

You just started your first day as a Python developer at Dunder Mifflin Paper Company, Inc. The President of Sales has an urgent request for you, to transcribe a sales meeting from speech to text with the regional manager, Michael Scott.

This is not just any sales meeting. Landing this client could determine the health and future of the company. You see, Michael Scott was kind of a goofball and had a habit of joking around too much during important sales calls so the VP of Sales, Jan, was sent to watch over him.

The President of Sales could not figure out why this client didn’t sign the contract.

Was there even a deal made?

Did Michael not close the sale?

Or did Michael scare the client away by telling his lame jokes?

He needed sales insights ASAP and the only way he could get them without being there was by using AI speech recognition and Python.

You’ve probably guessed by now, but if you haven’t, this is a classic scene from the hit sitcom, The Office.

If you want the full code sample of how to identify sales insights from meeting audio, skip to the bottom. If you want to know what happens next with the foolery then keep reading.

In this sales call scene from The Office Michael Scott moves the meeting to a restaurant, Chili’s, without anyone’s permission. Since this episode was released in the mid-2000s, we’re going to fast-forward to 2022. Let’s say this meeting didn’t happen in a restaurant, it occurred over everyone’s favorite, a video call.

You explained to the President of Sales that the meeting could be recorded, then uploaded to be transcribed using Python and speech-to-text. You elaborate that certain features can be used to gather sales insights from the meeting audio.

You ask the President what type of insights they need. They need a quick summary of the transcript, instead of reading through the whole thing, and the ability to search through the transcript to determine if Michael Scott mentioned business, deals, or jokes.

Conversation Intelligence and Sales Insights from Meeting Audio

ou have the perfect solution for a speech recognition provider, Deepgram. You get to coding, using their Python SDK.

The first thing you do is grab an API key here.

Then create a directory with a Python file inside. You use pip to install Deepgram pip install deepgram-sdk.

It was very easy to use with this code:

from deepgram import Deepgram
import json

DEEPGRAM_API_KEY = YOUR_API_KEY_GOES_HERE
PATH_TO_FILE = 'audio/the-office-meeting.mp3'

def main():
   # Initializes the Deepgram SDK
   deepgram = Deepgram(DEEPGRAM_API_KEY)
   # Open the audio file
   with open(PATH_TO_FILE, 'rb') as audio:
       # ...or replace mimetype as appropriate
       source = {'buffer': audio, 'mimetype': 'audio/mp3'}
       options = {
           'summarize': True,
           'search': ['business', 'deal', 'joke']
       }

       response = deepgram.transcription.sync_prerecorded(source, options)
       print(json.dumps(response, indent=4))

main()
Enter fullscreen mode Exit fullscreen mode

You’re importing the libraries at the top:

from deepgram import Deepgram
import json
Enter fullscreen mode Exit fullscreen mode

Copying and pasting your Deepgram API Key into the code and adding the path to the file you want to transcribe:

DEEPGRAM_API_KEY = YOUR_API_KEY_GOES_HERE
PATH_TO_FILE = 'audio/the-office-meeting.mp3'
Enter fullscreen mode Exit fullscreen mode

Inside the main function, you’re initializing the Deepgram SDK. Then you open the audio file with open(PATH_TO_FILE, 'rb') as audio:. Since the file being transcribed is an MP3, that’s what you set as the mimetype, while passing the audio into the Python dictionary as well: source = {'buffer': audio, 'mimetype': 'audio/mp3'}.

You tap into their Summary and Search features as explained here, by creating an options object with those parameters.

options = {
           'summarize': True,
           'search': ['business', 'deal', 'joke']
       }
Enter fullscreen mode Exit fullscreen mode

Lastly, this line response = deepgram.transcription.sync_prerecorded(source, options) will take in the audio and features and do the transcription. The results will then be printed with the following print(json.dumps(response, indent=4)).

You’ll receive a JSON response with the transcript, the summary, and the search findings. It looked something like this:

The Summary

"summaries": [
                            {
                                "summary": "Lack of one county has not been immune to the slow economic growth over the past five years. So for us, the name of the game is budget reduction.",
                                "start_word": 0,
                                "end_word": 597
                            }
]
Enter fullscreen mode Exit fullscreen mode

The Search

"search": [
                    {
                        "query": "business",
                          "hits": [
                            {
                                "confidence": 1.0,
                                "start": 231.305,
                                "end": 231.705,
                                "snippet": "business"
                            },
                        "query": "deal",
                         "hits": [
                            {
                                "confidence": 0.7395834,
                                "start": 86.13901,
                                "end": 86.298805,
                                "snippet": "i'll"
                            },
                        "query": "joke",
                         "hits": [
                            {
                                "confidence": 1.0,
                                "start": 82.125,
                                "end": 82.284996,
                                "snippet": "one joke"
                            },
Enter fullscreen mode Exit fullscreen mode

Your insights from the sales meeting. From the summary, it seems as if the customer wants to reduce costs and the search confidence indicates Michael Scott talked about business, didn’t discuss deals too much, and told some jokes.

You share this with the President of Sales. They now have a better understanding of what happened in the sales call, how to coach Michael Scott on closing future sales deals, and how to follow up with the customer.

Moving forward, all of Dunder Mifflin’s sales meetings were recorded, transcribed, and insights were derived using Deepgram to improve performance and maximize revenue. Corny jokes were only allowed if they helped build relationships with the customer.

The end.

Here’s the whole code sample:

from deepgram import Deepgram
import json

DEEPGRAM_API_KEY = YOUR_API_KEY_GOES_HERE
PATH_TO_FILE = 'audio/the-office-meeting.mp3'

def main():
   # Initializes the Deepgram SDK
   deepgram = Deepgram(DEEPGRAM_API_KEY)
   # Open the audio file
   with open(PATH_TO_FILE, 'rb') as audio:
       # ...or replace mimetype as appropriate
       source = {'buffer': audio, 'mimetype': 'audio/mp3'}
       options = {
           'summarize': True,
           'search': ['business', 'deal', 'joke']
       }

       response = deepgram.transcription.sync_prerecorded(source, options)
       print(json.dumps(response, indent=4))

main()
Enter fullscreen mode Exit fullscreen mode

If you have any feedback about this post, or anything else around Deepgram, we'd love to hear from you. Please let us know in our GitHub discussions.

Top comments (0)