https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> Does the retell have a vari...
# ❓・ai-evy-support
d
@AI Evy Does the retell have a variable that automatically gets the current date and time
a
Thanks for tagging me @Deleted User. I'll look through relevant sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Dynamic Variables]() * [Retell AI | Transforming After Hours Call Answering Services with AI Phone Agents]() * [Current_Time variable not working]() * [im using the {{current_time}} variable, but the agent says is march 14th instead of march 5th]() -----------------------------
### Answer Yes, Retell AI provides default system variables for current time [(1)]() : -
{{current_time}}
- Shows current time in America/Los_Angeles timezone -
{{current_time_[timezone]}}
- Shows current time in a specified timezone (e.g.
{{current_time_Australia/Sydney}}
) However, there have been some reported issues with time accuracy [(2)]() [(3)]() [(4)]() . As a workaround, you can send your own date/time using dynamic variables through the inbound webhook or API call for outbound calls [(5)]() . To use these variables, you can include them in your prompts like:
Copy code
json
"Hello, today is {{current_time}}"
[(1)]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
Can you tell me more about this error: error: Error in executing custom function call: Check-GHL-Calendar-Availability Axios Error: error code: ERR_BAD_RESPONSE, error message: Request failed with status code 500 response status: 500 response data: [{"message":"1"},"Error in workflow"]
@AI Evy Can you tell me more about this error: error: Error in executing custom function call: Check-GHL-Calendar-Availability Axios Error: error code: ERR_BAD_RESPONSE, error message: Request failed with status code 500 response status: 500 response data: [{"message":"1"},"Error in workflow"]
a
Thanks for the follow-up, @Deleted User. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Integrate any system with custom function]() * [Custom Function]() * [Discord message from @immaculate_gull_56396 on 2025-03-18]() * [Random Booking issues]() -----------------------------
### Answer Based on the available documentation, this appears to be a server-side error (500) from your custom function endpoint. For custom functions, Retell sends a POST request to your specified URL and expects a response with a status code between 200-299 to indicate success [(1)]() . When troubleshooting custom functions, you should: 1. Verify the request is coming from Retell by checking the
X-Retell-Signature
header 2. Ensure your endpoint can handle the request format: - Headers include
X-Retell-Signature
and Content-Type: application/json - Body contains
name
,
call
, and
args
fields 3. Check that your response format is valid - it can be a string, buffer, JSON object, or blob 4. Note that failed requests will be retried up to 2 times with a default timeout of 2 minutes If you need additional help, I recommend: 1. Checking your server logs for more detailed error information 2. Verifying your GHL (Go High Level) API credentials and endpoint configuration 3. Testing the endpoint directly to ensure it's responding correctly Would you like me to provide a general response about implementing custom functions in Retell AI?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy what does this part of the error means: response data: [{"message":"1"},"Error in workflow"]
a
Thanks for the follow-up, @Deleted User. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Custom Function]() * [Integrate any system with custom function]() -----------------------------
### Answer I cannot find specific documentation about this exact error message format in the available information sources. However, I can provide a general explanation based on the custom function response specifications: For custom functions in Retell AI, the response data should have a status code between 200-299 to indicate success [(1)]() [(2)]() . The error message you're seeing appears to be a custom error response from your workflow implementation rather than a standard Retell AI error format. The format
[{"message":"1"},"Error in workflow"]
suggests this is coming from your application's error handling logic rather than Retell AI's system. Would you like me to provide information about the proper response format for custom functions in Retell AI?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy Yes, provide me with the proper response format for custom functions in Retell
a
Thanks for the follow-up, @Deleted User. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Custom Function]() * [Integrate any system with custom function]() -----------------------------
### Answer For custom functions in Retell AI, the response should follow these specifications: 1. Status Code Requirements: - Must have a status code between 200-299 to indicate success [(1)]() 2. Valid Response Formats: - String - Buffer - JSON object - Blob Here's an example of a proper response format using JavaScript:
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");
  }
});
[(2)]() Or using Python with FastAPI:
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"}
        )
Important notes: - The function result is capped at 4000 characters to prevent overloading LLM context window [(1)]() - All response formats will be converted to string before sending to LLM for further processing - Failed requests will be retried up to 2 times with a default timeout of 2 minutes if not specified
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy Verify the request is coming from Retell by checking the X-Retell-Signature header. How to do this?
a
Thanks for the follow-up, @Deleted User. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Integrate any system with custom function]() * [Custom Function]() * [Retell AI | Retell AI Webhooks: AI Agents Acting On Real-Time Call Data]() * [Error with Retell.verification]() -----------------------------
### Answer To verify requests are coming from Retell, you can check the
X-Retell-Signature
header which contains an encrypted request body using your secret key [(1)]() [(2)]() . Here's how to implement the verification in JavaScript:
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;
  }
  // Rest of your code...
});
[(1)]() Or in Python with FastAPI:
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"})
        # Rest of your code...
Additional security tip: You can further secure your server by allowlisting Retell's IP address:
100.20.5.228
[(1)]() [(2)]() Important note for Python users: Make sure you have the latest version of the SDK installed as older versions may not have the verify method [(3)]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.