Skip to main content
Solved

Retrieve call transcript through API using python

  • 30 July 2024
  • 4 replies
  • 85 views

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!

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"

}

}

 


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!


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))

 


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


Reply