Skip to main content
Solved

Retrieve call transcript through API using python


Forum|alt.badge.img

Hi! I'm new to Gong and I'm trying to use python and the API to retrieve our available data.

I managed to get basic information on the calls iterating through https://api.gong.io/v2/calls, using the request package. Now I want to get all of the call's transcripts and details and I can't seem to manage.

This is what I've tried:

url =  'https://api.gong.io/v2/calls/transcript?callIds=<CALL_ID>'
requests.get(url, auth=(<ACCESS_KEY>, <GONG_SECRET_KEY>)).json()

this throws this error:

{'requestId': <REQUEST_ID>, 'errors': ['Bad request']}

Could you help me figure out what I'm doing wrong?

Thank you!

Best answer by Teresa Cañas

Ah, I figured it out. Thanks. In case anyone is wondering:

 

    headers = {
        "Content-Type": "application/json"
    }
    payload = {
        "filter": {
            "callIds": call_ids
        }
    }
    response = requests.post(transcript_url, auth=(access_key, secret_key), headers=headers, data=json.dumps(payload))

 

View original
Did this topic help you find an answer to your question?

4 replies

Andrew O'Driscoll
Forum|alt.badge.img+4

The transcript is a POST method, unlike the calls which is a GET. You need to pass a JSON payload with the post and not put it through the URL

 

Consult this API page for more info

 https://us-62605.app.gong.io/settings/api/documentation#post-/v2/calls/transcript

 

Here is a sample JSON payload.

{

"filter": {

"fromDateTime": "2024-01-01T02:30:00-08:00",

"toDateTime": "2024-06-15T23:59:00-08:00"

}

}

 


Forum|alt.badge.img
  • Author
  • Community Newbie
  • 3 replies
  • July 30, 2024

Thanks for the quick answer @Andrew O'Driscoll. I read the documentation and I didn't see my answer clearly. Would you mind showing an example?

 

Given the <ACCESS_KEY>, <SECRET_KEY> and <CALL_ID> parameters?

 

Thank you so so much!


Forum|alt.badge.img
  • Author
  • Community Newbie
  • 3 replies
  • Answer
  • July 31, 2024

Ah, I figured it out. Thanks. In case anyone is wondering:

 

    headers = {
        "Content-Type": "application/json"
    }
    payload = {
        "filter": {
            "callIds": call_ids
        }
    }
    response = requests.post(transcript_url, auth=(access_key, secret_key), headers=headers, data=json.dumps(payload))

 


Molly Kipnis
Forum|alt.badge.img+2
  • Community Manager
  • 597 replies
  • July 31, 2024

Awesome! Thanks for following up with your solution @Teresa Cañas, and thank you for your help as always @Andrew O'Driscoll!!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings
×