First Response Time selection criteria

When using the reports APIs for first response time, the number of records I am getting is different from the number of records I am getting from the chat_archives APIs. Why is that so? Is there a criteria that the reports API uses?
I also filtered all the messages where the agent replied but still the number wasn’t same.

Hello @umer,
Thanks for reaching us!

In order for the first time response record to appear, there has to be a message from the Visitor and a response from the Agent. If the visitor initiated the chat, but did not write any messages, First response time won’t be counted even if Agent is sendind messages in it.
To calculate that easily, the number of first response times should be equal to Total Chats minus Missed chats.
You can get a number of missed chats via API by adding the parameter &replied=0 to /chats endpoint. For example:

https://api.livechatinc.com/chats?page=1&sort_order=desc&query&date_from=2019-12-10&date_to=2019-12-10&replied=0

If you are still seeing discrepancies, please provide the exact endpoints to our API you are calling with the results received and our Tech team will investigate that.

I am using the following apis to get all chats archives:
https://api.livechatinc.com/v3.1/agent/action/get_archives

The number of records with first response for the date (2019-09-15) is 692. Even if I count the records where the user doesn’t sends messages but comments or like the chats the number goes up to 700.

However when using the following reports api:
https://api.livechatinc.com/reports/chats/first_response_time?date_from=2019-09-15&date_to=2019-09-16

The number of records I am getting is 704. Why is that so?

We have checked that and there were 796 total chats that day. 35 of those chats were missed (no reply from an Agent). The number of First Responses is 704, conditions being: Visitor sends message or file in the chat and Agent sends a reply in the same way. Order is important here, it has to be Agent message after the Visitors.

The rest of the chats that day (60) had no messages from Visitors (rating and rating comment do not count as messages in this case).

Can you please elaborate on the method you are using in data taken from “get_archives” to determine whether there was a First Response or not?

The response from the get_archives api shows that 800 records are present inside the pagination object. So I am looping through all pages (8 in this case with page limit set to 100). Then I loop through all the events of a particular thread to check if the msg sent by the customer is followed by msg sent by agent.

However there are a couple of issues, the data I am getting from the apis contains some records of 2019-09-14. Same happens when I query data of 2019-09-16 I get some records of 2019-09-15.

Also the number of records obtained from the above method are not equal to the number return from the first_response_time endpoint.

Hello,

We spotted a discrepancy between responses from v3 endpoint get_archives and v2 chats and most probably this is the source of differences that you see.
We are going to create an internal ticket on this case to explain it and will let you know as soon as we find out what’s going on.

Thanks for contacting us!

Any update regarding this issue? I am running short on time as I have to deliver a project that uses these APIs. Or If there’s an alternate then let me know. Thanks

Unfortunately, we still doesn’t know what causes the difference.

Until that, you can extract the archives with the v2 method,

and your data should match First Response Time Reports API that you actually use.

The documentation states that v2 is deprecated. Also We need to know how long will the v2 be available because once we start using it we won’t be able to migrate to v3 right away.

We haven’t set any particular date of v2 termination, so I think that it’s not likely to happen soon.
Unfortunately, I am not able to provide you with more specific info.