https://retellai.com/?utm_source=discord&utm_medium=seo logo
Chat API Issues
# ❓・bug-report
c
@Omar Ashraf | Community Lead The issue Im having is an app I build to pull in retell chat data was working up until a couple of weeks ago when something changed on your end. I got the error fixed but then I notice for some reason im unable to pull in chat data from months previous. If I filter to last month in my app I get 0 chat records returned, but in Retell there are 101 chats. This was working great for months, then it broke. Do you have an insight on this? Thanks.
o
Hello @clientele , can you share your org id ?
c
org_d65ez6Ty5ACxnjp3
o
You are using the API , and it doesn't return anything ? can you explain to me how you are fetching it maybe share the request.
c
It returns data for when I filter for today, ect. but when I try to filter for Last Month it give me 0 when I have 101 records to show. Has something changes in the api recently?
o
Can you share this request ?
c
What details from the request are you looking for exactly. Im using Retell AI API in an app I put together if that gives you a better idea.
o
I want to know how you are doing the filtration ?
c
We are currently not passing the date range to the API endpoint because we were under the impression that GET /list-chat did not support date filtering. Instead, we are fetching the most recent 1,000 chats and filtering them client-side. The issue appears to be that 'Last Month' records differ from the 1,000 most recent records, so they are never retrieved from the API. 1. How we generate the Date Range (Client-Side): We generate calculations using standard JavaScript Date objects. typescript // Client-side date calculation for "Last Month" const today = new Date(); const startOfLastMonth = new Date(today.getFullYear(), today.getMonth() - 1, 1); startOfLastMonth.setHours(0, 0, 0, 0); const endOfLastMonth = new Date(today.getFullYear(), today.getMonth(), 0); endOfLastMonth.setHours(23, 59, 59, 999); // resulting in timestamps (ms) which we filter against locally 2. The API Call we are making: We are calling the list-chat endpoint with a limit of 1000 and descending sort, but without filter_criteria.start_timestamp. typescript // Current API Request Body { "sort_order": "descending", "limit": 1000 } Can we pass filter_criteria.start_timestamp (with lower_threshold and upper_threshold in milliseconds) to the POST /v2/list-chat endpoint to filter by date server-side? If so, could you confirm the exact JSON structure for that payload?"
o
Hello @clientele , was the limit working with you before? I'm not sure you can setup a limit param for the list-chat api
Let me know so I can check with the team about it.
c
All I know a couple of weeks ago I woke up and my app was having errors retrieving data. I have claude code fix the error but notices this issue. So Im not 100% sure what it was before I made the changes. If you can reach out to the team regardless that would be greatly appreciated as I need this fixed asap.
o
Sure, I will let the team know and update you about it .
c
Thank you very much and your response time is incredible!
c
Perfect thanks I will try and update now.
Looks like it worked! Thanks again.