https://retellai.com/?utm_source=discord&utm_medium=seo logo
My custom functions are being ignored and Retell k...
# ❓・ai-evy-support
s
@AI Evy My custom functions are being ignored and Retell keeps firing its internal cal.com integration calling /v2/slots?eventTypeId even though I deleted all cal.com built-in functions. This is causing 401 errors on every call. How do I completely disable Retell's internal cal.com integration?
a
Thanks for tagging me @Suxxy. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Error with Cal.com integration](https://discord.com/channels/1186424376300679209/1432628757067337778) [[2] cal.com integration limitation](https://discord.com/channels/1186424376300679209/1391199864372727828) [[3] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) ​
### Answer The 401 errors you're seeing suggest that Retell is still attempting to use Cal.com's API even after you've removed the built-in functions [(1) ]() . Based on community reports, this issue has affected other users as well . To use custom functions instead of the built-in Cal.com integration, you need to: 1. Create custom functions that handle Cal.com API calls yourself [(2) ]() 2. Verify your custom function requests are coming from Retell by checking the
X-Retell-Signature
header [(3) ]() Here's the verification code for custom functions:
Copy code
javascript
import { Retell } from "retell-sdk";
import express from "express";

const app = express() ;
// Use raw body for signature verification, not JSON.stringify(req.body) .
app.use(express.raw({ type: "application/json" }) ) ;
app.post("/check-weather", async (req, res) => {
  const rawBody = req.body.toString("utf-8") ;
  if (
    !Retell.verify(
      rawBody,
      process.env.RETELL_API_KEY,
      req.headers["x-retell-signature"],
    )
  ) {
    console.error("Invalid signature") ;
    return;
  }
  const content = JSON.parse(rawBody) ;
  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:
    raw_body = (await request.body() ) .decode("utf-8")
    valid_signature = retell.verify(
      raw_body,
      api_key=str(os.environ["RETELL_API_KEY"]) ,
      signature=str(request.headers.get("X-Retell-Signature") ) ,
    )
    if not valid_signature:
      print("Received Unauthorized")
      return JSONResponse(status_code=401, content={"message": "Unauthorized"})
    post_data = json.loads(raw_body)
    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"}
    )
If the built-in Cal.com integration continues to fire after deletion, try rotating your Cal.com API key [(1) ]() . One user reported needing to create a workaround using Make.com to handle Cal.com API calls externally when the built-in integration had issues .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.