https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> How do I get the transcript...
# ❓・ai-evy-support
r
@AI Evy How do I get the transcript and all call related data send to any API?
a
Thanks for tagging me @realee_23147. I'll look through relevant sources and get back to you shortly.
### Answer To get transcript and call data sent to your API, you have two main options: ## 1. Get Call API (After Call Ends) You can retrieve call details including transcript using the Get Call API after the call ends [(1) ]() [(2) ]() . The API returns comprehensive call information including transcript, recording, latency tracking, and other call details . ## 2. Webhooks for Real-Time Updates You can set up webhooks to receive real-time updates when calls are initiated, end, and analyzed . This allows you to automatically send call data to your API as events occur. For webhook implementation, you can verify requests are from Retell using the
X-Retell-Signature
header [(3) ]() [(4) ]() :
Copy code
javascript
import { Retell } from "retell-sdk";

this.app.post("/check-weather", async (req: Request, res: Response) => {
  if (
    !Retell.verify(
      JSON.stringify(req.body) ,
      process.env.RETELL_API_KEY,
      req.headers["x-retell-signature"] as string,
    )
  ) {
    console.error("Invalid signature") ;
    return;
  }
  const content = req.body;
  if (content.args.city === "New York") {
    return res.json("25f and sunny") ;
  } else {
    return res.json("20f and cloudy") ;
  }
}) ;
Copy code
python
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from retell import Retell

retell = Retell(api_key=os.environ["RETELL_API_KEY"])

@app.post("/check-weather")
async def check-weather(request: Request) :
    try:
        post_data = await request.json()
        valid_signature = retell.verify(
            json.dumps(post_data, separators=(",", ":") , ensure_ascii=False) ,
            api_key=str(os.environ["RETELL_API_KEY"]) ,
            signature=str(request.headers.get("X-Retell-Signature") ) ,
        )
        if not valid_signature:
            print(
                "Received Unauthorized",
                post_data["event"],
                post_data["data"]["call_id"],
            )
            return JSONResponse(status_code=401, content={"message": "Unauthorized"})
        args = post_data["args"]
        if args["city"] == "New York":
            return JSONResponse(status_code=200, content={"result": "25f and sunny"})
        else:
            return JSONResponse(status_code=200, content={"result": "20f and cloudy"})
    except Exception as err:
        print(f"Error in webhook: {err}")
        return JSONResponse(
            status_code=500, content={"message": "Internal Server Error"}
        )
The webhook includes call analysis metrics like Call Completion Status, Task Completion Status, User Sentiment, and latency tracking [(5) ]() . Function call results are also included in transcripts .
​ To learn more, see the sources I considered: [[1] Receive calls](https://docs.retellai.com/deploy/inbound-call) [[2] Outbound calls (make calls)](https://docs.retellai.com/deploy/outbound-call) [[3] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[4] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[5] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.