sensitive-blue•2y ago
Getting call transcript in Python
I can obtain the call transcript by copy/pasting from the dashboard. Is there a way to get back the call transcript in Python? I can't find it in the documentation.
12 Replies
Hi @MelonUsk, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* List Credentials
* Get Credential
* Outbound Calls from Python
* Get Call
-----------------------------
Answer
Yes, you can retrieve the call transcript in Python by using the Vapi API to get details of a specific call. Once you have the call's ID, you can use the "Get Call" endpoint to fetch the call details, which includes the transcript. Here is a simplified example of how you could achieve this:
This code sample demonstrates how to use the "Get Call" endpoint to fetch details about a specific call, including its transcript, by making a GET request with the call ID. Replace
<YOUR AUTH TOKEN>
with your actual Vapi API authorization token and <CALL ID>
with the ID of the call you're interested in (1) .
Remember, to use this script, you'll need to have already made a call or have a call ID that was generated by your Vapi application. You can find more detailed information about the "Get Call" endpoint in the Vapi documentation.sensitive-blueOP•2y ago
How can I get the most recent
call_id
?genetic-orange•2y ago
get /call and first array item will be the most recent call.
sensitive-blueOP•2y ago
Hi Sahil, can you share how to get /call in Python? Or point me to relevant docs? Thanks!
genetic-orange•2y ago
sensitive-blueOP•2y ago
import requests
url = "https://api.vapi.ai/call/{. id. }"
headers = {"Authorization": "Bearer <token>"}
response = requests.request("GET", url, headers=headers)
print(response.text)
This is what I'm asking - how can I get the most recent {id} ?
genetic-orange•2y ago
you don’t need to provide the id
sensitive-blueOP•2y ago
Getting this error when not providing the id:
{"message":["id must be a UUID"],"error":"Bad Request","statusCode":400}

genetic-orange•2y ago
remove the /{id}
sensitive-blueOP•2y ago
Thank you for your help and patience!
response.json()[0]['transcript']
did it for me 😄genetic-orange•2y ago
Awesome